Home NAS (General) • Controlling your NAS with uBoot

Controlling your NAS with uBoot


One major step to deal with is the control of your NAS. Since it has no screen, there has to be some way to control it (else LaCie could not have put their OS on it). This control goes via uBoot which can be managed via a serial connection or clunc.

I prefer the serial way, because you can also see the verbose output of the kernel when you boot your NAS, which clunc cannot do with the default kernel on your Linux distro. Clunc is also a way to manage it, but i prefer to use it when you have your NAS installed the way i’ll be describing the next posts, because with clunc you can keep your NAS case closed and just use it to boot the kernel and then disconnect.

If you open up your NAS (with LaCie) there may be a serial header (which is 8 pins) on the mainboard. You need to find out which pins are used for +5V, GND, RxD and TxD. A simple voltage meter can help you with this, the TxD and RxD are 3,3V and the rest is 5V. You can establish a simple serial connection with a Nokia DKU-5 USB to Serial cable. I will not explain in detail what the pinouts are on that cable, since there are many variants and buying one of them will costs you a couple of euros and with this as well, a simple voltage meter can help you read out the voltages on the cable.

To explain how to use the serial connection is a hard one, if you manage to hook everything up correctly (find that out yourself, every cable is different) you can easily read out the serial information using a terminal client such as Minicom. One tip when using a USB to Serial cable, the devicename of the cable is /dev/ttyACM0. This information has to be entered once in Minicom via the Serial port setup inside Minicom. Then turn on your NAS and launch Minicom.

For a simple test i would use Clunc for now and clunc can be downloaded via Git:
git clone git://lacie-nas.org/clunc.git

Then you need to dive into clunc and build it:

When done you can use clunc this way:
./clunc -vi IPADDRESS

If you use DHCP on the NAS you need to find out the IP and enter that with clunc. For this to work you also have to reboot or re-power on your NAS.
If all went well you’ll be seeing something like this (just an example) or you’ll just see a Marvell prompt:

__ __ _ _
| \/ | __ _ _ ____ _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| | | | (_| | | \ V / __/ | |
|_| |_|\__,_|_| \_/ \___|_|_|
_ _ ____ _
| | | | | __ ) ___ ___ | |_
| | | |___| _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
\___/ |____/ \___/ \___/ \__| ** LOADER **

U-Boot 1.1.4 (Feb 9 2009 - 13:15:53) Marvell version: 2.4.9 LaCie : 1.00.0001

U-Boot code: 00200000 -> 0026FFF0 BSS: -> 00283280

Soc: 88F5182 A2 (DDR2)
CPU running @ 400Mhz
SysClock = 200Mhz , TClock = 166Mhz

DRAM CS[0] base 0x00000000 size 128MB
DRAM Total size 128MB 32bit width
[512kB@fff80000] Flash: 512 kB
Addresses 4M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (4M - 3M): Done
*** Warning - bad CRC, using default environment

CPU : ARM926 (Rev 0)
88F5182 A2 streaming disabled

There are some commands you should know, which helps you control uBoot:
bdinfo – Show you the boardinfo, however, not all boards support this command.
tftp [kerneladdress] [kernelfile] – This will boot [kernelfile] into [kerneladdress] via TFTP, the server used to retrieve this is set via serverip.
printenv – This will print out all the currently active environment variables.
saveenv – This will save the currently active environment variables to Flash memory.
resetenv – This will reset all environment variables to the default ones.
boot – This will initiate the bootprocess if a kernel image is found.
reset – This will give uBoot a reset and restart the board.

