Dual booting OpenWRT and Debian on an iConnect

I’ve now got both OpenWRT and Debian wheezy installed and working on my iConnect however they both expect to be the only OS installed on the iConnect so the u-boot config needs a bit of tweaking to have them both installed and bootable.

I have OpenWRT installed completely on the internal flash as OpenWRT is setup for that and it’s only 32MB taken up, Debian I have installed on a usb flash drive but the kernel and initrd are stored on the internal flash after OpenWRT’s rootfs.

I have divided the the 512M of NAND flash in my iConnect like this:

1M u-boot loader with config stored @0xc000
3M of OpenWRT kernel
32M of OpenWRT root filesystem
5M of Debian kernel
20M of Debian initfs
425M of Data (currently unused)

First of all we need to make sure that u-boot, OpenWRT and Debian have the same view of the flash in the iConnect:

setenv mtdparts 'mtdparts=orion_nand:1M(u-boot),3M@1M(kernel),32M@4M(rootfs),5M@36M(debian-uimage),20M@41M(debian-initrd),425M@86M(data)'

Tell u-boot to use the mtdparts we have just defined:

setenv mtdids 'nand0=orion_nand'

We want the same console settings for all of the OS’s so lets define it once:

setenv bootargs_console 'console=ttyS0,115200'

Set the boot command and rootfs UUID for Debian

setenv debian_root 'root=UUID=8f9f89f2-5bc2-4ba2-9a8f-6d92cf5c46af ro rootdelay=10'
setenv debian_bootcmd 'nand read 0x800000 debian-uimage; nand read 0x1100000 debian-initrd'

Because I’m using an OpenWRT u-boot the OpenWRT boot commands are already defined as x_ commands, but if you didn’t the commands to setup OpenWRT booting are

setenv openwrt_root 'root=/dev/mtdblock2 rw rootfstype=jffs2'
setenv openwrt_bootcmd 'nand read 0x6400000 0x100000 0x300000'

To switch to booting Debian you need to set the machine id to something that Debian works with, update the bootcmd and then save and reset.

setenv machid 692
setenv bootcmd 'setenv bootargs $(bootargs_console) $(mtdparts) $(debian_root); run debian_bootcmd; bootm 0x00800000 0x01100000; reset'

To switch to booting OpenWRT you need to clear machine id, update the bootcmd and then save and reset.

setenv machid
setenv bootcmd 'run openwrt_bootcmd; setenv bootargs $(mtdparts) $(bootargs_console) $(openwrt_root); bootm 0x6400000; reset'

Linux on the iomega iConnect – Part III – Installing OpenWRT

OpenWRT is an entire build system designed to produce flexible linux system images for embedded devices with full package and configuration management, there is a version of it for the Kirkwood SoC included in the Iomage iConnect.

My install method installs OpenWRT to the NAND of the iConnect and completely overwrites the original firmware, the method does need a basic working network with a tftp server as well as a serial console on your iConnect.

It’s easier to update uboot on the iConnect to the latest version that is built as part of OpenWRT, however this isn’t 100% necessary as you can change the arcNumber, boot flags and NAND layout in uboot to match what the OpenWRT kernel expects. I have updated my iConnect’s uboot to the latest version from OpenWRT so I’ve included the instructions here.

The files you will need to download and put on your tftp server to install the latest snapshot version of uboot and OpenWRT on the iConnect are:

First things first, backup your uboot binary and environment settings, I used nandread from the original Linux install on the iConnect to backup uboot and just cut and pasted the output of printenv into a text file to backup the environment.

The main environment variable you will need to make sure you have a note of it the mac address of the ethernet chip, you can get this from the uboot command line with the command:

printenv ethaddr

Once you have got your backups sorted you can install the new uboot with the following commands in the uboot shell, if any of the early stages fail do not erase the NAND otherwise the iConnect will not boot.

