Home NAS (Advanced) • Update uBoot on the NetworkSpace 2

Update uBoot on the NetworkSpace 2

 - 

20110124-101752.jpgThe standard uBoot on the NetworkSpace 2 (and other LaCie NAS devices) is flashed in such way that you cannot modify it’s boot parameters. You can set them at boot time, but after a reboot or reset, the settings are gone.

Why update uBoot?
As in a lot of cases, you want to run your own version of Debian on it, creating the perfect NAS this way, you can install the software you like, not the manufacturer. To do this, you need to boot differently than LaCie does and that’s what updating is for. Also it’s possible to boot from USB and load the uImage off a ext2 partition, loading kernel images via TFTP and such options. The main reason for updating is that you can save the settings to SPI, which with stock uBoot won’t work.

Are there any risks?
Yes, there is always a chance that the image you’re flashing is corrupt and therefore will flash a corrupt uBoot image into flash. I also don’t take any credit if you kill your device flashing a wrong or corrupted uBoot onto it, the instructions are “as is” and are known to work, at least on my NS2 and some other people I’ve flashed this onto it. Also note that it’s not recommended to flash it using Clunc, as Clunc uses LUMP signals which do not work at first boot time (it can work, but you need to modify the uBoot image for it).

Ok, so no I’ve warned you, we can start building uBoot for your NS2. Note that there is a precompiled version ready for download in my Downloads section, but if you want to modify some options this building guide is useful.

Prerequisites
You need to have the ARM toolchain ready on your computer and have the environment variables set for them (see my earlier posts on how to accomplish this). Also you need git installed for the following procedures to work. Also it’s wise to gain root access on the machine you’re building on.

1. Get and build uBoot
Open a terminal, gain root access and do the following:
git clone git://lacie-nas.org/u-boot-lacie.git
cd u-boot-lacie
git checkout -b netspace_v2 origin/netspace_v2

If you have set the environment variables (arch, toolchain etc.) you can start building:
make netspace_v2_config
make u-boot.kwb

If there are no errors, there will be a resulting file called “u-boot.kwb“.

2. Prepare for TFTP
Copy the newly built image to your TFTP server in the following folder:
cp u-boot.kwb /srv/tftp/

3. Update uBoot on your NS2
Now establish a serial connection with your NS2 and make sure you have the serverip and ipaddr set to your correct values and start upgrading:
bubt u-boot-new.kwb
At a certain point, the following question will be asked:
Override Env parameters? (y/n)
Answer no to start with a clean set of uBoot parameters (more flexibility). If no errors occur during this step the upgrade has been performed successfully!
Now give the NS2 a reset and uBoot will be reloaded with the new version:
reset

4. Boot parameters
Now that uBoot has been upgraded there are alot of things regarding boot that can be done. When giving a printenv you’ll notive that there is standard support for USB boot. First uBoot tries to probe USB devices and after that the internal disk follows.
Normally for a uImage to boot, this had to be written via dd to a special partition (10), this setting is now gone and you can modify it’s startup parameters using ext2load (use help ext2load for examples and implementation). This way you can create a directory on your sda1 (rootdisk) partition called boot and place the uImage in that directory, uBoot will try to load the image that way. To use this feature, the partition has to be formatted in ext2 or ext3. Also using this method, you can upgrade your kernel whenever you want, as long as you overwrite the uImage file with the newer version and extract the kernelmodules to your /lib directory.

Disk boot:
ide reset
ext2load ide 0:1 0x800000 /boot/uImage

Making this permanent would be (if I am correct, that variable is disk_boot) (also make sure you have disconnected the disk, as it immediately tries to boot from it and therefore cannot save your settings!):
setenv disk_boot ide reset\; ext2load ide 0:1 0x800000 /boot/uImage
saveenv

USB boot:
usb start
usb storage
fatload usb 0:1 0x800000 /boot/uImage

Making this permanent would be the same as above with the same remarks, however, you can exchange fatload (FAT32) for ext2load (EXT2, EXT3):
setenv disk_boot usb start\; usb storage\; fatload usb 0:1 0x800000 /boot/uImage
saveenv

I will not cover the several bootargs and options as they are quite specific in their usage and you can use whatever setting you prefer on your NS2.

Author:langerak

Leave a Reply

Your email address will not be published. Required fields are marked*

*

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.