There are also some environment variables worth setting up before starting to boot things up:
setenv serverip [IPADDRESS] – With this you’ll set up the server ip-address which can be used to boot via TFTP.
setenv gatewayip [IPADDRESS – With this you can set the gateway ip-address which is needed before the serverip will work.
setenv ipaddr [IPADDRESS] – With this you can set the NAS ip-address.

When done entering the above details it’s handy to save them to memory for later use:

This is not a post showing the way you boot things on your NAS, but as a informational guide how your NAS boots and handles things. This information is really handy for my next posts on how to really boot your own kernel and manage to boot your root filesystem you’ve built earlier. Especially it’s handy to know what certain commands do and how to use them.

If you have questions on the above, feel free to leave a comment, this part of the setup is always difficult at first :).

Author:Jeffrey Langerak

23 responses to “Controlling your NAS with uBoot”

  • Chris 07-03-2011 at 17:28 Reply 

    This is not very clear at all.
    Firstly, what are the connections at the USB end of the cable?
    You talk of minicom and then suddenly switch to talking about clunc – having dismissed clunc at the beginning of the article.
    How does clunc communicate with the NAS if you can keep the case closed?

    • langerak 08-03-2011 at 09:08 Reply 

      It might not seem clear, but have you read my post thoroughly? I stated that i cannot go in-depth about the wiring of the DKU-5 cable (search Google! There are too much variants with different wiring). Clunc sends network packets that uBoot understands, however, it sends 1 network packet for 1 char. So it’s not the fastest option. Check out the Clunc page on the net to get more info on it :). As this is a hard step to describe i cannot go in depth about it. If you need assistance tho you can always ask for help :).

      • Chris 08-03-2011 at 17:20 Reply 

        Even if I found the instructions I do not want to be soldering serial connections 🙂

        What wasn’t clear, above, is that you flit from clunc to serial and back again.

        I’ve got the clunc working but, of course, once I issue the boot instructions I lose connectivity. I am now trying to install the netconsole but that needs to be built into the kernel and (other post) I cannot get the make menuconfig to work to add the netconsole commands. 🙁

        • langerak 09-03-2011 at 11:04 Reply 

          You don’t need to solder anything if you have the correct connectors. An old CD-ROM audio cable could do the trick, I’ve used that as well on my NAS systems. The netconsole option needs to be enabled in your kernel on your desktop, not on your NAS, uBoot already supports this feature. On your Ubuntu desktop, search for any packages with netconsole in them (aptitude search netconsole), check out with Google how to set up netconsole on your NAS, you need to alter some bootargs for this.

          Sorry for being unclear about the options and to flit between them, I’ll redesign that page to be more accurate :).

          • Chris 09-03-2011 at 15:49 Reply 

            OK, so something like a CD-Audio to the 8pin serial interface on the NAS? And the other end connects to ???. The USB interface on the Ubuntu system?

            I am sure this is clear to you as you done it many times but it isn’t clear to me what we are trying to accomplish 😉

  • Chris 10-03-2011 at 18:50 Reply 

    I just cannot get netconsole to work. Google found a dozen, different, ways to do it. None worked. The best I managed was getting the initial boot to show up in an NC screen. But as soon as the initial boot starts it just hangs.
    I ordered a serial cable from ebay, so I shall try that and hope to have more success.

    • langerak 11-03-2011 at 08:02 Reply 

      Ah, then you are having the exact same problems with netconsole as i had. You ordered a Nokia DKU-5 cable right? Let me know when you have it, strip the cable and let me know what the wiring is (colors) and make sure you have a CD-ROM audio cable ready :). I’ll see if I can take a picture of my cable for refecrence.

  • Chris 11-03-2011 at 23:50 Reply 

    yes, that is correct on the cable. It should arrive in the next few days. The problem now is how to get into the case 🙂

    The only way I see are two screws that (seem) to hold the front plate on. I see no other way in. But those screws would need a really, really, long thin screwdriver to get to them.

  • Chris 12-03-2011 at 00:55 Reply 

    yes, that is correct on the cable. It should arrive in the next few days.

  • Chris 19-03-2011 at 02:19 Reply 

    Cable arrived. A picture would be most helpful as I am struggling to visualize how this cable and a CD cable go together without solder 🙂

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.