Difference between revisions of "Build your own NAS recovery"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(Created page with "= Overview = 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…")
 
(Unpack the kernel and initrd from the firmware package)
Line 24: Line 24:
  
 
== Getting th Product-ID ==
 
== Getting th Product-ID ==
 +
 +
First of all you'll need the product id or you Linkstation.
  
 
short: look into linkstation_version.ini
 
short: look into linkstation_version.ini
 +
 +
== 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 uImage.map
 +
* uImage.map 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 ==
 
== Helper script for Linux/Unix ==
Line 44: Line 57:
 
   
 
   
 
  # unzip the required files
 
  # unzip the required files
  unzip -P "$passwd1" initrd.img
+
  unzip -P "$passwd1" initrd.img initrd.buffalo
 
  unzip -P "$passwd2" uImage.img uImage.map
 
  unzip -P "$passwd2" uImage.img uImage.map
 
  # which file will become uImage.buffalo
 
  # which file will become uImage.buffalo
Line 51: Line 64:
 
  ln -s "$FILE_BOOT_APPLY" uImage.buffalo
 
  ln -s "$FILE_BOOT_APPLY" uImage.buffalo
 
</code>
 
</code>
 
 
  
 
= Getting a TFTP-Server =
 
= Getting a TFTP-Server =

Revision as of 14:27, 2 May 2011

Contents

Overview

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.


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 th Product-ID

First of all you'll need the product id or you Linkstation.

short: look into linkstation_version.ini

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 uImage.map
  • uImage.map 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 
# http://buffalo.nas-central.org/wiki/Examine_ARM9_Firmware_without_Updating
# for 1.40:
passwd1="aAhvlM1Yp7_2VSm6BhgkmTOrCN1JyE0C5Q6cB3oBB"
passwd2="aAhvlM1Yp7_2VSm6BhgkmTOrCN1JyE0C5Q6cB3oBB"

# for 1.41:
passwd1="IeY8omJwGlGkIbJm2FH_MV4fLsXE8ieu0gNYwE6Ty"
passwd2="YvSInIQopeipx66t_DCdfEvfP47qeVPhNhAuSYmA4"

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

Getting a TFTP-Server

Windows

Fetch one from you favorite software side.

Linux

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:
 wget http://pypi.python.org/packages/source/t/tftpy/tftpy-0.5.1.tar.gz
 tar xzf tftpy-0.5.1.tar.gz
 cd tftpy-0.5.1
 export PYTHONPATH=$PWD:$PYTHONPATH
 python bin/tftpy_server.py --root /path/to/firmware
If you are an experience Python user, you may use easy_install or pip as usual.