Difference between revisions of "HOWTO U-Boot"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m (Added links to Brick)
 
(27 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Warning|THE NIJINO U-BOOT BOOTLOADER IS NOT FULLY TESTED. ALTHOUGH IT HAS BEEN INSTALLED SUCCESSFULLY ON BOTH STANDARD AND HG KUROBOXES, '''THERE HAS BEEN AT LEAST ONE KUROBOX [[Brick|BRICKED]].''' THINK LONG AND HARD BEFORE PERFORMING THIS MODIFICATION. A BRICKED KUROBOX REQUIRES JTAG ACCESS TO REPAIR AND IS NOT COVERED UNDER THE KUROBOX WARRANTY}}
+
{{Warning|'''These instructions are for the Kurobox only.'''
 +
[[U-boot_bootloader|The LinkStation port of U-Boot]]
 +
(http://www.linuxnotincluded.org.uk/linkstation/u-boot.html) supports the following PowerPC models:<br>
 +
'''LinkStation version 1 (model HD-HLAN-1)''', '''KuroBox standard''', '''LinkStation HG (model HD-HGLAN)''', '''KuroBox HG'''
 +
}}
 +
 
 +
 
 +
 
 +
{{Warning|'''THE NIJINO U-BOOT BOOTLOADER IS NOT FULLY TESTED, ALTHOUGH IT HAS BEEN INSTALLED SUCCESSFULLY ON BOTH STANDARD AND HG KUROBOXES, [[Brick|THERE HAS BEEN AT LEAST ONE KUROBOX BRICKED]]. THINK LONG AND HARD BEFORE PERFORMING THIS MODIFICATION. A BRICKED KUROBOX REQUIRES JTAG ACCESS TO REPAIR AND IS NOT COVERED UNDER THE KUROBOX WARRANTY'''}}
 +
 
 +
 
 +
{{Warning|'''FAILURE TO FOLLOW THE INSTRUCTIONS FOR YOUR TYPE OF KUROBOX (STANDARD OR HG) AND KERNEL VERSION (2.4 OR 2.6) WILL RESULT IN A [[Brick|BRICKED KUROBOX]] A BRICKED KUROBOX REQUIRES JTAG ACCESS TO REPAIR AND IS NOT COVERED UNDER THE KUROBOX WARRANTY'''}}
 +
 
  
  
 
== Introduction ==
 
== Introduction ==
The U-Boot project for the Kurobox is something that the community was waiting for since a long time ! [http://homepage2.nifty.com/nijino/kurobox/uboot.html Nijino] was the first one to provide a patch to adapt U-Boot to the Kurobox architecture and specifications !
+
The U-Boot project for the Kurobox is something for which the community has been waiting a long time! [http://homepage2.nifty.com/nijino/kurobox/uboot.html 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.
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 ==
 
== Known functions and limitations ==
 
Functions :
 
Functions :
* Will boot a kernel image in uImage format stored on a HDD
+
* Boot a kernel image from the hard drive in uImage format
* Will boot in EM (Emergency Mode) if pressing red button at bootup just after the HDD light stop blinking (The EM mode take around 2 minutes to start for me, so don't worry if after few seconds you still can't ping your Kurobox)
+
* 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 :
 
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. According to the Nijino, the author of the patch, Ethernet driver implementation will not be easy, so we may never see this function in our Kuroboxes !
+
* '''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 [http://www.linuxnotincluded.org.uk/linkstation/u-boot.html 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 the Linux kernel in U-Boot format ==
+
== Building a 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 (check [[#Building_your_own_U-Boot_binary]] if you want to build it).
+
To be able to build a kernel in uImage format, you will need the '''mkimage''' tool that is built when [[#Building your own U-Boot binary|compiling U-Boot]]. Alternatively, you can download a precompiled version of this tool:
You can download a compiled version of this tool [http://www.kurobox.com/sylver/u-boot/mkimage here]. Just download it, chmod 0755 it and move the file to /usr/bin.
+
# wget http://www.kurobox.com/sylver/u-boot/mkimage
Now to compile the kernel, follow the usual way :
+
# chmod 0755 mkimage
  export ARCH=ppc
+
# mv mkimage /usr/bin/
  make menuconfig
+
Now compile the kernel as normal:
  make oldconfig
+
  # export ARCH=ppc
and then instead of the make vmlinux, do a
+
next do either
  make uImage
+
  # make menuconfig
it'll create a uImage file there : arch/ppc/boot/images/uImage, so after kernel compilation, do a
+
or
  cp arch/ppc/boot/images/uImage /boot/
+
  # make oldconfig
then follow with module compilation and installation as usual
+
Create a U-Boot compatible uImage:
  make modules
+
  # make uImage
  sudo make modules_install
+
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.
 +
  # cp arch/ppc/boot/images/uImage /boot/
 +
  # make modules
 +
  # sudo make modules_install
  
To help people, i built some kernels in uImage format :
+
To assist with this section, Sylver has prebuilt some uImage format kernels and modules:
 
* [http://www.kurobox.com/sylver/u-boot/linux-2.6.17.1-stdkuro-uboot.tar.gz Kernel 2.6.17.1 for standard Kurobox]
 
* [http://www.kurobox.com/sylver/u-boot/linux-2.6.17.1-stdkuro-uboot.tar.gz Kernel 2.6.17.1 for standard Kurobox]
 
* [http://www.kurobox.com/sylver/u-boot/linux-2.6.17.1-uboot.tar.gz Kernel 2.6.17.1 for Kurobox HG]
 
* [http://www.kurobox.com/sylver/u-boot/linux-2.6.17.1-uboot.tar.gz Kernel 2.6.17.1 for Kurobox HG]
just get the file according to the Kurobox you have and "tar xzf" it from root (/)
+
Make sure you download the appropriate kernel and modules for the Kurobox you have, and then '''tar zxvf''' it in the root directory ''/''.
  
 
== Flash U-Boot on your Kurobox ==
 
== Flash U-Boot on your Kurobox ==
{{Brickable|The Kurobox and Kurobox HG use a different U-Boot flash image.}}
+
{{Brickable|The Kurobox and Kurobox HG use a different U-Boot flash image. If the wrong image is written to the flash memory, your Kurobox will be bricked and will require a [[Building_a_JTAG_Interface|JTAG cable]] and software to repair.}}
 +
 
 +
[[User:Sylver|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'''.
 +
 
 +
 
  
I have 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'''.
 
 
=== Standard Kurobox ===
 
=== Standard Kurobox ===
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">This is for the standard Kurobox only !!!! For Kurobox HG, check [[#Kurobox_HG]] !!! </p>
+
 
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">This is for the standard Kurobox only !!!! For Kurobox HG, check [[#Kurobox_HG]] !!! </p>
+
 
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">This is for the standard Kurobox only !!!! For Kurobox HG, check [[#Kurobox_HG]] !!! </p>
+
 
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">This is for the standard Kurobox only !!!! For Kurobox HG, check [[#Kurobox_HG]] !!! </p>
+
{{warning|'''This section is for the Standard Kurobox. For Kurobox HG, goto [[#Kurobox HG|the Kurobox HG Instructions]]'''}}
 +
 
 +
 
 +
 
 +
 
 
==== Kernel 2.4.x for standard Kurobox only ====
 
==== Kernel 2.4.x for standard Kurobox only ====
Boot your kernel as usual and download the U-Boot version for '''standard''' Kurobox :
+
 
  http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kurobox.tar.gz
+
Boot your 2.4.x kernel as usual and download, untar, and check the checksum of the U-Boot image for '''standard''' Kurobox:
untar it and check the checksum :
+
  # wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kurobox.tar.gz
  > tar xzf u-boot-1.1.4-kurobox.tar.gz
+
  # tar zxvf u-boot-1.1.4-kurobox.tar.gz
  > cksum u-boot.bin
+
  # cksum u-boot.bin
 
  1870540566 164676 u-boot.bin
 
  1870540566 164676 u-boot.bin
 
If all is ok, flash the boot !
 
If all is ok, flash the boot !
  dd if=u-boot.bin of=/dev/fl2 bs=1k
+
  # dd if=u-boot.bin of=/dev/fl2 bs=1k
 
Make sure the boot is ok in flash :
 
Make sure the boot is ok in flash :
  > cmp u-boot.bin /dev/fl2
+
  # cmp u-boot.bin /dev/fl2
 
  cmp: EOF on u-boot.bin
 
  cmp: EOF on u-boot.bin
 
Make sure you have a valid /boot/uImage in hda1 and reboot ;)
 
Make sure you have a valid /boot/uImage in hda1 and reboot ;)
  reboot
+
  # reboot
 
If it doesn't work :
 
If it doesn't work :
 
* Your Kurobox is now a [[brick]], only JTAG will allow to restore it
 
* Your Kurobox is now a [[brick]], only JTAG will allow to restore it
* The kernel in /boot/uImage is incorrect, try forcing booting kernel in flash using the red button
+
* 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 ====
 
==== Kernel 2.6.x for standard Kurobox only ====
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">WARNING : Process is harder when using a 2.6.x kernel ! If you're not sure, just get back to 2.4.x kernel !</p>
+
 
Boot your kernel as usual and download the U-Boot version for '''standard''' Kurobox :
+
 
  wget 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
+
{{warning|'''Process is harder when using a 2.6.x kernel ! If you're not sure, boot to a 2.4.x kernel and follow the 2.4 kernel instructions''' !}}
  > cksum u-boot.bin
+
 
 +
 
 +
 
 +
 
 +
 
 +
Boot your 2.6.x kernel as usual and download, untar, and check the checksum the U-Boot image for '''standard''' Kurobox:
 +
  # wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kurobox.tar.gz
 +
  # tar zxvf u-boot-1.1.4-kurobox.tar.gz
 +
  # cksum u-boot.bin
 
  1870540566 164676 u-boot.bin
 
  1870540566 164676 u-boot.bin
 
If all is ok, check your flash mapping :
 
If all is ok, check your flash mapping :
 
it should be
 
it should be
  > cat /proc/mtd
+
  # cat /proc/mtd
 
  dev:    size  erasesize  name
 
  dev:    size  erasesize  name
 
  mtd0: 00300000 00010000 "mtd_firmimg"
 
  mtd0: 00300000 00010000 "mtd_firmimg"
  mtd1: 00070000 00010000 "mtd_bootcode"
+
  '''mtd1: 00070000 00010000 "mtd_bootcode"'''
 
  mtd2: 00010000 00010000 "mtd_status"
 
  mtd2: 00010000 00010000 "mtd_status"
 
  mtd3: 00080000 00010000 "mtd_conf"
 
  mtd3: 00080000 00010000 "mtd_conf"
Line 80: Line 111:
 
  mtd5: 000f0000 00010000 "mtd_data"
 
  mtd5: 000f0000 00010000 "mtd_data"
 
or
 
or
  > cat /proc/mtd
+
  # cat /proc/mtd
 
  dev:    size  erasesize  name
 
  dev:    size  erasesize  name
 
  mtd0: 00400000 00010000 "mtd_allflash"
 
  mtd0: 00400000 00010000 "mtd_allflash"
 
  mtd1: 00300000 00010000 "mtd_firmimg"
 
  mtd1: 00300000 00010000 "mtd_firmimg"
  mtd2: 00070000 00010000 "mtd_bootcode"
+
  '''mtd2: 00070000 00010000 "mtd_bootcode"'''
 
  mtd3: 00010000 00010000 "mtd_status"
 
  mtd3: 00010000 00010000 "mtd_status"
 
  mtd4: 00080000 00010000 "mtd_conf"
 
  mtd4: 00080000 00010000 "mtd_conf"
  
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 !
+
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
 
So depending of the result of the previous command, do a
  dd if=u-boot.bin of=/dev/mtdblock1 bs=1k
+
  # dd if=u-boot.bin of=/dev/mtdblock1 bs=1k
 
or a
 
or a
  dd if=u-boot.bin of=/dev/mtdblock2 bs=1k
+
  # dd if=u-boot.bin of=/dev/mtdblock2 bs=1k
 
Make sure the boot is ok in flash :
 
Make sure the boot is ok in flash :
  > cmp u-boot.bin /dev/mtd1
+
  # cmp u-boot.bin /dev/mtd1
 
  cmp: EOF on u-boot.bin
 
  cmp: EOF on u-boot.bin
 
or
 
or
  > cmp u-boot.bin /dev/mtd2
+
  # cmp u-boot.bin /dev/mtd2
 
  cmp: EOF on u-boot.bin
 
  cmp: EOF on u-boot.bin
 
Make sure you have a valid /boot/uImage in hda1 and reboot ;)
 
Make sure you have a valid /boot/uImage in hda1 and reboot ;)
  reboot
+
  # reboot
 
If it doesn't work :
 
If it doesn't work :
 
* Your Kurobox is now a [[brick]], only JTAG will allow to restore it
 
* Your Kurobox is now a [[brick]], only JTAG will allow to restore it
* The kernel in /boot/uImage is incorrect, try forcing booting kernel in flash using the red button
+
* The kernel in /boot/uImage is incorrect, try forcing Emergency Mode (EM) by using the red button on the back of your Kurobox.
 +
 
 +
 
  
 
=== Kurobox HG ===
 
=== Kurobox HG ===
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">This is for the Kurobox HG only !!!! For standard Kurobox, check [[#Standard_Kurobox]] !!!</p>
+
 
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">This is for the Kurobox HG only !!!! For standard Kurobox, check [[#Standard_Kurobox]] !!!</p>
+
 
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">This is for the Kurobox HG only !!!! For standard Kurobox, check [[#Standard_Kurobox]] !!!</p>
+
 
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">This is for the Kurobox HG only !!!! For standard Kurobox, check [[#Standard_Kurobox]] !!!</p>
+
{{warning|'''This section is for the Kurobox HG. For Standard Kurobox, goto [[#Standard Kurobox|the Standard Kurobox Instructions]]'''}}
 +
 
 +
 
 +
 
 +
 
 
==== Kernel 2.4.x for Kurobox HG only ====
 
==== Kernel 2.4.x for Kurobox HG only ====
Boot your kernel as usual and download the U-Boot version for Kurobox '''HG''' :
+
 
  http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kuroboxhg.tar.gz
+
Boot your 2.4.x kernel as usual and download, untar, and check the checksum of the U-Boot image for Kurobox '''HG''' :
untar it and check the checksum :
+
  # wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kuroboxhg.tar.gz
  > tar xzf u-boot-1.1.4-kurobox.tar.gz
+
  # tar zxvf u-boot-1.1.4-kuroboxhg.tar.gz
  > cksum u-boot.bin
+
  # cksum u-boot.bin
 
  2604640296 164676 u-boot.bin
 
  2604640296 164676 u-boot.bin
 
If all is ok, flash the boot !
 
If all is ok, flash the boot !
  dd if=u-boot.bin of=/dev/fl2 bs=1k
+
  # dd if=u-boot.bin of=/dev/fl2 bs=1k
 
Make sure the boot is ok in flash :
 
Make sure the boot is ok in flash :
  > cmp u-boot.bin /dev/fl2
+
  # cmp u-boot.bin /dev/fl2
 
  cmp: EOF on u-boot.bin
 
  cmp: EOF on u-boot.bin
 
Make sure you have a valid /boot/uImage in hda1 and reboot ;)
 