setenv serverip # IP of your TFTP server
setenv ipaddr # IP of your iConnect
mw 0x0800000 0xffff 0x60000                             
tftpboot 0x0800000 openwrt-kirkwood-iconnect-u-boot.kwb
nand erase 0x0 0x60000                                  
nand write 0x0800000 0x0 0x60000                        

You should hopefully now see a fresh new uboot prompt which has a very minimal environment, you will need to set your original ethernet address you have saved as well as your network details.

setenv ethaddr <my saved ethernet address>
setenv serverip # IP of your TFTP server
setenv ipaddr # IP of your iConnect

Once the iConnect has restarted with the original ethernet address you will need to install the OpenWRT kernel on the NAND

mw 0x6400000 0xffff 0x300000                
tftp 0x6400000 openwrt-kirkwood-uImage
nand erase 0x100000 0x400000
nand write.e 0x6400000 0x100000 0x400000

and finally flash the OpenWRT root filesystem

mw 0x6400000 0xffff 0x200000
tftp 0x6400000 openwrt-kirkwood-generic-jffs2-nand-2048-128k.img
nand erase 0x500000 0xfb00000
nand write.e 0x6400000 0x500000 0x200000

Once this has finished type


You should now see the OpenWRT kernel booting and starting the first boot setup on your iConnect.

Linux on the iomega iConnect – Part II – Installing Debian

Update – Changed link to point to archive.org

There is already really good documentation about installing Debian on the iConnect from http://doip.org/iconnect and http://www.kroonen.eu/wiki, so this isn’t going to be in depth more just my own notes.

Connect the iConnect up to a gigabit switch (has to be a gigabit switch due to kernel bugs), connect a serial port, and get into uboot.

Setup your boot sources, you can use a memory stick or tftp.

TFTP – This assumes that you have a working tftp server and know how to put files on it.

# Choose IPs that are correct for your network
setenv serverip
setenv ipaddr

# Load the installer kernel and initrd into the iConnect's RAM
tftpboot 0x01100000 iconnect/wheezy/uInitrd
tftpboot 0x00800000 iconnect/wheezy/uImage

USB – this assumes a fat formated memory stick

# Start the USB subsystem up
usb start

# Load debian installer - usb
fatload usb 0:1 0x01100000 wheezy/uInitrd
fatload usb 0:1 0x00800000 wheezy/uImage

Once you have loaded the kernel and initrd into RAM the actually boot process is the same

# Set the command line up
setenv bootargs console=ttyS0,115200n8 base-installer/initramfs-tools/driver-policy=most

# Boot the installer
bootm 0x00800000 0x01100000

After a bit of waiting and downloading you will end up with the normal Debian installer, you can install to the memory stick you booted off or anything else connected to the USB ports.

Once you have finished the kernel will fail to install properly, here are a couple of choices now either rearrange the NAND partitions and install the kernel there or modify the boot setup in uboot to boot off USB but I’ll cover booting in a later post.


Linux on the iomega iConnect – Part I

The iConnect is a small cheap and very hackable ARM NAS, the device is based on the Kirkwood SoC platform.

Hardware highlights are

  • 4 USB ports (on a hub so bandwidth limited)
  • Single mini PCI express port with a Ralink based wireless card included (this can be replaced by something such as an Atheros based card)
  • Gigabit ethernet
  • ARMv5 CPU running at 1Ghz, with 256MB of RAM and 512MB of NAND flash
  • Serial port easily accessible for a serial console
  • Decent version of uboot that supports tftp, nand and usb booting and includes drivers for ext2 and fat filesystems.

I got mine intending to use it for backups but I’ve basically spent a week playing with it learning uboot as well as Linux on ARM as well as booting a number of different versions of linux on.

So far I’ve managed to boot Archlinux, Debian and Fedora on the iConnect and they all work but Debian and Fedora don’t have kernels with the iConnect patches in from the main repos so need a patched kernel to get some of the little extras working.

I’ve now settled on Debian wheezy installed on a 8gig usb memory stick as the best bet for the board, and I will need to spend some time setting up the backups up.