HOWTO U-Boot

Introduction
The U-Boot project for the Kurobox is something for which the community has been waiting a long time! Nijino was the first person to provide a patch to adapt U-Boot to the Kurobox architecture and specifications! U-Boot will allow you to boot any kernel directly from the hard drive without first booting the 2.4.17 kernel stored in the Kurobox's flash memory.

Known functions and limitations
Functions :
 * Boot a kernel image from the hard drive in uImage format
 * Force Emergency Mode (EM) by pressing the the red button at the rear of the Kurobox right after the POWER LED stops blinking. (Note: EM can take around 2 minutes to start, so don't worry if you can't ping your Kurobox immediately)

Limitations :
 * This version of U-Boot comes with no support for ethernet, so for now booting from or connecting to U-Boot over LAN is impossible. (This means you cannot boot your Kurobox into "EM mode" to telnet in and install Linux onto a blank hard drive.) For U-Boot with network support install the Linkstation port of U-Boot It works with both the Kuro and Kuro HG and has some nice upgrades including network support and a minimal console that can be controlled using the power and red buttons.

Building a Linux kernel in U-Boot format
To be able to build a kernel in uImage format, you will need the mkimage tool that is built when compiling U-Boot. Alternatively, you can download a precompiled version of this tool: Now compile the kernel as normal: next do either or Create a U-Boot compatible uImage: This will create a uImage file in arch/ppc/boot/images/uImage. Move the image into the /boot/ directory (this is the default location that U-Boot searches for a kernel image) and then compile the modules and install them.
 * 1) wget http://www.kurobox.com/sylver/u-boot/mkimage
 * 2) chmod 0755 mkimage
 * 3) mv mkimage /usr/bin/
 * 1) export ARCH=ppc
 * 1) make menuconfig
 * 1) make oldconfig
 * 1) make uImage
 * 1) cp arch/ppc/boot/images/uImage /boot/
 * 2) make modules
 * 3) sudo make modules_install

To assist with this section, Sylver has prebuilt some uImage format kernels and modules: Make sure you download the appropriate kernel and modules for the Kurobox you have, and then tar zxvf it in the root directory /.
 * Kernel 2.6.17.1 for standard Kurobox
 * Kernel 2.6.17.1 for Kurobox HG

Flash U-Boot on your Kurobox
Sylver has built both the Standard and HG version of the patched U-Boot (1.1.4) using gcc version 4.1.2 20060613 (prerelease) (Debian 4.1.1-5). These flash images are configured to load the kernel image from /boot/uImage on hda1.

Kernel 2.4.x for standard Kurobox only
Boot your 2.4.x kernel as usual and download, untar, and check the checksum of the U-Boot image for standard Kurobox: 1870540566 164676 u-boot.bin If all is ok, flash the boot ! Make sure the boot is ok in flash : cmp: EOF on u-boot.bin Make sure you have a valid /boot/uImage in hda1 and reboot ;) If it doesn't work :
 * 1) wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kurobox.tar.gz
 * 2) tar zxvf u-boot-1.1.4-kurobox.tar.gz
 * 3) cksum u-boot.bin
 * 1) dd if=u-boot.bin of=/dev/fl2 bs=1k
 * 1) cmp u-boot.bin /dev/fl2
 * 1) reboot
 * Your Kurobox is now a brick, only JTAG will allow to restore it
 * The kernel in /boot/uImage is incorrect, try forcing Emergency Mode (EM) by using the red button on the back of your Kurobox.

Kernel 2.6.x for standard Kurobox only
Boot your 2.6.x kernel as usual and download, untar, and check the checksum the U-Boot image for standard Kurobox: 1870540566 164676 u-boot.bin If all is ok, check your flash mapping : it should be 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" or dev:   size   erasesize  name mtd0: 00400000 00010000 "mtd_allflash" mtd1: 00300000 00010000 "mtd_firmimg" mtd2: 00070000 00010000 "mtd_bootcode" mtd3: 00010000 00010000 "mtd_status" mtd4: 00080000 00010000 "mtd_conf"
 * 1) wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kurobox.tar.gz
 * 2) tar zxvf u-boot-1.1.4-kurobox.tar.gz
 * 3) cksum u-boot.bin
 * 1) cat /proc/mtd
 * 1) cat /proc/mtd