Make sure you have a valid /boot/uImage in hda1 and reboot ;)
  reboot
+
  # reboot
 
If it doesn't work :
 
If it doesn't work :
 
* Your Kurobox is now a [[brick]], only JTAG will allow to restore it
 
* Your Kurobox is now a [[brick]], only JTAG will allow to restore it
* The kernel in /boot/uImage is incorrect, try forcing booting kernel in flash using the red button
+
* 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 ====
 
==== Kernel 2.6.x for Kurobox HG only ====
<p style="border:dashed 1px red;background:Lemonchiffon;text-align:center;margin:0 5px">WARNING : Process is harder when using a 2.6.x kernel ! If you're not sure, just get back to 2.4.x kernel !</p>
+
 
Boot your kernel as usual and download the U-Boot version for Kurobox '''HG''' :
+
 
  wget 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
+
{{warning|'''Process is harder when using a 2.6.x kernel ! If you're not sure, boot to a 2.4.x kernel and follow the 2.4 kernel instructions''' !}}
 +
 
 +
 
 +
 
 +
 
 +
 
 +
Boot your 2.6.x kernel as usual and download, untar, and check the checksum the U-Boot image for Kurobox '''HG''' :
 +
  # wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kuroboxhg.tar.gz
 +
  # tar zxvf u-boot-1.1.4-kuroboxhg.tar.gz
 +
  # cksum u-boot.bin
 
  2604640296 164676 u-boot.bin
 
  2604640296 164676 u-boot.bin
 
