Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3247

Mainline Debian on Iomega ix4-300d (3 replies)

$
0
0
Hi,

I've recently bought a 2nd hand ix4-300d on ebay and decided to run mainline Debian on it. There is not much info on this device on the forum so this post describes the way I configured it and may be useful to others. I don't like writing / changing things on nand so my setup consists of booting Debian from a small SSD and then use the 3 remaining sata slots for RAID 5. That way the SSD can be easily removed and connected to another computer if something goes wrong and the storage drives can be spun down when there is no disk activity.

The initial preparation of the netboot images requires the use of a linux computer or VM. Once that step is done the rest of the install is done through serial.

Useful websites:

https://github.com/benoitm974/ix4-300d/wiki
https://www.hillenius.com/post/installing_debian_jessie_on_a_netgear_readynas_102/
https://blog.kleine-koenig.org/ukl/installing-debian-jessie-on-a-netgear-readynas-104.html

Start with the nas with just an empty SSD plugged in. I used the lower sata slot with number 1 next to it.

Prepare for install:

Download vmlinuz, initrd.gz and dtb files from the Debian website

https://deb.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/netboot/
https://deb.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/device-tree/

Append dtb file to the kernel:

cat vmlinuz armada-xp-lenovo-ix4-300d.dtb > vmlinuz_ix4_300d

Create an uImage with appended init ramdisk:

mkimage -A arm -O linux -T multi -C none -a 0x04000000 -e 0x04000000  -n "Debian armhf installer" -d vmlinuz_ix4_300d:initrd.gz uImage_di_ix4_300d

Copy the file to the tftp server on my OpenWrt router:

scp uImage_di_ix4_300d root@192.168.1.254:/mnt/mmcblk0p1/tftp

Connect serial adapter to the nas and interrupt the boot sequence. Set the ip address of the tftp server:

setenv serverip 192.168.1.254

Check if network connection works:

ping 192.168.1.254

Transfer the Debian installer via tftp:

tftpboot uImage_di_ix4_300d

Boot the Debian installer in RAM:

bootm 0x2000000

The Debian installer should start in the serial console window. Go through the process as shown on screen.
Skipping grub and bootloader results in the following warning:

You will need to boot manually with the /vmlinuz kernel on partition /dev/sda1 and root=/dev/sda2 passed as a kernel argument.

Do not complete the final 'cleanup and reboot' stage of the install but choose to execute a shell instead.

mount --bind /dev /target/dev
mount -t proc none /target/proc
mount -t sysfs none /target/sys
chroot /target /bin/sh
apt-get update
apt-get install flash-kernel

Configure flash-kernel database as follows:

nano /etc/flash-kernel/db

Machine: Lenovo Iomega ix4-300d
Kernel-Flavors: armmp armmp-lpae
DTB-Id: armada-xp-lenovo-ix4-300d.dtb
DTB-Append: yes
U-Boot-Kernel-Address: 0x00008000
U-Boot-Initrd-Address: 0x0
Boot-Kernel-Path: /boot/uImage
Boot-Initrd-Path: /boot/uInitrd
Boot-DTB-Path: /boot/dtb
Required-Packages: u-boot-tools
Bootloader-Sets-Incorrect-Root: no

Generate / update initramfs and kernel:

update-initramfs -u

Set label on the rootfs partition:

e2label /dev/sda2 rootfs

Exit chroot and reboot:

exit
reboot

Interrupt uboot and try to boot using the ssd:

printenv; ide reset; ext2load ide 2:1 0x0040000 uImage; ext2load ide 2:1 0x2000000 uInitrd; setenv bootargs $console $mtdparts root=/dev/sda2 rw rootdelay=10
bootm 0x40000 0x2000000

The boot sequence sometimes struggles to execute the 1st action. A dummy printenv has been added that doesn't do anything useful but allows the sequence to continue successfully if the 1st action fails. This works with the flash-kernel configuration above. Maybe try root=label as well since there is no guarantee that the SSD will always be sda?

Boot test with label:

printenv; ide reset; ext2load ide 2:1 0x0040000 uImage; ext2load ide 2:1 0x2000000 uInitrd; setenv bootargs $console $mtdparts root=LABEL=rootfs rw rootdelay=5; bootm 0x40000 0x2000000

This works fine as well and should be more resilient when multiple disks are present.

Boot into Debian and take a backup of the different mtd partitions using nanddump.There are no changes being done to nand except for the uboot variables but it can't hurt to have a backup (repeat the command below for each of the mtd parts!).

nanddump --noecc --omitoob -f mtd0 /dev/mtd0

Reboot and interrupt the uboot sequence in serial console. Define a new bootdebian environment variable:

setenv bootdebian 'printenv; ide reset; ext2load ide 2:1 0x0040000 uImage; ext2load ide 2:1 0x2000000 uInitrd; setenv bootargs $console $mtdparts root=LABEL=rootfs rw rootdelay=5; bootm 0x40000 0x2000000;'

This is the original bootcmd for reference:

bootcmd=nand read 0x40000 $kernel_start $kernel_size;nand read 0x2000000 $initrd_start $initrd_size;setenv bootargs $console $mtdparts $bootargs_root mem=512M  ramdisk_size=$ramdisk_size ramdisk_blocksize=1024 ip=$bootargs_end $mvNetConfig; bootm 0x40000 0x2000000;

Set a new bootcmd:

setenv bootcmd 'run bootdebian; reset;'

Save the variables and reset:

saveenv
reset

This should result in the NAS booting into Debian on the SSD. Running upgrades works fine and flash-kernel creates the new dtb apended uImage and uInitrd in the boot folder. From here on you can add storage drives and start setting up raid etc.

Known issues: The nas never powers off but always reboots. The original github page says this can be fixed by configuring both ethernet ports but I'm not sure what is needed.

I hope this is useful to someone having the same device. Any feedback or suggestions for improvements are appreciated.

Koen

Viewing all articles
Browse latest Browse all 3247

Trending Articles