Install Debian 10 Buster on Netgear ReadyNAS RN104 (RN102)

V 1.0 2019-08-28 Stefan Katerkamp

This is how I set up Debian 10 Buster on a Netgear ReadyNAS RN104 NAS Hardware.
An ARM Armada-370 based hardware which was sold around 2013-2016 or so.
Power consumption of an idle system with disks in standby mode is about 24 Watt.

Note that this install deletes the original Netgear firmware in NAND.
Reason is that we use the bigger ubifs partition instead of minirootfs for initrd.
This makes life easier as we don’t have to create our own device tree blob.

Connection to U-Boot console is a prerequisite. We
tftp Debian Net Installer into RAM and run it from there.
All needed packages get pulled in via Ethernet from a debian pool server.

Result is a plain vanilla Debian Buster system which will boot kernel and initrd
from built in NAND flash,
and then chroots to /boot and /root on a hard disk in the box. This means,
about 16GB of disk space is used for the system, all other disk space
can be used for payload.

Hardware Preparations

RN104 serial console access is a basic prerequisite. It is accessible behind the
sticker on the upper left corner in the back.
I am using a FTDI FT232RL adapter.
Set the Vccio Jumper to 3.3V. Upper left pin goes to TX,
lower left to GND, and upper right to RX:

to TX
|
o o-- to RX
o o
|
to GND

Finally connect the USB cable to some other computer near it,
and connect to it with your favorite serial interface program like cu, picocom or screen.

cu -s 115200 -l /dev/ttyUSB0

Hint

If screen is garbled and you are using KDE Konsole, reset it with Shift-Ctrl-K.

Connect the RN104 to a LAN with Internet access and DHCP server via an Ethernet cable, use the upper port.

Make sure a fresh hard disk is installed in the ReadyNAS.

Set up TFTP server

Select a system in the LAN which will act as a TFTP server. Note down the IPv4 address
of this server. (Example: 192.168.20.102). Install tftp server:

ip addr
apt install tftpd

Hint

Fix write permissons of the TFTP server data directory for your account
so you don’t need to work as superuser: sudo chown $USER /srv/tftp.

Prepare Debian Installer Images

I had no success booting vmlinuz and initrd.gz directly on my ReadyNAS Firmware V.6.0
using bootz. However, old uImage/uInitrd format works. So we need to convert our
debian installer files into this format.

Adapt boot settings to match increased file sizes.
U-Boot settings have to match the Linux RN104 dtb.
Debian kernel ignores mtdparts command line arg (CONFIG_MTD_CMDLINE_PARTS is not set).
This is used by U-Boot only.

We are going to install kernel and DTB into NAND uImage partition, and initrd into NAND ubifs partition.
Upon boot, we copy the complete uImage area (0x600000 bytes) and just parts of ubifs (0xf00000 bytes) for speed.

Run Debian Installer

Download the installer image and run it.
As no IP address is set but an Ethernet cable exists,
U-Boot sets up an IPv4 connection using DHCP automatically:

tftp uImage_di_rn104
bootm

Now kernel boots and d-i gets started as usual. Use eth0 for the Ethernet port.
Due to little memory in the box d-i guided partitioning creates a quite
small swap partition of just 500MB.
You may want to partition disk manually.

Now all should run fine till the installation is finished.
This may take a while, be patient.

Finally, you’ll see a a red screen. Failing step is: Make the system bootable.