Foonas-iscsi:Install-n2100

From foonas

Jump to: navigation, search

Contents

Installing foonas-iscsi in Flash on Thecus n2100

WARNING: this procedure will make permanent changes to your Thecus n2100 and probably void your warranty. It is entirely possible to brick your device or lose access by following this procedure, correctly or incorrectly. There is NO WARRANTY. If you break your device, you get to keep both pieces. Please be extremely careful.

ANOTHER WARNING: You will have to replace the bootloader for this procedure. Replacing the bootloader is the most dangerous thing you can do except taking a hammer to the box. If it fails, your n2100 will be permanently unbootable.

ANOTHER WARNING: Sorry, despite the replacement of the bootloader these instructions still do not work. It appears that I cannot boot kernels that I used to be able to boot, when using this new bootloader.

Note that this is work in progress and we do not in any way currently support this platform.

Upgrading Redboot

The bootloader on the n2100 is Red Hat's RedBoot. Unfortunately the version supplied on modern n2100s ignores the boot sequence that you enter, and uses hard-coded defaults. You MUST override this otherwise you will not be able to boot a custom image on the n2100. Very luckily, Ian Darwin of the OpenBSD project has got some very useful help from Thecus, in the form of a replacement version of Redboot that does not override the configured boot sequence.

Please start with a standard n2100. If you have installed any custom firmware, please remove it and revert to the latest standard Thecus firmware.

In order to access RedBoot over the network, you'll need to have firmware version 2.01.05 or higher installed. Please boot your n2100 normally and check that the latest firmware is installed.

Please read Ian Darwin's page and install the Redboot patch provided there. To do that, you will need to use the standard firmware upgrade procedure, in other words you must boot a standard Thecus image and use its Firmware Upgrade menu.

If you ever meet Ian Darwin or Y.T. Lee, please buy them a beer (or beverage of their choice).

Getting Access to RedBoot

Thecus Redboot cannot access the hard disk of the device. Therefore you will have to perform all installations and updates over the network. You could also install a serial port, but that will most definitely void your warranty, and seems to have no real benefit unless you lose network access to the n2100 and you're certain that RedBoot is still installed and working.

Thanks to Martin Michlmayr from Cyrius for providing instructions on which these instructions are based.

You need a Linux or Unix box with tftpd, arping and telnet installed to follow these instructions. To get arping on a Debian or Ubuntu machine, install the iputils-arping package. You also need your box configured with an IP address in the 192.168.1.x subnet, on the interface to which the n2100 is connected, but not 192.168.1.100, as the n2100 will use that IP address.

Start with the n2100 switched off. Run the following command on your console:

arping -f 192.168.1.100 && telnet 192.168.1.100 9000

This should output something like the following:

ARPING 192.168.1.100 from 192.168.1.104 eth0

and nothing else yet. Now power up the n2100 and after about five seconds, you should see some output like this:

Unicast reply from 192.168.1.100 [00:14:FD:10:33:8E]  6.473ms
Sent 9 probes (9 broadcast(s))
Received 1 response(s)
Trying 192.168.1.100...
Connected to 192.168.1.100.
Escape character is '^]'.
== Executing boot script in 2.650 seconds - enter ^C to abort

This should happen before the orange light on the n2100 stops flashing and the unit beeps. If not, check that you have an IP address on the right subnet and that you can ping the n2100 on 192.168.1.100 (unless you changed the IP of the n2100 from the default).

When you see the Executing boot script line, quickly press Ctrl+C to interrupt the boot sequence. You should see something like this:

^C
RedBoot>

You now have access to the RedBoot bootloader and can give it commands.

Testing your Firmware

Ensure that you have a kernel image available that boots on the n2100. See [Foonas-iscsi:TFTPBoot-n2100] for more information. If you're at all unsure, load the image that you intend to install and boot it now.

Installing your Firmware

To install the firmware, you will have to delete the existing Thecus firmware from the n2100, and change the boot configuration. Instructions on how to do revert this and reinstall the original firmware are provided below.

Before deleting the firmware, issue the fis list command, and check that the output is exactly as shown:

RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xF0000000  0xF0000000  0x00040000  0x00000000
RedBoot config    0xF0FC0000  0xF0FC0000  0x00001000  0x00000000
FIS directory     0xF0FE0000  0xF0FE0000  0x00020000  0x00000000
ramdisk           0xF0040000  0x00800000  0x00D00000  0x00800000
kernel            0xF0D40000  0x00200000  0x00160000  0x00200000
user              0xF0EA0000  0x00120000  0x00120000  0x00800000

