HOWTO U-Boot

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 10:24, 29 June 2006 by Sylver (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

WORK in progress, not yet finished ! Use it at your own risks !


Contents

Introduction

The U-boot project for the Kuro-box is something that the community was waiting for since a long time ! Nijino was the first one to provide It'll allow you to boot from a kernel on the hard drive, thing that was not possible since the buffalo's boot was only booting from the kernel in flash (that is a 2.4.17 kernel version).

Known functions and limitations

Functions :

  • Will boot a kernel image in uImage format stored on a HDD
  • Will boot kernel in flash if pressing red button (you need to press it at the right moment, if you don't know, just keep pressing and releasing the button durint boot up)

Limitations :

  • This version of U-boot comes with no support for ethernet, so for now booting or connecting to u-boot from network is impossible.

Building the Linux kernel in U-boot format

To be able to build a kernel in uImage format, you'll need mkimage tool that is built when compiling U-boot. You can download a compiled version of this tool here. Just download it, chmod +x it and move the file to /usr/bin. Now to compile the kernel, follow the usual way :

export ARCH=ppc
make menuconfig
make oldconfig

and then instead of the make vmlinux, do a

make uImage

it'll create a uImage file there : arch/ppc/boot/images/uImage, so after kernel compilation, do a

cp arch/ppc/boot/images/uImage /boot/

then follow with module compilation and installation as usual

make modules
sudo make modules_install

To help people, i built some kernels in uImage format :

just get the file according to the Kurobox you have and "tar xzf" it from root (/)

Flash U-boot in your Kuro-box

!!!! Warning : this could brick your Kuro-box in case of misused/power failure/application crash !!!!
!!!! Warning : this could brick your Kuro-box in case of misused/power failure/application crash !!!!
!!!! Warning : this could brick your Kuro-box in case of misused/power failure/application crash !!!!
!!!! Warning : this could brick your Kuro-box in case of misused/power failure/application crash !!!!

I have built (using gcc version 4.1.2 20060613 (prerelease) (Debian 4.1.1-5)) both versions of patched U-boot (1.1.4), both will try to boot the /boot/uImage on hda1.

Kuro-box

Kernel 2.4.x

Boot your kernel as usual and download the U-boot version for standard Kuro-box :

http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kurobox.tar.gz

untar it and check the checksum :

> tar xzf u-boot-1.1.4-kurobox.tar.gz
> cksum u-boot.bin
1870540566 164676 u-boot.bin

If all is ok, flash the boot !

dd if=u-boot.bin of=/dev/fl2 bs=1k

Make sure the boot is ok in flash :

> cmp u-boot.bin /dev/fl2
cmp: EOF on u-boot.bin

Make sure you have a valid /boot/uImage in hda1 and reboot ;)

reboot

If it doesn't work :

  • You bricked your Kuro-box, only JTAG will allow to restore it
  • The kernel in /boot/uImage is incorrect, try forcing booting kernel in flash using the red button

Kernel 2.6.x

Boot your kernel as usual and download the U-boot version for standard Kuro-box :

http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kurobox.tar.gz

untar it and check the checksum :

> tar xzf u-boot-1.1.4-kurobox.tar.gz
> cksum u-boot.bin
1870540566 164676 u-boot.bin

If all is ok, check your flash mapping :

> cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00300000 00010000 "mtd_firmimg"
mtd1: 00070000 00010000 "mtd_bootcode"
mtd2: 00010000 00010000 "mtd_status"
mtd3: 00080000 00010000 "mtd_conf"
mtd4: 00400000 00010000 "mtd_allflash"
mtd5: 000f0000 00010000 "mtd_data"

The right place to flash is mtd_bootcode, so in this case flash to /dev/mtdblock1 flash the boot !

dd if=u-boot.bin of=/dev/mtdblock1 bs=1k

Make sure the boot is ok in flash :

> cmp u-boot.bin /dev/mtd1
cmp: EOF on u-boot.bin

Make sure you have a valid /boot/uImage in hda1 and reboot ;)

reboot

If it doesn't work :

  • You bricked your Kuro-box, only JTAG will allow to restore it
  • The kernel in /boot/uImage is incorrect, try forcing booting kernel in flash using the red button

Kuro-box HG

Kernel 2.4.x

Boot your kernel as usual and download the U-boot version for standard Kuro-box :

http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kuroboxhg.tar.gz

untar it and check the checksum :

> tar xzf u-boot-1.1.4-kurobox.tar.gz
> cksum u-boot.bin
?????????? ?????? u-boot.bin

If all is ok, flash the boot !

dd if=u-boot.bin of=/dev/fl2 bs=1k

Make sure the boot is ok in flash :

> cmp u-boot.bin /dev/fl2
cmp: EOF on u-boot.bin

Make sure you have a valid /boot/uImage in hda1 and reboot ;)

reboot

If it doesn't work :

  • You bricked your Kuro-box, only JTAG will allow to restore it
  • The kernel in /boot/uImage is incorrect, try forcing booting kernel in flash using the red button

Kernel 2.6.x

Boot your kernel as usual and download the U-boot version for standard Kuro-box :

http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kuroboxhg.tar.gz

untar it and check the checksum :

> tar xzf u-boot-1.1.4-kurobox.tar.gz
> cksum u-boot.bin
?????????? ?????? u-boot.bin

If all is ok, check your flash mapping :

> cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00300000 00010000 "mtd_firmimg"
mtd1: 00070000 00010000 "mtd_bootcode"
mtd2: 00010000 00010000 "mtd_status"
mtd3: 00080000 00010000 "mtd_conf"
mtd4: 00400000 00010000 "mtd_allflash"
mtd5: 000f0000 00010000 "mtd_data"

The right place to flash is mtd_bootcode, so in this case flash to /dev/mtdblock1 flash the boot !

dd if=u-boot.bin of=/dev/mtdblock1 bs=1k

Make sure the boot is ok in flash :

> cmp u-boot.bin /dev/mtd1
cmp: EOF on u-boot.bin

Make sure you have a valid /boot/uImage in hda1 and reboot ;)

reboot

If it doesn't work :

  • You bricked your Kuro-box, only JTAG will allow to restore it
  • The kernel in /boot/uImage is incorrect, try forcing booting kernel in flash using the red button

Building you own u-boot binary

  • Get U-boot source code
  • Get nijino patch
  • configure U-boot for your target :

Kuro-box

make KUROBOX_config

Kuro-box HG

make KUROBOX_HG_config