Difference between revisions of "Compile a uBoot Kernel"
(→Get the sources) |
(→Debian and other) |
||
(24 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | This is a tutorial of how to compile a | + | This is a tutorial of how to compile a 2.6.21+ kernel from vanilla gentoo-sources or from kernel.org sources to suit [http://www.denx.de/wiki/U-Boot/WebHome UBoot] bootloader |
− | + | While this article was originally written for Gentoo users, it is basically the same for Debian or others distros. Note that this article is valid for the KuroBox, LS1, LS-HG, KuroHG and the LS-HS. | |
− | + | ===Prepare the build environment and tools=== | |
− | + | ====Gentoo==== | |
− | + | emerge -av dtc | |
+ | |||
+ | Note: you may already have a version at /boot/dtc. However emerging explicitly puts dtc in the path and gives you the latest version. | ||
+ | |||
+ | ====Debian==== | ||
+ | apt-get install build-essential uboot-mkimage module-init-tools device-tree-compiler | ||
+ | |||
+ | ===Get the sources=== | ||
+ | ====Gentoo==== | ||
− | + | Get the latest stable kernel sources | |
# emerge -ua gentoo-sources | # emerge -ua gentoo-sources | ||
make a link to the kernel sources | make a link to the kernel sources | ||
# cd /usr/src | # cd /usr/src | ||
− | # ln -sfn linux-2.6. | + | # ln -sfn linux-2.6.* linux |
+ | |||
+ | ====Debian and other==== | ||
+ | |||
+ | cd /usr/src | ||
+ | wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.*.tar.bz2 *(check for latest version) | ||
+ | tar xjvf linux-* | ||
+ | ln -sfn linux-* linux | ||
===Edit your kernel config=== | ===Edit your kernel config=== | ||
Line 24: | Line 39: | ||
Make sure the config is sane: | Make sure the config is sane: | ||
− | # make menuconfig | + | # make ARCH=powerpc 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. | + | 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. Also, with recent filesystem developments, you may wish to consider '''ext4''' or others. |
+ | For troubleshooting ease, it is a good idea to enable Netconsole kernel access. Enable '''Device drivers -> Networking device support -> Network console logging support (EXPERIMENTAL) | ||
+ | ''' | ||
===Compile your kernel=== | ===Compile your kernel=== | ||
Line 38: | Line 55: | ||
# cp /boot/kuroboxHG.dtb /boot/kuroboxHG.dtb.bak | # cp /boot/kuroboxHG.dtb /boot/kuroboxHG.dtb.bak | ||
− | + | If you have a LS1/HD, then change your .dtb filename as necessary. | |
+ | ===Compile the dtb file=== | ||
+ | # cp kuroboxHG.dtb /tmp/ | ||
# cd /usr/src/linux/arch/powerpc/boot/dts | # 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 | # cp /tmp/kuroboxHG.dtb /boot/kuroboxHG.dtb | ||
− | ===Install the kernel=== | + | ===Install the kernel & enable modules=== |
# cp /usr/src/linux/arch/powerpc/boot/uImage /boot/uImage | # cp /usr/src/linux/arch/powerpc/boot/uImage /boot/uImage | ||
+ | # cd /lib/modules/2.6.2x.x/ | ||
+ | # depmod | ||
+ | |||
+ | Note: If your using the Gentoo 2007 Image, check that your Kernel Image name matches. | ||
+ | Your kernel image may be called '''vmlinux.UBoot''' instead of '''uImage''' | ||
+ | |||
+ | Note: if your using Dave's lenny tarball you may need to check that the uImage symlink is pointing to your new kernel. | ||
===Reboot=== | ===Reboot=== | ||
Line 53: | Line 79: | ||
With any luck, you'll be booting your new kernel. | With any luck, you'll be booting your new kernel. | ||
+ | |||
+ | Watch your netconsole window for information that may prove helpful in case of a problem. | ||
===Troubleshooting=== | ===Troubleshooting=== | ||
+ | |||
+ | Give your box time to come up, it may take a while to boot after the upgrade. | ||
If something goes wrong, simply boot in EM mode and copy your old kernel back. | If something goes wrong, simply boot in EM mode and copy your old kernel back. | ||
Line 61: | Line 91: | ||
# cp /boot/kuroboxHG.dtb.bak /boot/kuroboxHG.dtb | # cp /boot/kuroboxHG.dtb.bak /boot/kuroboxHG.dtb | ||
# echo -n "OKOK" > /dev/fl3 | # echo -n "OKOK" > /dev/fl3 | ||
+ | |||
+ | |||
+ | |||
+ | {{Template:Articles|HG|LS1|HS|Howto|Kernel|UBoot}} | ||
+ | [[Category:Kurobox]] |
Latest revision as of 17:58, 10 July 2012
This is a tutorial of how to compile a 2.6.21+ kernel from vanilla gentoo-sources or from kernel.org sources to suit UBoot bootloader
While this article was originally written for Gentoo users, it is basically the same for Debian or others distros. Note that this article is valid for the KuroBox, LS1, LS-HG, KuroHG and the LS-HS.
Contents
Prepare the build environment and tools
Gentoo
emerge -av dtc
Note: you may already have a version at /boot/dtc. However emerging explicitly puts dtc in the path and gives you the latest version.
Debian
apt-get install build-essential uboot-mkimage module-init-tools device-tree-compiler
Get the sources
Gentoo
Get the latest stable kernel sources
# emerge -ua gentoo-sources
make a link to the kernel sources
# cd /usr/src # ln -sfn linux-2.6.* linux
Debian and other
cd /usr/src wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.*.tar.bz2 *(check for latest version) tar xjvf linux-* ln -sfn linux-* 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 ARCH=powerpc 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. Also, with recent filesystem developments, you may wish to consider ext4 or others.
For troubleshooting ease, it is a good idea to enable Netconsole kernel access. Enable Device drivers -> Networking device support -> Network console logging support (EXPERIMENTAL)
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
If you have a LS1/HD, then change your .dtb filename as necessary.
Compile the dtb file
# cp kuroboxHG.dtb /tmp/ # 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 & enable modules
# cp /usr/src/linux/arch/powerpc/boot/uImage /boot/uImage # cd /lib/modules/2.6.2x.x/ # depmod
Note: If your using the Gentoo 2007 Image, check that your Kernel Image name matches. Your kernel image may be called vmlinux.UBoot instead of uImage
Note: if your using Dave's lenny tarball you may need to check that the uImage symlink is pointing to your new kernel.
Reboot
# reboot
With any luck, you'll be booting your new kernel.
Watch your netconsole window for information that may prove helpful in case of a problem.
Troubleshooting
Give your box time to come up, it may take a while to boot after the upgrade.
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