U-boot for LS Pro

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 00:45, 3 March 2008 by Davy gravy (Talk | contribs)

Jump to: navigation, search

Contents

Background & Facts

What is U-Boot?

U-Boot, or Das U-Boot, is a open-source, universal bootloader that is used in the LinkStation Pro/Live/KuroPro and other ARM-based NAS devices that Buffalo Technology makes. It has become more widespread in its use in other brands as well. Pre-ARM LinkStations/Kuro's had a proprietary bootloader, though LinuxNotIncluded and other members of the community here worked to bring U-Boot to the PPC and Mipsel based LinkStation devices as well.

We are all looking forward to a new, clean port of U-Boot for the LinkStation Pro.

Why upgrade it?

The build of U-Boot that is stock on the LS Pro (v1 and v2) and its contemporaries has very limited features, at least in comparision to what we have for the PPC LinkStations. Some noteworthy limitations to and exclusions from its capabilities include:

  • no NetConsole - with netconsole and NetCat, one can connect to the unit with serial-style console control, over the network
  • maximum number of arguments is 16, making changes of some of the more complicated env vars from the U-Boot side difficult or impossible
  • missing commands:
    • run - run commands in an environment variable
    • dhcp - invoke DHCP client to obtain IP/boot params
    • bdinfo - print Board Info structure
    • loadb - load binary file over serial line (kermit mode)
    • loads - load S-Record file over serial line
    • ping - send ICMP ECHO_REQUEST to network host
    • coninfo - print console devices and information
    • crc32 - checksum calculation

While some of these commands aren't really essential, the first few are quite advantageous to have, and missing them is an impediment. It is notable that LinuxNotIncluded's ports to PPC and Mipsel have all of these capabilities.


Acknowledgements

Thanks to jonli447, lb_worm and others who worked on this and left a trail to follow for the rest of us. Also, thanks to bbradley, Nicolas Pitre, Dominic Rath and others who are working on a clean port of U-Boot for Feroceon or doing great things w/ OpenOCD so we can have a better U-Boot for LS Pro's and the other ARM-based LinkStations.

Ready-Made U-Boot Images for LS Pro

Stock

  • for the LS Pro V1
  • for the LS Pro V2


Custom


Building U-Boot from ...

Buffalo GPL sources

1. Start by installing the Codesourcery Toolchain setup, shown here : Setting up the CodeSourcery Toolchain for x86-to-ARM Cross-Compiling. There is a handy auto-install script provided that is advantageous to use.

  • Follow all the direction on the page linked to.
  • By default it is the 2005q3 toolchain, and this is the (a) correct one to use for building U-Boot from the 1.1.1 source.


2. Adjust your environmental variables so that linking is correct.


3. Test your setup. It is suggested that you test your cross-compiler setup by building Linux 2.6.12 or 2.6.16, for instance. See this article for directions on how this is done. Both of these articles:

yield some good instructions and further hints.


Now that your toolchain is set up, you have two choices for building U-Boot from Buffalo's GPL sources. The first choice, 1.1.1 Buff109, is ready to go, without any alterations needed and is known to work. The second choice, 1.1.4-working (the name of the directory inside the archive) is not quite ready for use, but is probably very close. It is tempting to try to work with it, since NetConsole is in this source already, just needing setup. It remains to be seen if whatever new U-Boot we get in the near future is developed from the Buffalo source, or from vanilla sources (perhaps more likely).


Using the 1.1.1 Buff109 source

4. Get the source ready and read up on U-Boot.

  • Download and untar the source u-boot-1.1.1_buf109.tar.gz to wherever you are going to compile it, probably in COMPILING.
  • Read the README in the source for a lot of useful information about configuring U-Boot.
  • Read the documentation on U-Boot, like this U-Boot Reference/Manual from the developer Denx.



5. (Optional) Make any adjustments to include/configs/db88f5181.h that you want to. Tinkering with this can have serious consequences - like a broken U-Boot, so use caution.


6. In the script buffalomake.sh comment out the line third line to look like this:

 #. /opt/cross.conf


7. Run the script.

./buffalomake.sh

OR configure manually and make.