The right place to flash is mtd_bootcode, so you'll have to flash the u-boot.bin to /dev/mtdblock1 or to /dev/mtdblock2! So depending of the result of the previous command, do a or a Make sure the boot is ok in flash : cmp: EOF on u-boot.bin or cmp: EOF on u-boot.bin Make sure you have a valid /boot/uImage in hda1 and reboot ;) If it doesn't work :
 * 1) dd if=u-boot.bin of=/dev/mtdblock1 bs=1k
 * 1) dd if=u-boot.bin of=/dev/mtdblock2 bs=1k
 * 1) cmp u-boot.bin /dev/mtd1
 * 1) cmp u-boot.bin /dev/mtd2
 * 1) reboot
 * Your Kurobox is now a brick, only JTAG will allow to restore it
 * The kernel in /boot/uImage is incorrect, try forcing Emergency Mode (EM) by using the red button on the back of your Kurobox.

Kernel 2.4.x for Kurobox HG only
Boot your 2.4.x kernel as usual and download, untar, and check the checksum of the U-Boot image for Kurobox HG : 2604640296 164676 u-boot.bin If all is ok, flash the boot ! Make sure the boot is ok in flash : cmp: EOF on u-boot.bin Make sure you have a valid /boot/uImage in hda1 and reboot ;) If it doesn't work :
 * 1) wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kuroboxhg.tar.gz
 * 2) tar zxvf u-boot-1.1.4-kuroboxhg.tar.gz
 * 3) cksum u-boot.bin
 * 1) dd if=u-boot.bin of=/dev/fl2 bs=1k
 * 1) cmp u-boot.bin /dev/fl2
 * 1) reboot
 * Your Kurobox is now a brick, only JTAG will allow to restore it
 * The kernel in /boot/uImage is incorrect, try forcing Emergency Mode (EM) by using the red button on the back of your Kurobox.

Kernel 2.6.x for Kurobox HG only
Boot your 2.6.x kernel as usual and download, untar, and check the checksum the U-Boot image for Kurobox HG : 2604640296 164676 u-boot.bin If all is ok, check your flash mapping : it should be 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" or dev:   size   erasesize  name mtd0: 00400000 00010000 "mtd_allflash" mtd1: 00300000 00010000 "mtd_firmimg" mtd2: 00070000 00010000 "mtd_bootcode" mtd3: 00010000 00010000 "mtd_status" mtd4: 00080000 00010000 "mtd_conf"
 * 1) wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kuroboxhg.tar.gz
 * 2) tar zxvf u-boot-1.1.4-kuroboxhg.tar.gz
 * 3) cksum u-boot.bin
 * 1) cat /proc/mtd
 * 1) cat /proc/mtd

The right place to flash is mtd_bootcode, so you'll have to flash the u-boot.bin to /dev/mtdblock1 or to /dev/mtdblock2! So depending of the result of the previous command, do a or a Make sure the boot is ok in flash : cmp: EOF on u-boot.bin or cmp: EOF on u-boot.bin Make sure you have a valid /boot/uImage in hda1 and reboot ;) If it doesn't work :
 * 1) dd if=u-boot.bin of=/dev/mtdblock1 bs=1k
 * 1) dd if=u-boot.bin of=/dev/mtdblock2 bs=1k
 * 1) cmp u-boot.bin /dev/mtd1
 * 1) cmp u-boot.bin /dev/mtd2
 * 1) reboot
 * Your Kurobox is now a brick, only JTAG will allow to restore it
 * The kernel in /boot/uImage is incorrect, try forcing Emergency Mode (EM) by using the red button on the back of your Kurobox.

Building your own U-Boot binary
There are some problems while trying to compile U-Boot 1.1.4 with make v3.81. Please install make v3.80 before trying to compile U-Boot.

Get nijino's patch: Get U-Boot 1.1.4 source code from a mirror and apply the patch Configure U-Boot for your target : Build U-Boot Copy mkimage to /usr/bin (needed to build kernel images for U-Boot You now have your own u-boot.bin file. Just follow this article to write this into your Kurobox's flash memory.
 * 1) wget http://homepage2.nifty.com/nijino/library/u-boot-1.1.4_kurobox-20060715.patch.bz2
 * 1) wget http://surfnet.dl.sourceforge.net/sourceforge/u-boot/u-boot-1.1.4.tar.bz2
 * 2) tar jxvf u-boot-1.1.4.tar.bz2 && cd u-boot-1.1.4
 * 3) bzip2 -dc ../u-boot-1.1.4_kurobox-20060715.patch.bz2 | patch -Np1
 * Kurobox
 * 1) make KUROBOX_config
 * Kurobox HG
 * 1) make KUROBOX_HG_config
 * 1) make
 * 1) cp tools/mkimage /usr/bin/mkimage
 * 2) chmod 0755 /usr/bin/mkimage

nijino has also written a tool to check if a built u-boot.bin is built for the correct Kurobox version. The output will tell you if your u-boot.bin matches your Kurobox version.
 * 1) wget http://homepage2.nifty.com/nijino/kurobox/uboot_check.c
 * 2) gcc -o uboot_check uboot_check.c
 * 3) ./uboot_check