Re-building the kernel and U-Boot

HowTos > Re-building the kernel and U-Boot

Pre-requisite

Please note that on guruplugs, there is a problem with the factory uboot, wich does not have the right arch number for the guruplug.
Please read there : Compiling_Linux_Kernel_for_the_Plug_Computer

Or on the forum, these threads :

Using mainline kernels require using another uboot.

U-Boot

U-Boot Sources

The GuruPlug comes pre-packaged with Open U-Boot. The U-Boot support is currently available in the Marvell ARM architecture U-Boot Custodian Tree.

Building U-Boot

Follow these steps for building the U-Boot

  • Clone the git repository and checkout the testing branch
# git clone git://git.denx.de/u-boot-marvell.git u-boot-marvell.git
# cd u-boot-marvell.git
# git checkout -b testing origin/testing
  • Build the uboot with a cross compiler
# make mrproper
# make guruplug_config
# make u-boot.kwb CROSS_COMPILE=<cross_compiler_prefix>
# cp tools/mkimage /usr/bin

The u-boot.kwb is the U-Boot image you are looking for.

  • To test the new uboot, in uboot itself using tftp:
setenv serverip 192.168.***.***
setenv ipaddr 192.168.***.***
tftp 0x6400000 u-boot.kwb
go 0x0c100000

Then issue some uboot commands: echo, setenv, etc.

  • When confident with your new uboot, reset the plug and write it to nand with
setenv serverip 192.168.***.***
setenv ipaddr 192.168.***.***
tftp 0x6400000 u-boot.kwb
nand erase 0x00000000 0x0100000
nand write 0x6400000 0x0000000 0x80000
reset

Kernel

Kernel Sources

Note : read Pre-requisite section above !

The GuruPlug kernel is based off of Vanilla Linux kernel 2.6.33.2.

A few additional patches are included on top of this kernel. The patches can be found here.

To build the wireless driver without the need to patch the kernel, you need this.

Building the kernel

Follow these steps for building the kernel

  • Clone the kernel git repository
# wget http://www.openplug.org/plugwiki/images/c/c6/Guruplug-patchset-2.6.33.2.tar.bz2
# tar xfj Guruplug-patchset-2.6.33.2.tar.bz2
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.33.y.git
# (cd linux-2.6.33.y.git; git reset --hard v2.6.33.2)
# patch -p1 -E -d linux-2.6.33.y.git < guruplug-patchset/0001-Kirkwood-Marvell-GuruPlug-support.patch
# patch -p1 -E -d linux-2.6.33.y.git < guruplug-patchset/0002-Driver-for-Marvell-Libertas-8688-SDIO-micro-AP-suppo.patch
# patch -p1 -E -d linux-2.6.33.y.git < guruplug-patchset/0003-Initial-defconfig.patch
# cd linux-2.6.33.y.git
  • Build the kernel image
# make CROSS_COMPILE=<cross_compiler_prefix> ARCH=arm clean
# make CROSS_COMPILE=<cross_compiler_prefix> ARCH=arm guruplug_defconfig
# make CROSS_COMPILE=<cross_compiler_prefix> ARCH=arm uImage

The arch/arm/boot/uImage is the kernel image you are looking for.

If you wish to rebuild the kernel modules and install them in the RFS, you can do so as follows

# make CROSS_COMPILE=<cross_compiler_prefix> ARCH=arm modules
# make CROSS_COMPILE=<cross_compiler_prefix> ARCH=arm modules_install INSTALL_MOD_PATH=/path/to/rfs

This will install the modules within /path/to/rfs/lib/modules/

Booting the new kernel

Connect to your guruplug under uboot, get your uImage,

setenv serverip 192.168.***.***
setenv ipaddr 192.168.***.***
tftpboot 0x6400000 guru/uImage

Set the bootargs to your needs

setenv bootargs console=ttyS0,115200n8 root=/dev/sdb1 rootdelay=5 ro

and go

bootm 0x6400000

If everything is OK, you may consider flashing your kernel to NAND (actual uboot does not support boot from ext2 on µSD)

If you get an "instant" decompression of the kernel, and no more messages .....

Uncompressing Linux... done, booting the kernel.
[Nothing ... Nothing ... Nothing ...]

Then read the pre-requisite section above !