Using U-Boot on the QNAP TS-410, TS-410U, TS-412, TS-419P, TS-419P+, TS-419P II, TS-419U, TS-420 and TS-421
If you have a serial console for your QNAP device, you can use U-Boot, the boot loader used on the TS-41x/TS-42x, to restore the original QNAP firmware or load images via the network.
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 9 MB in size.
setenv bootargs console=ttyS0,115200n8 root=/dev/ram rw initrd=0xa00000,0x8fffff
Finally, load the image via the network with TFTP and start it:
tftpboot 0xa00000 initrd tftpboot 0x800000 kernel bootm 0x800000
If you'd like to load a kernel image you saved from
/boot, please see the instructions on how to prepare the image below.
If you copy your Debian kernel and ramdisk from
/boot to another machine for backup, you can load them via TFTP as described above after making some small modifications to the kernel and ramdisk images.
You have to make two modifications to the kernel. First, you have to set the machine ID of your QNAP device by prepending a few bytes to the kernel image. This can easily be done with the
devio command in Debian. Second, you have to generate a U-Boot image from the kernel image. Let's take the
2.6.32-5 kernel as an example:
tmp=$(tempfile) devio > $tmp 'wl 0xe3a01c09,4' 'wl 0xe38110c6,4' # TS-41x cat /boot/vmlinuz-2.6.32-5-kirkwood >> $tmp mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -d $tmp vmlinuz-2.6.32-5-kirkwood.uboot
Next, you have to pad the initrd image so it will be exactly 9 MB:
dd if=/boot/initrd.img-2.6.32-5-kirkwood of=initrd.img-2.6.32-5-kirkwood.padded ibs=9437184 conv=sync
initrd.img-2.6.32-5-kirkwood.padded to your TFTP server and load them in memory as described above.