Saturday, December 15 2007, 16:19
NSLU2: Compiling a recent kernel
By fake - Permalink
The latest kernel you seem to get with debian currently is 2.6.18, which is pretty outdated. So i went ahead and tried to assemble the stuff needed to build my own kernel, which was more work than i'd expected. The Linksys NSLU2 needs some proprietary firmware, but nevermind signing up at IBM, if you installed the image linked above, the firmware you need is in /lib/firmware/NPE-B. Just make sure the file stays there ;-)
The steps to build your own kernel are:
- get your hands on a cross-toolchain (i use and enjoy crosstool, for version 0.43 i edited demo-arm-xscale.sh to use gcc 4.0.2 (ICE in 4.1.0) and glibc 2.3.6-tls, you'll probably need to put another patch for glibc into patches/glibc-2.3.6/, get it here). Make sure the tools are in your $PATH!
- get the kernel sources (at the time of writing, 184.108.40.206 was the newest, which i used)
- making sure you have subversion installed, issue the command:
svn co svn://svn.debian.org/svn/kernel/dists/trunk/linux-2.6/debian/patches/features/arm debian-arm-patches
- extract the kernel sources, and apply the following patches
tar -xfj linux-220.127.116.11.tar.bz2 cd linux-18.104.22.168 patch -p1 < ../debian-arm-patches/ixp4xx-npe-driver-0.3.1.patch patch -p1 < ../debian-arm-patches/ixp4xx-net-driver-improve-mac-handling.patch patch -p1 < ../debian-arm-patches/nslu2-i2c-gpio-driver-support.patch patch -p1 < ../debian-arm-patches/nslu2-mac_plat_info.patch patch -p1 < ../debian-arm-patches/nslu2-setup-mac.patch
- now it's time to configure your kernel, the debian defconfig is a little dated, so i upped my config. put it into your linux source dir and run:
mv nslu2-22.214.171.124.config .config make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnu- oldconfig
- if you want to edit the config (it's fairly basic), run the last line above with "menuconfig" at the end (you guessed it ;) big fat note: don't compile in the ixp4xx npe network driver, leave it as a module! the firmware is not part of the initramfs, so the network interface would never come up!
- build your kernel:
make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnu- zImage modules mkdir ../modules-126.96.36.199 make ARCH=arm CROSS_COMPILE=arm-xscale-linux-gnu- INSTALL_MOD_PATH=../modules-188.8.131.52 modules_install
If you now run 'flash-kernel', it will flash the kernel and the initramfs into the nslu2's boot flash. don't worry - if anything goes wrong, just re-flash the image from the "manual install" link above.
reboot the slug and wait... good luck ;-) if it does not come up again, a good starting point is to simply unplug the external hard drive and check the logfiles.