8. After a few minutes you should find a u-boot.bin in the source directory.


9. Make sure you read the Brick Warning before you attempt to flash.


Using the 1.1.4 "working" source

4. Get the source ready and read up on U-Boot.

  • Download and untar the source u-boot-1.1.4.zip to wherever you are going to compile it, probably in COMPILING.
  • Read the README in the source for a lot of useful information about configuring U-Boot.
  • Read the documentation on U-Boot, like this U-Boot Reference/Manual from the developer Denx.


5. In the source, some symlinks have to be added to get it to compile. Trying any make *_config command will reveal problems. In particular, you may need to change the following directories so that the names are symlinks rather than actual directories:

include/asm/proc 
include/asm/arch 
include/asm  

pointing, of course to the ARM counterparts for these.


6. Either configure manually and make, or use the buffalomake.sh script. Problem/Impasse: The images built with this source are too large. They must be 256k or smaller, and what is created is around 580kb.

Vanilla Sources

This is a work in progress. At least one community member is currently working on this.


Flashing U-Boot to Your LS Pro

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. WARNING: Modifying your LinkStation or Kuro can void your warranty. Incorrect flashing procedures can turn your unit into a Brick. Flashing success is not guaranteed. Do not flash your box unless your are willing to use JTAG to recover it, in the event that there is an unforeseen problem. JTAG recovery generally works well, but is not a guarantee of recovery from bricking one's box.


From a Linux Box using JTAG

See this article on JTAG for the LS Pro for instructions and details. Normally, this is a last resort method for flashing U-Boot to ROM. It is used most often when one doesn't have a functioning U-Boot in ROM already.


From within U-Boot

1. Read the Brick Warning above first!. You brick it, you bought it.


2. Set up a tftp server and have your known valid u-boot image (called my_u-boot.bin here, adjust to your situation) sitting at its root directory. You may have to adjust either your U-Boot env vars or your network to have the tftp server at the correct ip given in U-Boots serverip variable.


3. While connected to the U-Boot console (either serial or netcat connection), from the U-Boot side issue the following commands (adjust my_u-boot.bin to your situation):

tftp 0x00100000 my_u-boot.bin
protect off 1:0-63
erase 1:0-63
cp.b ${fileaddr} 0xfffc0000 ${filesize}
protect on 1:0-63
saveenv

This should yield output similar to this.

Marvell>> tftp 0x00100000 u-boot_davy_02082008.bin                             
Using egiga0 device                                                             
TFTP from server 192.168.11.149; our IP address is 192.168.11.150               
Filename 'u-boot_davy_02082008.bin'.                                           
Load address: 0x100000                                                         
Loading: #################################################                     
done                                                                           
Bytes transferred = 245776 (3c010 hex)                                         
Marvell>> protect off 1:0-63                                                   
Un-Protect Flash Sectors 0-63 in Bank # 1                                       
................................................................ done           
Marvell>> erase 1:0-63                                                         
Erase Flash Sectors 0-63 in Bank # 1                                           
................................................................               
Marvell>> cp.b ${fileaddr} 0xfffc0000 ${filesize}                               
Copy to Flash... done                                                           
Marvell>> protect on 1:0-63                                                     
Protect Flash Sectors 0-63 in Bank # 1                                         
................................................................ done           
Marvell>> saveenv                                                               
Saving Environment to Flash...                                                 
.                                                                               
Un-Protected 1 sectors                                                         
Erasing Flash...                                                               
.                                                                               
Erased 1 sectors                                                               
Writing to Flash... done                                                       
.                                                                               
Protected 1 sectors


From within Linux on your LinkStation Pro

1. Read the Brick Warning above first!. You brick it, you bought it.


2. Not yet successfully tested, though it should be possible by using dd commands to an mtd dev. Should be possible, either from foonas-em, foonas, or even from FreeLink or JTY-MOD. If anyone has done this, please add your content here, after letting the community know at the Forum.

References

Forum Threads Related to this Subject

Build System for U-Boot on LS Pro

U-Boot for LS Pro/Live

Exact Diffs Between LS Pro U-Boot for v1 & v2 Machines