U-Boot on the QNAP TS-409
If you have a serial console for your QNAP TS-409, you can use U-Boot, the boot loader used on the TS-409, to restore the original QNAP firmware or load images via the network.
Loading the installer image
You can load the Debian installer image (or other images) via TFTP. First of all, configure the IP address of the TFTP server and of your QNAP:
setenv serverip 192.168.1.2 setenv ipaddr 192.168.1.139
Then specify the command line that should be passed to the kernel. This tells the kernel that the serial console should be activated and that there's a ramdisk that is 4 MB in size.
setenv bootargs console=ttyS0,115200n8 root=/dev/ram rw initrd=0x800000,0x3fffff
Finally, load the image via the network with TFTP and start it:
tftpboot 0x0800000 initrd tftpboot 0x400000 kernel bootm 0x400000
If you'd like to load a kernel image you saved from /boot
, please see the
instructions on how to prepare the image.
Restoring the QNAP firmware
If you want to restore the original QNAP firmware when your Debian is no longer working, you can put the backup you made of your QNAP firmware into flash via U-Boot. First, specify the IP address of your TFTP server and of your QNAP device:
setenv serverip 192.168.1.4 setenv ipaddr 192.168.1.139
Then load the backup you made of mtd1
(the QNAP kernel) and write it to
flash:
tftpboot 0x400000 mtd1 erase 0xff800000 0xff9fffff cp.b 0x400000 0xff800000 ${filesize}
Finally, load the backup you made of mtd2
(the QNAP ramdisk) and write it
to flash:
tftpboot 0x0800000 mtd2 erase 0xffa00000 0xffdfffff cp.b 0x0800000 0xffa00000 ${filesize}
And restart the machine:
reset
Once you have restored the QNAP firmware in flash, you have to follow the second step described on the restore page and run QNAP Finder to install the QNAP software to disk.
Preparing Debian images from /boot
to load
You can copy the Debian kernel and ramdisk from your system to another
machine for backup. This way, you can load them via TFTP as described
above. However, the files from /boot
cannot be used directly but
require some modifications before you can use them. You don't have to
make these modifications manually since flash-kernel
already performs
these steps as part of the kernel upgrade process. You can obtain a copy
of what's actually written to flash from /var/backups/flash-kernel
.
You can therefore take the files from that location and use them to boot
via TFTP.
mtd1
corresponds to the kernel while mtd2
is the initrd. Therefore,
the correct TFTP commands are:
tftpboot 0x0800000 mtd2 tftpboot 0x400000 mtd1 bootm 0x400000
Installing the original QNAP firmware
You can restore the original QNAP firmware directly from u-boot if you
no longer want to run Debian. First of all, obtain the firmware
image from the QNAP web
site.
Unzip the file and you'll get an .img
file. Save that file as
qnapimg.bin
on your TFTP server.
Now you can write this image to flash. This is exactly what the recovery mode does.
setenv serverip 192.168.0.2 setenv ipaddr 192.168.0.100 tftp 0x400000 qnapimg.bin protect off 0xff000000 0xff6fffff erase 0xff000000 0xff6fffff cp.b 0x400000 0xff000000 0x700000
Afterwards you have to run QNAP Finder to install your system.