My little ARM board from Olimex :

A20-OLinuXino-LIME2 Rev C. (no NAND, no eMMC)
CPU: Allwinner A20 dual core CORTEX-A7
RAM: 1 Go, eth 1 Gb/s

a20-olinuxino-lime2.jpg

Olimex provides nice ready-to-use Debian images for this board. They even provides howtos for rebuilding these images. But for various reasons I ended up installing instead a pristine Debian Jessie (8.6) on it. Even if this board is supported by Debian, the installation wasn't so easy, since I didn't manage to get the HDMI output to work. After reading the Debian wiki, this was rather expected, and not a big issue for my use of this board (lightweight server). But a blind installation is another story : I lack any suitable serial cable (such as this one), and my attempt at a remote Debian install over ssh failed miserably (bad preseed.cfg ?). In case it might help others, here comes the steps I finally followed for this installation.

Disclaimer

The steps worked for me, but as usual with this kind of tutorial, your mileage may vary. Since we'll install to a micro-SD card (and hence reformat it!), any data on this card will be lost, so be sure to have backups before proceeding. Now, the good news : if something goes wrong it's quite easy to put this SD card on another machine and restore what you want on it (official image, previous backup, etc).

Reference

Prerequisite

  • a micro-SD card of at least 1Gb, with no valuable data on it. Beware! any data on it will be lost during formatting!.
  • a Debian Jessie machine with a SD-card reader. No need for an ARM machine, amd64 or i386 is fine since we'll finalize the debootstrap phase via qemu. Let's call this machine the “host”. Most of the steps below will have to be performed as root.

Steps

  1. On the host machine, we'll need a static version of qemu:
    apt-get install binfmt-support qemu-user-static
  2. On the host machine, insert the SD card, and create two partitions on it, one for /boot (about 100Mb), the other for / (all the remaining space). For instance, here's what fdisk /dev/mmcblk0 tells me after this step:
    Device         Boot  Start      End  Sectors  Size Id Type
    /dev/mmcblk0p1 *      2048   239615   237568  116M 83 Linux
    /dev/mmcblk0p2      239616 15523839 15284224  7,3G 83 Linux
  3. Refresh the partition table and format these new partitions, for instance ext3 for /boot and btrfs for /:
    partprobe /dev/mmcblk0  # cf. the 'parted' package 
    mkfs.ext3 /dev/mmcblk0p1
    mkfs.btrfs /dev/mmcblk0p2
  4. Mount these partitions somewhere on the host. Here, we'll use /mnt and hence /mnt/boot:
    mount /dev/mmcblk0p2 /mnt
    mkdir /mnt/boot
    mount /dev/mmcblk0p1 /mnt/boot
  5. Debootstrap, part 1:
    debootstrap --arch=armhf --foreign jessie /mnt
  6. Debootstrap, part 2, via chroot and qemu:
    cp /usr/bin/qemu-arm-static /mnt/usr/bin
    DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
     LC_ALL=C chroot /mnt /debootstrap/debootstrap --second-stage
    DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
     LC_ALL=C chroot /mnt dpkg --configure -a
  7. Let's add some more packages:
    LC_ALL=C chroot /mnt apt-get install ssh flash-kernel u-boot-tools u-boot-sunxi btrfs-tools
  8. A bit of sysadmin:
    LC_ALL=C chroot /mnt passwd  ##your olimex's root password
    nano /mnt/etc/hostname  ##your olimex's hostname
    mkdir /mnt/root/.ssh
    nano /mnt/root/.ssh/authorized_keys ##some ssh public key allowed to log as root
  9. Edit /mnt/etc/network/interfaces with something like:
    auto eth0
    allow-hotplug eth0
    iface eth0 inet dhcp
    iface eth0 inet6 auto
  10. Edit /mnt/etc/fstab:
    /dev/mmcblk0p2 /     btrfs defaults 0 1
    /dev/mmcblk0p1 /boot ext3  defaults 0 2
    proc /proc proc defaults 0 0
  11. To avoid errors during the final build of the initrd, we need to hack a bit with device nodes:
    mknod /mnt/dev/mmcblk0 b 179 0
    mknod /mnt/dev/mmcblk0p1 b 179 1
    mknod /mnt/dev/mmcblk0p2 b 179 2
  12. Set the machine kind for the flash-kernel tool:
    echo "Olimex A20-OLinuXino-LIME2" > /mnt/etc/flash-kernel/machine
  13. Install the u-boot loader:
    dd if=/mnt/usr/lib/u-boot/A20-OLinuXino-Lime2/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1k seek=8
  14. Install a kernel and populate the boot directory:
    LC_ALL=C chroot /mnt apt-get install linux-image-3.16.0-4-armmp-lpae
  15. Check that the previous step has created files such as /mnt/boot/boot.scr and /mnt/boot/dtb. If not, you can try manually a chroot /mnt flash-kernel.
  16. Unmount /mnt/boot and /mnt, eject your SD-card from the host machine.
  17. Boot your Olimex Lime2 with this SD-card, cross your fingers, locate its IP and try to log via something like ssh root@192.168.X.Y.

Notes / Troubleshooting

  • The Mac address is generated at each boot, you might want to fix it by some startup script.