Any changes to the Name, Mem addr or Entry point columns will result in your being unable to reinstall the original firmware following the procedure below, i.e. not able to return your n2100 to factory condition. Please double check that all the values are exactly as shown, and make a backup copy of the output of the fis list command before proceeding.

Now run the fconfig -l command and check that the output matches the following exactly as well. (However, your MAC addresses and serial number will be different)

RedBoot> fconfig -l
Run script at boot: true
Boot script:
.. thecus_setip
.. fis load ramdisk
.. fis load kernel
.. exec -c "console=ttyS0,115200 root=/dev/ram0 initrd=0xa0800000,42M mem=128M@0xa0000000"

Boot script timeout (1000ms resolution): 3
Use BOOTP for network configuration: false
Gateway IP address: 0.0.0.0
Local IP address: 192.168.1.100
Local IP address mask: 255.255.255.0
Default server IP address: 0.0.0.0
Console baud rate: 115200
DNS server IP address: 0.0.0.0
GDB connection port: 9000
HW Status: 0
Force console for special debug messages: false
MAC address: 0x00:0x14:0xFD:0x30:0x00:0x00
MAC address 2: 0x00:0x14:0xFD:0x30:0x00:0x01
Network debug at boot time: false
Reset default: Normal
Serial number: XXXXXXXXXXXX

To delete the Thecus firmware, use the following RedBoot commands:

fis delete ramdisk
fis delete kernel

Each one will ask you for confirmation. These commands will take some time, e.g. about 60 seconds. DO NOT reboot your n2100 while the command is running, as you may permanently damage the Flash memory and make it unusable.

Now the n2100 will not boot until you install your own firmware, or reinstall the Thecus firmware. To install your own firmware, load it as usual:

ip -h 192.168.1.x
load -b 0x00800000 -r zImage-my-kernel-image

Ensure that it has loaded successfully,

Now instead of booting the image immediately, write it to Flash with the fis create kernel command:

RedBoot> fis create kernel
... Erase from 0xf0d40000-0xf0ea0000: ...........
... Program from 0x00200000-0x00360000 at 0xf0d40000: ...........
... Unlock from 0xf0fe0000-0xf1000000: .
... Erase from 0xf0fe0000-0xf1000000: .
... Program from 0x07fdf000-0x07fff000 at 0xf0fe0000: .
... Lock from 0xf0fe0000-0xf1000000: .

This command will also take some time, e.g. about 60 seconds. DO NOT reboot your n2100 while the command is running, as you may permanently damage the Flash memory and make it unusable.

Now change your boot loader configuration to load the new kernel, using the fconfig command. This steps through the configuration one value at a time, prompting for new values. For every item except the boot script, you can enter a single full stop (.) instead of a value to finish editing at that point, or press Enter to leave the value unchanged.

Note that when editing the configuration, line editing is very difficult. Control keys (e.g. Ctrl+H) are displayed like ^H, do have the effect of deleting the previous character, but do not display that effect on the screen. Try very hard not to make mistakes when you edit the configuration. Ctrl+H (displayed as ^H) actually deletes the previous character, even though it appears as though you typed ^H on the screen. Similarly, Ctrl+K displays as ^K and deletes the entire line.

RedBoot> fconfig
Run script at boot: true (press Enter)
Boot script:
.. thecus_setip
.. fis load ramdisk
.. fis load kernel
.. exec -c "console=ttyS0,115200 root=/dev/ram0 initrd=0xa0800000,42M mem=128M@0xa0000000"
Enter script, terminate with empty line (enter the following lines without >>)
>> fis load kernel
>> exec
>>
Boot script timeout (1000ms resolution): 3. (enter a single dot here)
Update RedBoot non-volatile configuration - continue (y/n)? y
... Unlock from 0xf0fc0000-0xf0fc1000: .
... Erase from 0xf0fc0000-0xf0fc1000: .
... Program from 0x07fd2000-0x07fd3000 at 0xf0fc0000: .
... Lock from 0xf0fc0000-0xf0fc1000: .

Use the fconfig -l command to check that the configuration was set correctly:

RedBoot> fconfig -l
Run script at boot: true
Boot script:
.. fis load kernel
.. exec

