Compiling the iMote2 kernel: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 212: | Line 212: | ||
echo "Mounting Filesystem and installing kernel modules" | echo "Mounting Filesystem and installing kernel modules" | ||
cd images | |||
mkdir /mnt/jffs2Image | mkdir /mnt/jffs2Image | ||
losetup /dev/ | losetup /dev/loop/0 ../fs.jffs2 | ||
modprobe blkmtd device=/dev/ | mknod /dev/mtdblock0 b 31 0 | ||
mount /dev/mtdblock0 /mnt/jffs2Image | modprobe blkmtd device=/dev/loop/0 | ||
mount -t jffs2 /dev/mtdblock0 /mnt/jffs2Image | |||
echo "Removing all old modules from JFFS2 Image" | |||
rm -rf /mnt/jffs2Image/lib/modules/* | |||
echo "Copying new modules to JFFS2 Image" | |||
cp -a ../linux-2.6.14/modules/lib/modules/2.6.14_r1.0/ /mnt/jffs2Image/lib/modules/ | |||
echo "Unmounting image" | |||
sync | |||
umount /mnt/jffs2Image | |||
modprobe --remove blkmtd | |||
losetup -d /dev/loop/0 | |||
</bash> | </bash> |
Revision as of 02:09, 13 January 2007
Downloads
Build Tools
File | Link | Description |
---|---|---|
iMote2 Toolchain | updated Mainstone version | Use either the updated Mainstone version with an updated version of binutils. The handheld.org toolchain is similar but won't build the kernel. |
Needed Files
- Zydas driver:
- Official version is available from atheros.com
- Non-officail versions (with bug fixes) are available from zd1211.ath.cx
File | Link | Description |
---|---|---|
PlatformX 1.0 Release | sourceforge.net or local mirror | General PlatformX kernel build |
MSB2 Specific patches | here | |
2.6.14 linux kernel | kernel.org or local mirror | |
iMote2 JFFS2 image | fs.jffs | Our default starting point JFFS2 image |
Zydas ZD1211(b) wifi driver* | here and .config patch |
Steps
Extracting all the Images
-
Assuming you placed the platformX release, patches, and kernel in the same directory you could extract them all using the following commands:
<bash>tar zxf linux-2.6.14.tar.gz
tar zxf SG2Release-1_0.tgz
tar zxf msb2_patches.tgz</bash>
Patch the kernel
-
First we apply the SG2 release patches then we apply our MSB2 patches:
<bash>cd linux-2.6.14
echo "Applying SG2 Patches"
patch -p1 < ../SG2Release-1_0/src/patch-2.6.14-sg2-10
echo "Applying MSB2 Patches"
patch -p1 < ../msp-linux-2.6.14-pxa-mmc.patch
patch -p1 < ../msp-linux-2.6.14-uart.patch
patch -p1 < ../msp-linux-2.6.14-sd-detect.patch</bash>
Configure the kernel
-
At this point you can either use the normal SG2 configuration or apply the msb2 standard configuration. Be sure to add your toolchain to your path, if you've installed it in /usr/local/arm/3.4.3_binutils you could do something like this:
<bash>export PATH=/usr/local/arm/3.4.3_binutils/bin/:$PATH
export ARCH=arm
export CROSS_COMPILE=arm-linux-</bash>
- Device Drivers
- USB Support
- USB GadgetSupport
- Support for USB Gadgets (compile into the kernel)
- USB Gadget Drivers (compile into the kernel)
- Make sure 'Ethernet Gadget (with CDC Ethernet Support)' is selected
- Select 'RNDIS support (EXPERIMENTAL)'
- USB GadgetSupport
- USB Support
- Networking
- Networking options
- IP: Advanced router
- IP: Policy routing (will not appear unless "Advanced router" is set)
- Networking options
SG2 Configuration
-
<bash>export ARCH=arm
export CROSS_COMPILE=arm-linux-
make stargate2_defconfig
make oldconfig</bash>
MSB2 Configuration
-
<bash>export ARCH=arm
export CROSS_COMPILE=arm-linux-
cp ../msp-linux-2.6.14-config ./.config
make oldconfig</bash>
RNDIS (Windows XP) Ethernet Gadget Configuration
-
If you'd like to be able to connect the iMote2 to a Windows XP host instead of a linux host you can use the RNDIS patch to add Windows XP support to the kernel. Download the patch from here to your build directory. Note, that this patch currently compiles support into the kernel and not as a module.
<bash>export ARCH=arm
export CROSS_COMPILE=arm-linux-
cp ../msp-linux-2.6.14-config ./.config
patch -p1 < ../msp-linux-2.6.14-winXP-rndis.patch
make oldconfig</bash>
Next you will need to do a make menuconfig (after setting up the ARCH/CROSS_COMPILE/path) and select:
Configuring the kernel to use multiple Internet connections
-
In order for the iMote to selectively use multiple Internet connections simultaneously, you must enable "policy routing" in the kernel:
<bash>make menuconfig</bash>
Select the following:
Compile the kernel
-
You can then build the kernel as you normally would or perform any additional steps you want to before building. Note that if you are using the Mainstone tools instead of a 3.4.1 toolchain installed in /usr/local/arm/3.4.1 you will need to edit Makefile.platx and comment out the export lines at the top.
<bash>...
- export ARCH=arm
- export CROSS_COMPILE=/usr/local/arm/3.4.1/bin/arm-linux-
- export PATH:=${PATH}:/usr/local/arm/3.4.1/bin/
Building the zd1211(b) wireless driver
-
While the newest versions of Linux support the zd1211(b) out-of-the-box, the kernel used on the iMote does not. Therefore, you must download and compile the driver seperately:
- Obtain and extract the latest version from [1]. As of the time of this edit, this was r83. You can do this in one step with: <bash>wget http://zd1211.ath.cx/download/zd1211-driver-r83.tgz -O - | tar xvzf -</bash>
- cd to the newly-created directory.
- Edit the Makefile, and change the MODPATH (on line 13) to point at your modules/lib/modules/2.6.14_r1.0/ directory.
- Compile and install:
Flashing the kernel
-
You will need to specify the platform (SG2/Intel Mote2) and JTAG cable that you are using (Intel(R) JTAG Cable/JTAG CPU) to XFlash. The following assumes you are programming an Intel Mote2 with a Macraigor Raven JTAG:
xflash -p intelmote2 -tt "JTAG CPU" blob -offset 0x00000000
xflash -p intelmote2 -tt "JTAG CPU" zImage -offset 0x00040000
xflash -p intelmote2 -tt "JTAG CPU" fs.jffs2 -offset 0x00240000
And the following assumes you are programming an Intel Mote2 with an Intel JTAG
xflash -p intelmote2 -tt "Intel(R) JTAG Cable" blob -offset 0x00000000
xflash -p intelmote2 -tt "Intel(R) JTAG Cable" zImage -offset 0x00040000
xflash -p intelmote2 -tt "Intel(R) JTAG Cable" fs.jffs2 -offset 0x00240000
Typical Build
- MSB2 Build
- Windows RNDIS Gadget Driver
- Wifi Module
<bash> tar zxf linux-2.6.14.tar.gz tar zxf SG2Release-1_0.tgz tar zxf msb2_patches.tgz tar zxf zd1211-driver-r83.tgz
cd linux-2.6.14 echo "Applying SG2 Patches" patch -p1 < ../SG2Release-1_0/src/patch-2.6.14-sg2-10
echo "Applying MSB2 Patches and kernel config" patch -p1 < ../msp-linux-2.6.14-pxa-mmc.patch patch -p1 < ../msp-linux-2.6.14-uart.patch patch -p1 < ../msp-linux-2.6.14-sd-detect.patch cp ../msp-linux-2.6.14-config ./.config
echo "Applying Windows RNDIS Patches" patch -p1 < ../msp-linux-2.6.14-winXP-rndis.patch
echo "Building kernel" export ARCH=arm export CROSS_COMPILE=arm-linux- sed -e 's;export PATH;#export PATH;g' -e 's;export CROSS_COMPILE=;#export CROSS_COMPILE=;g' -e 's;test:;#test:;g' Makefile.platx -i sed -e 's;echo zImage is ${ZIMAGE};#echo zImage is ${ZIMAGE};g' -e 's;${IMAGE}:: force;#${IMAGE}:: force;g' Makefile.platx -i sed -e 's;@scripts/platx_config;#@scripts/platx_config;g' Makefile.platx -i make oldconfig make zImage make modules make modules_install
echo "Copying zImage" cd .. mkdir images cd images cp ../linux-2.6.14/arch/arm/boot/zImage ./
echo "Mounting Filesystem and installing kernel modules" cd images mkdir /mnt/jffs2Image losetup /dev/loop/0 ../fs.jffs2 mknod /dev/mtdblock0 b 31 0 modprobe blkmtd device=/dev/loop/0 mount -t jffs2 /dev/mtdblock0 /mnt/jffs2Image
echo "Removing all old modules from JFFS2 Image" rm -rf /mnt/jffs2Image/lib/modules/* echo "Copying new modules to JFFS2 Image" cp -a ../linux-2.6.14/modules/lib/modules/2.6.14_r1.0/ /mnt/jffs2Image/lib/modules/ echo "Unmounting image" sync umount /mnt/jffs2Image modprobe --remove blkmtd losetup -d /dev/loop/0
</bash>