Skip to content

Instantly share code, notes, and snippets.

@braian87b
Last active April 27, 2023 11:46
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save braian87b/b5a4c5f20d1112473c470b096df766a3 to your computer and use it in GitHub Desktop.
Save braian87b/b5a4c5f20d1112473c470b096df766a3 to your computer and use it in GitHub Desktop.
How to Install pure Debian on Iomega EZ Media and Backup Center
# Relevant info about this:
https://forum.lede-project.org/t/lenovo-iomega-ez-media-backup-center/5031/ # "Lenovo Iomega EZ Media & Backup Center"
https://forum.doozan.com/read.php?2,35331,35434#msg-35434 # "Lenovo iomega EZ support" but read entire thread if it is possible
https://forum.doozan.com/read.php?2,15887 # "Debian on Iomega EZ Media & Backup Center" this is another thread about
https://forum.doozan.com/read.php?2,12096 # "Linux Kernel 4.14.1 Kirkwood package and Debian rootfs" Kernel and rootfs, thanks to this it is possible to run Debian
# Newer kernel guide:
https://gist.github.com/koczaj/a20ed52c969a8d0612986ca576067876
# Using a Debian box (it could be a VM) with the harddrive connected (it could be a minimal net-install Debian)
See ip with:
ip addr show
# connect remotely using:
user@outside:~/# ssh user@10.211.55.6
# We elevate permissions or even better install and config sudo
user@debian8vm:~/# su
root@debian8vm:~/# apt-get install sudo -y
root@debian8vm:~/# sudo adduser user sudo
user@debian8vm:~/# exit
root@debian8vm:~/# exit
user@outside:~/# ssh user@10.211.55.6
user@debian8vm:~/# sudo su
# install miscelaneous
root@debian8vm:~/# apt-get install u-boot-tools parted gdisk -y
# Should be already installed
root@debian8vm:~/# apt-get install wget tar -y
# if we want to read the hardware description table file
root@debian8vm:~/# apt-get install device-tree-compiler-y
# we create a directory to work whithin
root@debian8vm:~/# mkdir iomegaez
root@debian8vm:~/# cd iomegaez
# download needed files
# we could use kernel 4.12 or newer one 4.14
root@debian8vm:~/iomegaez/# wget https://www.dropbox.com/s/orud4fq131gtut9/linux-4.12.1-kirkwood-tld-1-bodhi.tar.bz2
root@debian8vm:~/iomegaez/# wget https://www.dropbox.com/s/2gmcik1hu95i316/linux-4.14.1-kirkwood-tld-1-bodhi.tar.bz2
# we download Debian rootfs
root@debian8vm:~/iomegaez/# wget https://www.dropbox.com/s/wsyuzr69se20um2/Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2
# we download the hardware description tables for the Iomega EZ
root@debian8vm:~/iomegaez/# wget https://forum.doozan.com/file.php?2,file=1456,filename=kirkwood-lenovo-iomega-ez.dtb,download=1 -O kirkwood-lenovo-iomega-ez.dtb
# if we want to check it out:
root@debian8vm:~/iomegaez/# fdtdump kirkwood-lenovo-iomega-ez.dtb
# make directories for Kernel and Debian rootfs and uncompress them:
root@debian8vm:~/iomegaez/# mkdir linux-4.14.1-kirkwood-tld-1-bodhi Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi
root@debian8vm:~/iomegaez/# tar -jxvf linux-4.14.1-kirkwood-tld-1-bodhi.tar.bz2 -C linux-4.14.1-kirkwood-tld-1-bodhi
root@debian8vm:~/iomegaez/# tar -jxvf Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 -C Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi
# These are the files:
root@debian8vm:~/iomegaez/# ls -lht ./linux-4.14.1-kirkwood-tld-1-bodhi/
# # total 32M
# # -rw-r--r-- 1 root root 141K Nov 25 19:59 linux-4.14.1-kirkwood-tld-1.patch
# # -rw-r--r-- 1 root root 1.3M Nov 24 02:48 linux-dtb-4.14.1-kirkwood-tld-1.tar
# # -rw-r--r-- 1 root root 8.4M Nov 23 20:56 linux-headers-4.14.1-kirkwood-tld-1_1.0_armel.deb
# # -rw-r--r-- 1 root root 18M Nov 23 20:38 linux-image-4.14.1-kirkwood-tld-1_1.0_armel.deb
# # -rw-r--r-- 1 root root 152K Nov 23 19:41 config-4.14.1-kirkwood-tld-1
# # -rwxr-xr-x 1 root root 3.7M Nov 23 04:40 zImage-4.14.1-kirkwood-tld-1
root@debian8vm:~/iomegaez/# ls -lht ./Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi/boot/
# # total 36M
# # -rw-r--r-- 1 root root 39K Nov 30 03:02 uImage
# # -rw-r--r-- 1 root root 7.0M Nov 30 03:02 uInitrd
# # -rw-r--r-- 1 root root 39K Nov 30 02:58 zImage.fdt
# # -rw-r--r-- 1 root root 64 Nov 30 02:55 uInitrd.bak
# # -rw-r--r-- 1 root root 7.0M Jul 23 21:15 initrd.img-4.12.1-kirkwood-tld-1
# # -rw-r--r-- 1 root root 3.7M Jul 20 05:11 uImage.bak
# # -rw-r--r-- 1 root root 8.1M Jul 16 05:06 linux-headers-4.12.1-kirkwood-tld-1_1.0_armel.deb
# # -rw------- 1 root root 2.4M Jul 16 04:43 System.map-4.12.1-kirkwood-tld-1
# # -rw------- 1 root root 3.7M Jul 16 04:43 vmlinuz-4.12.1-kirkwood-tld-1
# # -rwxr-xr-x 1 root root 3.7M Jul 16 01:42 zImage-4.12.1-kirkwood-tld-1
# # -rw-r--r-- 1 root root 150K Jul 16 00:21 config-4.12.1-kirkwood-tld-1
# # drwxr-xr-x 2 root root 4.0K Jul 15 19:14 dts
# Here there is a hardware descriptor table, but it has some problems, do not use.
root@debian8vm:~/iomegaez/# ls -lht ./Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi/boot/dts/ | grep 'iomega-ez'
# # -rw-r--r-- 1 root root 13K Jul 16 05:08 kirkwood-lenovo-iomega-ez.dtb
# Creating uImage & uInitrd and putting it to the disk
# We will work on boot directory from the rootfs dirtree
root@debian8vm:~/iomegaez/# cd ./Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi/boot/
# we copy the zImage file to a zImage.fdt
root@debian8vm:~/(...)/boot# cp -a zImage-4.12.1-kirkwood-tld-1 zImage.fdt
# if we want to check it out (see the fdt data on the dtb file):
# root@debian8vm:~/iomegaez/# # fdtdump dts/kirkwood-lenovo-ix2-ng.dtb
# Do not use this file, use below instead:
# root@debian8vm:~/(...)/boot# # cat dts/kirkwood-lenovo-ix2-ng.dtb >> zImage.fdt
# Important: We must put dtb data AT THE END of the zImage.fdt file.
root@debian8vm:~/(...)/boot# cat ../../kirkwood-lenovo-iomega-ez.dtb >> zImage.fdt
root@debian8vm:~/(...)/boot# #cp -a uImage uImage.bak
root@debian8vm:~/(...)/boot# #cp -a uInitrd uInitrd.bak
# This are the name of the images, initrd image is the same name as the file we use as source
root@debian8vm:~/(...)/boot# INITRD_IMAGE="initrd.img-4.12.1-kirkwood-tld-1"
root@debian8vm:~/(...)/boot# LINUX_TLD="Linux-4.12.1-kirkwood-tld-1"
# Create initramfs image:
root@debian8vm:~/(...)/boot# mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n $INITRD_IMAGE -d $INITRD_IMAGE uInitrd
# # Image Name: initrd.img-4.12.1-kirkwood-tld-1
# # Created: Thu Nov 30 03:02:50 2017
# # Image Type: ARM Linux RAMDisk Image (gzip compressed)
# # Data Size: 7245632 Bytes = 7075.81 kB = 6.91 MB
# # Load Address: 00000000
# # Entry Point: 00000000
# Create kernel image
root@debian8vm:~/(...)/boot# mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n $LINUX_TLD -d zImage.fdt uImage
## Image Name: Linux-4.12.1-kirkwood-tld-1
## Created: Thu Nov 30 03:02:58 2017
## Image Type: ARM Linux Kernel Image (uncompressed)
## Data Size: 39273 Bytes = 38.35 kB = 0.04 MB
## Load Address: 00008000
## Entry Point: 00008000
# write the images to disk
root@debian8vm:~/iomegaez/# dd if=uImage of=/dev/sdb bs=1MiB seek=10
root@debian8vm:~/iomegaez/# dd if=uInitrd of=/dev/sdb bs=1MiB seek=20
# create partitions on the disk, using GPT since the disk is probably bigger than 2Tb
root@debian8vm:~/iomegaez/# parted -s /dev/sdb mklabel gpt \
mkpart swap linux-swap 100MiB 8.1GiB \
mkpart rootfs ext3 8.1GiB 24.1GiB \
mkpart Data ext3 24.1GiB 100%
# this creates 100Mb unused space, 8gb for swap, 16gb for rootfs and rest of the disk for Data
# Chek out the partitions (we check using gdisk if it is correct swap should be code 82 and other two are 83)
root@debian8vm:~/iomegaez/# parted /dev/sdb print
root@debian8vm:~/iomegaez/# gdisk /dev/sdb -l
# IMPORTANT: don't bother if the virtual machine fails to recognize more than 1.6 or 1.8Tb, we can fix this later.
# we format and set label to 2nd partition
root@debian8vm:~/iomegaez/# mkfs.ext3 /dev/sdb2 -L rootfs
# Create mountpoint and mount partition
root@debian8vm:~/iomegaez/# mkdir /mnt/sdb2 && mount /dev/sdb2 /mnt/sdb2
# Copy the rootfs dirtree to mountpoint
root@debian8vm:~/iomegaez/# tar -C ./Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi/ -cvf - . | tar -C /mnt/sdb2 -xf -
root@debian8vm:~/iomegaez/# sync; sync; sync
# unmount and remove mountpoint
root@debian8vm:~/iomegaez/# umount /mnt/sdb2 && rmdir /mnt/sdb2
# IMPORTANT, if we Forget to set proper label as 'rootfs' the label is has to be on the filesystem
# it is not enough that if it was set as label on the GPT table
root@debian8vm:~/iomegaez/# e2label /dev/sdb2
root@debian8vm:~/iomegaez/# e2label /dev/sdb2 rootfs
root@debian8vm:~/iomegaez/# e2label /dev/sdb2
# Now we can disconnect the harddrive and put in the Iomega EZ box
# We must connect a Serial TTL Cable as described here: https://forum.lede-project.org/t/lenovo-iomega-ez-media-backup-center/5031/13?u=braian87b
# Original bootargs and bootcmd (I copy mine here since we are gonna modify it) :
Marvell>> printenv
# # bootargs=console=ttyS0,115200 root=/dev/ram0 mtdparts=spi_flash:0x7e000@0(u-boot),0x1000@0x7f000(env),0x1000@0x7e000(env2) :::DB88FXX81:eth0:none
# # bootcmd=ide reset; ide read 0x40000 0x800 0x1800; ide read 0x900000 0x2000 0x2000; setenv bootargs $(console) $(bootargs_root) $(bootargs_mtd) $(bootargs_end); bootm 0x40000 0x900000;run bootcmd2
# # bootcmd2=ide dev 1;ide read 0x40000 0x800 0x1800; ide read 0x900000 0x2000 0x2000; bootm 0x40000 0x900000;
# Commands to boot, must be used with a USB-Serial-TTL cable
Marvell>> setenv bootargs 'root=/dev/sda2 init=/bin/systemd fsck.mode=force fsck.repair=yes console=ttyS0,115200 mtdparts=spi_flash:0x7e000@0(u-boot),0x1000@0x7f000(env),0x1000@0x7e000(env2)'
Marvell>> setenv bootcmd 'ide read 0x40000 0x5000 0x2000; ide read 0x2100000 0xA000 0x4000; bootm 0x40000 0x2100000'
# To persist chages to flash chip on the PCB (you could try to boot first to see if everything is working
Marvell>> saveenv
# try to boot (to see if it works)
Marvell>> boot
# Now it must boot properly, check the IP of the box and connect using SSH or continue using serial
# username: root
# password: root
# If the vm didn't recognize all the capacity of the harddrive, now we could fix that easily
# If we run:
root@debian:~# parted /dev/sda print
# Wil say:
# # Warning: Not all of the space available to /dev/sda appears to be used, you can
# # fix the GPT to use all of the space (an extra 8589934592 blocks) or continue
# # with the current setting?
# We put:
Fix
# This will align a little the end of the last partition, now we must resize completely the last partition
root@debian:~# parted -s /dev/sda resizepart 3 100%
# Another way it could be to remove the 3rd partition and create it again, but I do not recommend it, I didn't try it by myself
root@debian:~# parted -s /dev/sda rm 3 mkpart Data ext3 24.1GiB 100%
# now data partition it should fill the rest of the disk
root@debian:~# parted /dev/sda print
# Enable Swap partition
root@debian:~# mkswap /dev/sda1
# # Setting up swapspace version 1, size = 8 GiB (8592445440 bytes)
# # no label, UUID=c37d2e4c-dd32-40e5-9d4a-cea151d02389
root@debian:~# free -h
# # total used free shared buff/cache available
# # Swap: 0B 0B 0B
root@debian:~# swapon /dev/sda1
root@debian:~# free -h
# # total used free shared buff/cache available
# # Swap: 8.0G 0B 8.0G
cat<<'EOF' >> /etc/fstab
/dev/sda1 none swap sw 0 0
EOF
# TODO: try LEDE, try USB boot, apt-get upgrade, LEDS and buttons, auto spindown disk, etc, etc
# ------------------------------------------------------------------------------------------
Special thanks and acknowledgmentto: Ein (thanks for your dedication on this!),
bobafetthotmail for be the first to push me to try, Bodhi, armik, Mijzelf and all the help on the Doozan and Lede-Project Forums
@ziprasidone146939277
Copy link