Boot script timeout (1000ms resolution): 3
Use BOOTP for network configuration: false
Gateway IP address: 0.0.0.0
Local IP address: 192.168.1.100
Local IP address mask: 255.255.255.0
Default server IP address: 0.0.0.0
Console baud rate: 115200
DNS server IP address: 0.0.0.0
GDB connection port: 9000
HW Status: 0
Force console for special debug messages: false
MAC address: 0x00:0x14:0xFD:0x30:0x00:0x00
MAC address 2: 0x00:0x14:0xFD:0x30:0x00:0x00
Network debug at boot time: false
Reset default: Normal
Serial number: xxxxxxxxxxxx

Now you can use the following commands to test that it worked:

RedBoot> fis load kernel
RedBoot> exec

Alternatively, use the reset command to reboot the n2100 immediately, and it should load your new kernel (this is the part that doesn't work for me).

Reinstalling the Thecus Firmware

If you need to return your n2100 to its original state, for example to use it as a normal n2100 or to return it for warranty service, use the following procedure to remove your custom firmware and reinstall the defaults.

First download the Thecus firmware that you want to install, which should give you a bin file, e.g. N2100_FW_2.01.09.bin.

Decrypt and unpack the firmware like this:

openssl enc -d -des -in n2100upgrade.*.bin -out upgrade.tar.gz -K 7A9816A4C275D557 -iv 0 -nosalt -nopad
tar -xzpf upgrade.tar.gz

From the upgrade directory, copy kernel and ramdisk.arm to your tftpboot directory.

Boot your n2100 and access the RedBoot monitor mode as above.

Remove your custom kernel:

RedBoot> fis delete kernel
Delete image 'kernel' - continue (y/n)? y
... Erase from 0xf0d40000-0xf0ea0000: ...........
... Unlock from 0xf0fe0000-0xf1000000: .
... Erase from 0xf0fe0000-0xf1000000: .
... Program from 0x07fdf000-0x07fff000 at 0xf0fe0000: .
... Lock from 0xf0fe0000-0xf1000000: .

Load the original ramdisk at 0x00800000, and write to Flash:

RedBoot> load -b 0x00800000 -r ramdisk.arm
Using default protocol (TFTP)
Raw file loaded 0x00800000-0x014fffff, assumed entry at 0x00800000
RedBoot> fis create ramdisk
... Erase from 0xf0040000-0xf0d40000: ........................................................................................................
... Program from 0x00800000-0x01500000 at 0xf0040000: ........................................................................................................
... Unlock from 0xf0fe0000-0xf1000000: .
... Erase from 0xf0fe0000-0xf1000000: .
... Program from 0x07fdf000-0x07fff000 at 0xf0fe0000: .
... Lock from 0xf0fe0000-0xf1000000: .

Load the original kernel at 0x00200000, and write to Flash:

RedBoot> load -b 0x00200000 -r kernel
Using default protocol (TFTP)
Raw file loaded 0x00200000-0x0035ffff, assumed entry at 0x00200000
RedBoot> fis create kernel
... Erase from 0xf0d40000-0xf0ea0000: ...........
... Program from 0x00200000-0x00360000 at 0xf0d40000: ...........
... Unlock from 0xf0fe0000-0xf1000000: .
... Erase from 0xf0fe0000-0xf1000000: .
... Program from 0x07fdf000-0x07fff000 at 0xf0fe0000: .
... Lock from 0xf0fe0000-0xf1000000: .

Reconfigure the boot commands back to the original values:

RedBoot> fconfig
Run script at boot: true (press Enter)
Boot script:
.. fis load kernel
.. exec
Enter script, terminate with empty line (enter the following lines without >>)
>> thecus_setip
>> fis load ramdisk
>> fis load kernel
>> exec -c "console=ttyS0,115200 root=/dev/ram0 initrd=0xa0800000,42M mem=128M@0xa0000000"
>>
Boot script timeout (1000ms resolution): 3. (enter a single dot here)
Update RedBoot non-volatile configuration - continue (y/n)? y
... Unlock from 0xf0fc0000-0xf0fc1000: .
... Erase from 0xf0fc0000-0xf0fc1000: .
... Program from 0x07fd2000-0x07fd3000 at 0xf0fc0000: .
... Lock from 0xf0fc0000-0xf0fc1000: .

Now restart the n2100, and it should boot the original firmware:

RedBoot> reset

and hopefully all will be well in the world.

Personal tools