Build your own NAS recovery

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 09:50, 4 May 2011 by Lsuser1985 (Talk | contribs) (Method 2: Use ACP Commander)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


If there is no NAS-recovery package available for your Linkstation, you may build your own.

This has been tested with

  • LS-WVL/R1 with Firmware 1.40 and 1.41

Basic steps are:

  1. Download and unpack the current firmware including LSupdater.
    This step should be easy and does not require explanation.
  2. Unpack the kernel and initrd from the firmware package
    See below for how to to this.
  3. Start an TFTP-server
    Below find some hints about where to get a TFTP server and how to start it.
  4. Make the Linkstation load the files and reboot, as described elsewhere (e.g. in Revive your arm9 box from scratch)

Unpack the kernel and initrd from the firmware package

LSUpdater send archive to the Linkstation, but NAS-recovery requires unpacked files to be served via TFTP.

The firmware-package contains (among others):

  • initrd.img - a ZIP-file containing initrds (initial ramdisks)
  • uImage.img - a ZIP-file containing the kernels

Getting the Product-ID

To know which files to extract from initrd.img and uImage.img, you'll need the product-id of your Linkstation.

Method 1: Log into your LS

If you opened your NAS (or another one with the same hardware) for telnet or ssh and can still log in, you may get the produc-id by executing the following command on the LS:

cat /proc/buffalo/firmware

The output will be something like

BUILDDATE=2011/04/05 09:26:24

Needless to say: the line PRODUCTID holds the product-id :-)

Method 2: Use ACP Commander

If your can still access your NAS with ACP Commander, you can use (put the correct IP-address and password into the next line, of course):

java -jar acp_commander.jar -t 192.168.x.x -ip 192.168.x.x -pw password -c "cat /proc/buffalo/firmware"

Within the output clutter spy the section which looks like in Method 1.

Method 3: Lookup in LSUpdater

Otherwise: Look into the file linkstation_version.ini of the extracted firmware. There are sections like this one:

KERNEL=2011/04/05 09:26:24

Find the section where FILE_BOOT_APPLY contains your model name. The example above is for LS-XH.

The line PID of this section is the product-id of your device, 0x00000011 in this example.

Unpacking the file

For Linux/Unix simply use the script below.

  • initrd.img and uImage.img are password protected zip file. You need to open it with an Unzip-Programm (Winzip, 7-zip, you name it). Passwords can be found on page Examine_ARM9_Firmware_without_Updating.
  • From initrd.img extract the file initrd.buffalo
  • From uImage.img extract
  • contains the filenames for each product id.
  • From uImage.img extract the file matching your product id.
  • Rename this file into uImage.buffalo (or set a soft-link)

Helper script for Linux/Unix

You may copy & paste the following lines into a shell:

PRODID=0x00003008 # see text for how to the this value

# from 
# for 1.40:

# for 1.41:

# unzip the required files
unzip -P "$passwd1" initrd.img initrd.buffalo
unzip -P "$passwd2" uImage.img
# which file will become uImage.buffalo
FILE_BOOT_APPLY=$(grep $PRODID | cut -f 2)
unzip -P "$passwd2" uImage.img "$FILE_BOOT_APPLY"
ln -s "$FILE_BOOT_APPLY" uImage.buffalo

Getting a TFTP-Server


Fetch one from you favorite software side.


Several tftp servers should be available with your Linux distribution. The package names may vary. Simply choose one :-)

Please have in mind, that TFTP uses Port 69, thus the server has to be started as root.

  • tftp-server
    • is not working, since it requires file-requests to contain absolute pathes, but the Linkstation requests without path.
    • meant to be started via inetd, but can be run stand-alone
    • To start in stand-alone use in.tftpd --foreground --verbose /path/to/firmware
  • python-tftpy -- pure Python implemention
    Can be run without installation:
 tar xzf tftpy-0.5.1.tar.gz
 cd tftpy-0.5.1
 python bin/ --root /path/to/firmware
If you are an experience Python user, you may use easy_install or pip as usual.