Compile a uBoot Kernel

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 03:36, 9 April 2009 by Davygravy (Talk | contribs)

Jump to: navigation, search

This is a tutorial of how to compile a uBoot kernel from vanilla gentoo-sources.

Contents

Get the sources

Right now (24 Nov 2008) the latest stable version is gentoo-sources-2.6.26-r2.

If you want a newer kernel, add this line to /etc/portage/package.keywords:

sys-kernel/gentoo-sources ~ppc

then download the kernel sources

# emerge -ua gentoo-sources

make a link to the kernel sources

# cd /usr/src
# ln -sfn linux-2.6.26-gentoo-r2 linux

Edit your kernel config

Clean up before you begin:

# cd /usr/src/linux
# make mrproper

Use the default KuroBox config:

# cp arch/powerpc/configs/linkstation_defconfig .config

Make sure the config is sane:

# make menuconfig

The default config is minimal. You'll have to enable support for any non-standard things you may be using. I use reiserfs and netatalk, so I enabled support for that filesystem and also for appletalk.

Compile your kernel

# make uImage && make modules && make modules_install

Sit back and listen to music. Go to the store. Wash the dog.

Backup your old kernel and dtb file

# cp /boot/uImage /boot/uImage.bak
# cp /boot/kuroboxHG.dtb /boot/kuroboxHG.dtb.bak

Compile the dtb file

# cd /usr/src/linux/arch/powerpc/boot/dts
# ../dtc -I dts -O dtb -V 16 -o /tmp/kuroboxHG.dtb kuroboxHG.dts
# cp /tmp/kuroboxHG.dtb /boot/kuroboxHG.dtb

Install the kernel

# cp /usr/src/linux/arch/powerpc/boot/uImage /boot/uImage

Reboot

# reboot

With any luck, you'll be booting your new kernel.

Troubleshooting

If something goes wrong, simply boot in EM mode and copy your old kernel back.

# cp /boot/uImage.bak /boot/uImage
# cp /boot/kuroboxHG.dtb.bak /boot/kuroboxHG.dtb
# echo -n "OKOK" > /dev/fl3