Tutorial
From GumstixDocsWiki
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Customers using Gumstix OpenEmbedded should go to gumstix.net and the related user wiki
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
For customers using buildroot:
Contents |
Introduction to Linux
Here is a good introduction to linux in general.
Note that the gumstix uses busybox and the commands are simplified.
The complete list of commands that could be built in to busybox is here.
You can find out which commands are actually available by doing:
ls /bin /sbin /usr/bin /usr/sbin
Setting up a build-root environment
For a complete description see Programming.
svn co http://svn.gumstix.com/gumstix-buildroot/trunk gumstix-buildroot cd gumstix-buildroot make defconfig make
If you are running on a linux 2.4.x system and the build fails in the kernel with depmod errors read: Buildroot on Linux 2.4.
If you want to get a specific revision XXX, use
svn co -rXXX http://svn.gumstix.com/gumstix-buildroot/trunk gumstix-buildroot
Recompiling the Linux Kernel
If you want to recompile the linux kernel for your gumstix board, follow these steps.
cd <gumstix-buildroot> cd build_arm_nofpu cd linux-<the version of linux you're using> make ARCH=arm CROSS_COMPILE=`pwd`/../staging_dir/bin/arm-linux- menuconfig make ARCH=arm CROSS_COMPILE=`pwd`/../staging_dir/bin/arm-linux- cd <gumstix-builtroot> make
Replacing the filesystem-image
Using Kermit
For a detailled description see the u-boot-page.
Under Linux you'll need Kermit (cKermit), as u-boot doesn't accept Minicom for data-transfer. (Actually it does; see below.). For Windows use hyperterm (its under the "transfer" menu).
(Obviously you need to replace /dev/ttyS0 with your serial-port).
$ kermit -l /dev/ttyS0 > set flow-control none > set carrier-watch off > set speed 115200 > set reliable > fast > set prefixing all > set file type bin > set rec pack 4096 > set send pack 4096 > set window 5 > connect
Now start your gumstix. You should see U-boot counting down.
Interrupt u-boot (by pressing any key) and prepare it for data reception:
WARNING: for verdex you must use a slightly different procedure. See
Replacing the filesystem image#Verdex for instructions.
GUM> loadb a2000000
Go back into kermit mode, using CTRL-\ c, and send the image.
> robust > send rootfs.arm_nofpu.jffs2
Now erase the old image (This will erase everything on the flash, except for u-boot itself!), and flash the new one:
> connect
GUM> protect on 1:0-1
GUM> erase all
GUM> cp.b a2000000 40000 ${filesize}
Older ((U-boot))s use "$(filesize)". You can test U-boots capabilities, using the echo-command.
At least one of the three possibilities should work:
GUM> echo ${filesize}
GUM> echo $(filesize)
GUM> echo $(filesize)
When you're ready to boot with your new kernel, enter the following:
boot
With any luck, you'll have a running gumstix in a minute or so.
Note: If you get the following error message:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
The new root_fs needs to mount / from device 1f01 instead of 1f02 which is where the old '/' was -- linux changed the MTD device enumeration ordering between 2.6.11 and 2.6.15 and so our root device in flash moved.
In u-boot, do:
GUM> set bootargs console=ttyS0,115200n8 root=1f01 rootfstype=jffs2 GUM> saveenv GUM> bootd
Note: If you see lots of Unknown node type messages:
### JFFS2 loading 'boot/uImage' to 0xa2000000 Scanning JFFS2 FS: . Unknown node type: 2006 len 4288 offset 0x5ef40 Unknown node type: 2006 len 6480 offset 0x7e6b0 / Unknown node type: 2006 len 4988 offset 0x9ec84 . Unknown node type: 2006 len 7368 offset 0xbe338 - Unknown node type: 2006 len 10128 offset 0xdd870
that's currently normal. The 2.6.15 kernel has changed the JFFS2 filesystem in a way that cause u-boot to report these unknown node-type messages. You can ignore the messages.
Using MMC
There's a description on the U-boot-page. Another howto can be found on the gumstix-forum.
Using Minicom
You can use Minicom to do the Kermit transfer, but you still need to have the Kermit (cKermit) program installed. Create a ~/.kermrc file, with these contents:
set carrier-watch off set reliable fast set prefixing all set file type bin set rec pack 4096 set send pack 4096 set window 5 set modem type none set flow-control none
USBNet under Linux
- Main article: setting up USBnet
USBNet (tcp/ip connection over usb) depends heavily on the kernel-version you are using on the host, and the gumstix-image you've flashed on your gumstix:
- If you have a Linux 2.6.10+ to 2.6.13 everything should work out of the box (regardless of the gumstix-image). All you need to do, is modprobe the usbnet-module. If you don't have one, you'll need to recompile your modules/kernel.
You can then proceed to test your connection.
If you have the above kernel and the usbnet modules loaded but it still does not work, then when compiling the kernel make sure when doing "make menuconfig" that Device Drivers -> USB Support -> USB Network Adapters -> Embedded Arm Linux Links (CONFIG_USB_ARMLINUX) is selected Also under Device Drivers -> USB Support -> USB Gadget Support
The following are selected: Support for USB Gadgets, USB Gadget Drivers (Ethernet Gadget), Ethernet Gadget, and RNDIS support are selected. I selected them to be included in the kernel, not as modules. I do not know if this makes a difference.
For Linux 2.6.13.?+ you will need to add:
Device Drivers -> USB Support -> USB Network Adapters. Select "Multi-purpose USB Networking Framework" "Simple USB Network Links (CDC Ethernet Subset)" and "Embedded ARM Linux Links (iPaq, ...)"
You can also select "Host for RNDIS devices (EXPERIMENTAL)"
- If you have Linux 2.6.9-, you'll need to patch the kernel: drivers/usb/net/usbnet.c needs to be changed, so that it recognizes the gumstix as usb-net device (the file should be in the attachement-section of this page):
--- usbnet_orig.c 2004-11-12 22:55:56.000000000 +0100
+++ usbnet.c 2004-11-22 20:37:14.000000000 +0100
@@ -3320,6 +3320,10 @@
}, {
USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader
.driver_info = (unsigned long) &blob_info,
+}, {
+ // Linux Ethernet/RNDIS gadget on pxa210/25x/26x
+ USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203),
+ .driver_info = (unsigned long) &linuxdev_info,
},
#endif~
Just as reminder. The usual procedure to patch:
~cd /usr/src/linux/drivers/usb/net patch < ~/usbnet.patch
If you build usbnet as module you'll just need to rebuild and install the modules (make modules modules_install), otherwise you'll need to rebuild the kernel. This solves the host-part. The attached patch doesn't work with recent gumstix-images though, as they are made work with Windows too (and only recent linux-kernels are able to deal with this).
The easiest workaround is building the gumstix-image without RNDIS (==windows-usb-net). Obviously you won't be able to attach your gumstix to Windows-machines anymore.
First fetch the build-root environment (using svn as described above), but do not yet build it. Enter the gumstix-buildroot/sources directory and disable RNDIS in the linux.conf file:
cd gumstix-buildroot/sources sed -i 's/CONFIG_USB_ETH_RNDIS=y/# CONFIG_USB_ETH_RNDIS is not set/' linux.config
Now build you environment as usual:
~cd .. make
This should create a new rootfs.arm_nofpu.jffs2 image that you can upload to the Gumstix.
USBNet under Windows
- Main article: Windows XP usbnet
In the current revision (r434) usb isn't started automatically at boot-up anymore. In this case just add "auto usb0" to /etc/network/interfaces (on the gumstix) before proceeding.
Normally you just need to install the linux.inf from the gumstix linux source tree (gumstix-buildroot/build_arm/linux-X/Documentation/usb). You can get the file in the attachment-section of this page too.
Windows should then automatically detect your gumstix. If it doesn't you gumstix-image might not be up to date. Flash a newer version and try again.
Windows should automatically detect your gumstix. Follow Windows_XP_usbnet to install the driver. You'll need DOS version of linux.inf before proceeding.
Dave Hylands has some nice instructions of getting dhcp to work under windows. Have a look at his usbnet page, until its content is merged here.
If you are using Windows 2000, you may need an RNDIS driver, which is available at: rndis.
Windows 2000 does not appear to support bridging, however if you configure Windows' RNDIS interface to use 192.168.1.1, and Gumstix' usb0 to use 192.168.1.2, you should be able to access the Gumstix from your Windows box. (Or use 192.168.2.X if your network already uses 192.168.1.
Testing the connection
If everything works as expected you should have an usb0 interface (ifconfig -a) on both host (if Linux) and Gumstix after having plugged the USB-cable. From here on it's standard networking. If you are unfamiliar with Linux/Windows networks here some short lines to test your connection. Under Linux type "ifconfig", and look for adresses starting with 192.168.0.X.
If you have some, replace 192.168.0.1 with 10.0.0.1 and 192.168.0.2 with 10.0.0.2 in the following lines (same applies for Windows: if you have already a network that uses 192.168.0.X, switch to another network):
On the Gumstix (over serial line):
# ifconfig usb0 192.168.0.2
On the linux-machine:
# ifconfig usb0 192.168.0.1 # ssh root@192.168.0.2
And you should be connected to your gumstix over the usb-connection. Under Windows just configure the USB-interface to have 192.168.0.1 as IP-address. You can test the connection by httping to the gumstix (http://192.168.0.2).
If you want to have a static IP on your gumstix edit /etc/network/interfaces on you gumstix and replace
iface usb0 inet dhcp pre-up /sbin/modprobe g_ether;/sbin/modprobe af_packet post-down /sbin/modprobe -r g_ether
with
iface usb0 inet static address 192.168.0.2 netmask 255.255.255.0 pre-up /sbin/modprobe g_ether;/sbin/modprobe af_packet post-down /sbin/modprobe -r g_ether
Note however, that reflashing the gumstix will erase this file!
Therefore the cleanest solution is to add a dhcp-server on the host-machine.
You might also have a look at the Ethernet gadget page.