If all is ok, check your flash mapping :
 
If all is ok, check your flash mapping :
 
it should be
 
it should be
  > cat /proc/mtd
+
  # cat /proc/mtd
 
  dev:    size  erasesize  name
 
  dev:    size  erasesize  name
 
  mtd0: 00300000 00010000 "mtd_firmimg"
 
  mtd0: 00300000 00010000 "mtd_firmimg"
  mtd1: 00070000 00010000 "mtd_bootcode"
+
  '''mtd1: 00070000 00010000 "mtd_bootcode"'''
 
  mtd2: 00010000 00010000 "mtd_status"
 
  mtd2: 00010000 00010000 "mtd_status"
 
  mtd3: 00080000 00010000 "mtd_conf"
 
  mtd3: 00080000 00010000 "mtd_conf"
Line 147: Line 194:
 
  mtd5: 000f0000 00010000 "mtd_data"
 
  mtd5: 000f0000 00010000 "mtd_data"
 
or
 
or
  > cat /proc/mtd
+
  # cat /proc/mtd
 
  dev:    size  erasesize  name
 
  dev:    size  erasesize  name
 
  mtd0: 00400000 00010000 "mtd_allflash"
 
  mtd0: 00400000 00010000 "mtd_allflash"
 
  mtd1: 00300000 00010000 "mtd_firmimg"
 
  mtd1: 00300000 00010000 "mtd_firmimg"
  mtd2: 00070000 00010000 "mtd_bootcode"