I connected the adapter to NAS (without any VCC pin to the PCB), i saw a strange behavior; it seems that the NAS it not booting the correct image.

Here is a gist with the boot process: iomega_ez.out

I guess that I done something wrong, but I can realize what.

@ziprasidone146939277
Copy link

Done!

boot.out

The USB-TTL cable came failed; the pins were incorrect inside. (no TX). Once i've got TX (to interrupt boot proccess) i done:

Marvell>> setenv bootcmd 'ide read 0x40000 0x5000 0x2A00; ide read 0x2100000 0xA000 0x5000; bootm 0x40000 0x2100000'
Marvell>> saveenv 
Marvell>> setenv bootargs 'root=/dev/sda2 init=/bin/systemd fsck.mode=force fsck.repair=yes console=ttyS0,115200 
Marvell>> saveenv
Marvell>>boot

The root password is "root".

I attach a picture showing how I connected de PL2303 to NAS board.

IMG_20230424_234411464

@braian87b
Copy link
Author

@ziprasidone146939277

Correct, for TTL you should only connect TX, RX and GND, never connect VCC.

did you wrote the kernel and initramfs images to this two locations on the HD ?

root@debian8vm:~/iomegaez/# dd if=uImage of=/dev/sdb bs=1MiB seek=10
root@debian8vm:~/iomegaez/# dd if=uInitrd of=/dev/sdb bs=1MiB seek=20

or you are trying to boot using USB? for USB you need also to change the boot args. default ones won't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment