nomis52.net
View Simon Newton's profile on LinkedIn

Building a 2.6 Kernel

This describes how to build a 2.6 kernel to run on the WGT634U. It assumes you have a working mipsel-linux- toolchain.

Jolt has modfied a kernel from linux-mips to work on the router. Check out the latest kernel from cvs:

$ cd $PROJ_ROOT $ cvs -d:pserver:anonymous@cvs.tuxap.berlios.de:/cvsroot/tuxap login Logging in to :pserver:anonymous@cvs.tuxap.berlios.de:2401/cvsroot/tuxap CVS password: $ cvs -z3 -d:pserver:anonymous@cvs.tuxap.berlios.de:/cvsroot/tuxap co kernel

Depending on the speed of your internet connection, you might like to go for a drinks break. When I did this, the size was around 250MB.

Ok you need to check now if there is an include directory in arch/mips/bcm47xx/broadcom. Jolt mentioned he was going to check it in but currently (10/3/2005) it's not there.

$ ls kernel/arch/mips/bcm47xx/broadcom/ | grep include

If it's not there, we need to grab the netgear sources from here:

$ cd $PROJ_ROOT/src $ wget ftp://downloads.netgear.com/files/GPL/wgt634u-1.4.1.8-gpl-src.tar.bz2 $ tar -jxf wgt634u-1.4.1.8-gpl-src.tar.bz2 $ mv wgt634u-1.4.1.8-gpl-src.tar.bz2 ../archives

Copy the include directory, and change back into the kernel directory

$ cp -R wgt634u-1.4.1.8-gpl-src/broadcom-src/include/ ../kernel/arch/mips/bcm47xx/broadcom/ $ cd ../kernel

Look at the file arch/mips/bcm47xx/setup.c . There may be a line that looks like so :

#include <ssbcore.h>

If so comment it out (add a // at the front).

You can download my .config file to use as a base. Make sure you put it in the root of the kernel source directory.

$ wget http://www.nomis52.net/data/netgear/.config

Ok now run make menuconfig to configure the kernel.

$ make menuconfig

At the very least you will need to edit the kernel command line. This can be found in Kernel Hacking. You will need to adjust this for the IP addresses / paths on your system. Mine looks like this:

"ip=192.168.1.1 root=/dev/nfs rw nfsroot=192.168.1.10:/home/simon/lighting/netgear/proj_root/rootfs console=ttyS1,115200"

Ok we're almost there. Time to build the kernel:

$ make CROSS_COMPILE=mipsel-linux- $ make CROSS_COMPILE=mipsel-linux- modules

If all goes well, at this point you'll have a vmlinux in the kernel directory. Copy it to the boot directory and gzip it.

$ cp vmlinux $PROJ_ROOT/boot $ gzip $PROJ_ROOT/boot/vmlinux

At this point you might like to check that the kernel can be retrived via TFTP. See the instructions back in Host Setup for details.

Now install the modules - you need to have set up sudo for this to work.

$ sudo make INSTALL_MOD_PATH=../rootfs modules_install

Check the modules are in $PROJ_ROOT/rootfs/lib/modules/2.6.11-rc4

$ ls $PROJ_ROOT/rootfs/lib/modules/2.6.11-rc4 build modules.ccwmap modules.inputmap modules.symbols source kernel modules.dep modules.isapnpmap modules.usbmap modules.alias modules.ieee1394map modules.pcimap net

At this point congratulations, you've almost made it. Turn on the router and see if it boots :)

Next: Cross Compiling With Autoconf