+
  '''mtd2: 00070000 00010000 "mtd_bootcode"'''
 
  mtd3: 00010000 00010000 "mtd_status"
 
  mtd3: 00010000 00010000 "mtd_status"
 
  mtd4: 00080000 00010000 "mtd_conf"
 
  mtd4: 00080000 00010000 "mtd_conf"
  
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 !
+
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
 
So depending of the result of the previous command, do a
  dd if=u-boot.bin of=/dev/mtdblock1 bs=1k
+
  # dd if=u-boot.bin of=/dev/mtdblock1 bs=1k
 
or a
 
or a
  dd if=u-boot.bin of=/dev/mtdblock2 bs=1k
+
  # dd if=u-boot.bin of=/dev/mtdblock2 bs=1k
 
Make sure the boot is ok in flash :
 
Make sure the boot is ok in flash :
  > cmp u-boot.bin /dev/mtd1
+
  # cmp u-boot.bin /dev/mtd1
 
  cmp: EOF on u-boot.bin
 
  cmp: EOF on u-boot.bin
 
or
 
or
  > cmp u-boot.bin /dev/mtd2
+
  # cmp u-boot.bin /dev/mtd2
 
  cmp: EOF on u-boot.bin
 
  cmp: EOF on u-boot.bin
 
Make sure you have a valid /boot/uImage in hda1 and reboot ;)
 
Make sure you have a valid /boot/uImage in hda1 and reboot ;)
  reboot
+
  # reboot
 
If it doesn't work :
 
If it doesn't work :
 
* Your Kurobox is now a [[brick]], only JTAG will allow to restore it
 
* Your Kurobox is now a [[brick]], only JTAG will allow to restore it
* The kernel in /boot/uImage is incorrect, try forcing booting kernel in flash using the red button
+
* The kernel in /boot/uImage is incorrect, try forcing Emergency Mode (EM) by using the red button on the back of your Kurobox.
  
=== Linkstation ===
 
No Uboot for Linkstation yet, some guys are working on that !
 
check on [http://www.linkstationwiki.net/index.php?title=Projects/u-boot_bootloader linkstationwiki] for any update !
 
  
 
== Building your own U-Boot binary ==
 
== Building your own U-Boot binary ==
First of all, there is some problems while trying to compile U-Boot 1.1.4 with Make v3.81 ! Install Make 3.80 before trying to compile U-Boot !
+
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 patch :
+
 
  wget http://homepage2.nifty.com/nijino/library/u-boot-1.1.4_kurobox.patch.bz2
+
Get nijino's patch:
* Get U-Boot 1.1.4 source code from a [http://prdownloads.sourceforge.net/u-boot/u-boot-1.1.4.tar.bz2?download mirror] and apply the patch
+
  # wget http://homepage2.nifty.com/nijino/library/u-boot-1.1.4_kurobox-20060715.patch.bz2
  wget http://surfnet.dl.sourceforge.net/sourceforge/u-boot/u-boot-1.1.4.tar.bz2
+
Get U-Boot 1.1.4 source code from a [http://prdownloads.sourceforge.net/u-boot/u-boot-1.1.4.tar.bz2?download mirror] and apply the patch
  tar xfz u-boot-1.1.4.tar.gz && cd u-boot-1.1.4
+
  # wget http://surfnet.dl.sourceforge.net/sourceforge/u-boot/u-boot-1.1.4.tar.bz2
  bzip2 -dc ../u-boot-1.1.4_kurobox.patch.bz2 | patch -Np1
+
  # tar jxvf u-boot-1.1.4.tar.bz2 && cd u-boot-1.1.4
* Configure U-Boot for your target :
+
  # bzip2 -dc ../u-boot-1.1.4_kurobox-20060715.patch.bz2 | patch -Np1
Kurobox
+
Configure U-Boot for your target :
  make KUROBOX_config
+
* Kurobox
Kurobox HG
+
  # make KUROBOX_config
  make KUROBOX_HG_config
+
* Kurobox HG
* Build U-Boot
+
  # make KUROBOX_HG_config
  make
+
Build U-Boot
* Copy mkimage to /usr/bin (needed to build kernel images for U-Boot
+
  # make
  cp tools/mkimage /usr/bin/mkimage
+
Copy mkimage to /usr/bin (needed to build kernel images for U-Boot
  chmod 0755 /usr/bin/mkimage
+
  # cp tools/mkimage /usr/bin/mkimage
You now have an u-boot.bin file, just follow this article to flash it in your Kurobox !
+
  # chmod 0755 /usr/bin/mkimage
 +
You now have your own '''u-boot.bin''' file. Just follow this article to write this into your Kurobox's flash memory.
  
Nijino added a tool to check if built u-boot.bin is the good one !
+
nijino has also written a tool to check if a built u-boot.bin is built for the correct Kurobox version.
  wget http://homepage2.nifty.com/nijino/kurobox/uboot_check.c
+
  # wget http://homepage2.nifty.com/nijino/kurobox/uboot_check.c
  gcc -o uboot_check uboot_check.c
+
  # gcc -o uboot_check uboot_check.c
  ./uboot_check
+
  # ./uboot_check
It'll tell you if the u-boot.bin is the good one for your Kurobox (just to be sure)
+
The output will tell you if your u-boot.bin matches your Kurobox version.
  
 
== References ==
 
== References ==
 
* [http://homepage2.nifty.com/nijino/kurobox/uboot.html Nijino's page with his patch and instructions (in Japanese)]
 
* [http://homepage2.nifty.com/nijino/kurobox/uboot.html Nijino's page with his patch and instructions (in Japanese)]
  
[[Category:HowTo]]
+
{{Template:Articles|Kurobox|UBoot}}

Latest revision as of 19:56, 26 January 2008

Nuvola apps important.png 
WARNING!

These instructions are for the Kurobox only.

The LinkStation port of U-Boot (http://www.linuxnotincluded.org.uk/linkstation/u-boot.html) supports the following PowerPC models:

LinkStation version 1 (model HD-HLAN-1), KuroBox standard, LinkStation HG (model HD-HGLAN), KuroBox HG



Nuvola apps important.png 
WARNING!

THE NIJINO U-BOOT BOOTLOADER IS NOT FULLY TESTED, ALTHOUGH IT HAS BEEN INSTALLED SUCCESSFULLY ON BOTH STANDARD AND HG KUROBOXES, THERE HAS BEEN AT LEAST ONE KUROBOX BRICKED. THINK LONG AND HARD BEFORE PERFORMING THIS MODIFICATION. A BRICKED KUROBOX REQUIRES JTAG ACCESS TO REPAIR AND IS NOT COVERED UNDER THE KUROBOX WARRANTY



Nuvola apps important.png 
WARNING!

FAILURE TO FOLLOW THE INSTRUCTIONS FOR YOUR TYPE OF KUROBOX (STANDARD OR HG) AND KERNEL VERSION (2.4 OR 2.6) WILL RESULT IN A BRICKED KUROBOX A BRICKED KUROBOX REQUIRES JTAG ACCESS TO REPAIR AND IS NOT COVERED UNDER THE KUROBOX WARRANTY



Contents

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:

# wget http://www.kurobox.com/sylver/u-boot/mkimage
# chmod 0755 mkimage
# mv mkimage /usr/bin/

Now compile the kernel as normal:

# export ARCH=ppc

next do either

# make menuconfig

or

# make oldconfig

Create a U-Boot compatible uImage:

# make 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.

# cp arch/ppc/boot/images/uImage /boot/
# make modules
# 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 /.

Flash U-Boot on your Kurobox

Kurobrick.png
WARNING!

There is a possibility that you could brick your NAS with these instructions. Please make sure that you read the entire page carefully. The Kurobox and Kurobox HG use a different U-Boot flash image. If the wrong image is written to the flash memory, your Kurobox will be bricked and will require a JTAG cable and software to repair.

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.


Standard Kurobox

Nuvola apps important.png 
WARNING!

This section is for the Standard Kurobox. For Kurobox HG, goto the Kurobox HG Instructions




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:

# wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kurobox.tar.gz
# tar zxvf 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 :

  • 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

Nuvola apps important.png 
WARNING!

Process is harder when using a 2.6.x kernel ! If you're not sure, boot to a 2.4.x kernel and follow the 2.4 kernel instructions !




Boot your 2.6.x kernel as usual and download, untar, and check the checksum the U-Boot image for standard Kurobox:

# wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kurobox.tar.gz
# tar zxvf 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 : it should be

# 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"

or

# cat /proc/mtd
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"

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

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

or a

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

Make sure the boot is ok in flash :

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

or

# cmp u-boot.bin /dev/mtd2
cmp: EOF on u-boot.bin

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

# reboot

If it doesn't work :

  • 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.


Kurobox HG

Nuvola apps important.png 
WARNING!

This section is for the Kurobox HG. For Standard Kurobox, goto the Standard Kurobox Instructions




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 :

# wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kuroboxhg.tar.gz
# tar zxvf u-boot-1.1.4-kuroboxhg.tar.gz
# cksum u-boot.bin
2604640296 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 :

  • 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

Nuvola apps important.png 
WARNING!

Process is harder when using a 2.6.x kernel ! If you're not sure, boot to a 2.4.x kernel and follow the 2.4 kernel instructions !




Boot your 2.6.x kernel as usual and download, untar, and check the checksum the U-Boot image for Kurobox HG :

# wget http://www.kurobox.com/sylver/u-boot/u-boot-1.1.4-kuroboxhg.tar.gz
# tar zxvf u-boot-1.1.4-kuroboxhg.tar.gz
# cksum u-boot.bin
2604640296 164676 u-boot.bin

If all is ok, check your flash mapping : it should be

# 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"

or

# cat /proc/mtd
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"

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

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

or a

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

Make sure the boot is ok in flash :

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

or

# cmp u-boot.bin /dev/mtd2
cmp: EOF on u-boot.bin

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

# reboot

If it doesn't work :

  • 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:

# wget http://homepage2.nifty.com/nijino/library/u-boot-1.1.4_kurobox-20060715.patch.bz2

Get U-Boot 1.1.4 source code from a mirror and apply the patch

# wget http://surfnet.dl.sourceforge.net/sourceforge/u-boot/u-boot-1.1.4.tar.bz2
# tar jxvf u-boot-1.1.4.tar.bz2 && cd u-boot-1.1.4
# bzip2 -dc ../u-boot-1.1.4_kurobox-20060715.patch.bz2 | patch -Np1

Configure U-Boot for your target :

  • Kurobox
# make KUROBOX_config
  • Kurobox HG
# make KUROBOX_HG_config

Build U-Boot

# make

Copy mkimage to /usr/bin (needed to build kernel images for U-Boot

# cp tools/mkimage /usr/bin/mkimage
# chmod 0755 /usr/bin/mkimage

You now have your own u-boot.bin file. Just follow this article to write this into your Kurobox's flash memory.

nijino has also written a tool to check if a built u-boot.bin is built for the correct Kurobox version.

# wget http://homepage2.nifty.com/nijino/kurobox/uboot_check.c
# gcc -o uboot_check uboot_check.c
# ./uboot_check

The output will tell you if your u-boot.bin matches your Kurobox version.

References