Debian installer on i.MX6 boards

Published on July 18, 2013

Archived Notice

This article has been archived and may contain broken links, photos and out-of-date information. If you have any questions, please Contact Us.

We've had a number of customers asking about Debian in recent weeks using instructions from either the ARMhf or eewiki sites.

On each of those sites, the folks are starting with relatively large images though.

One very nice feature of Debian is its' support for a network install, which allows you to build up a system as you identify pieces needed for your application instead of trying to pull an image like our Freescale Ubuntu image apart.

In order to help you bootstrap such a system, we recently walked through the process using our Nitrogen6x board and will detail the steps below.

The starting point

To start with, we took the i.MX5 hardfloat network installer RAM-disk (file uInitrd) from here:

This 5MiB image contains everything needed to install on one of our boards except a kernel and boot script.

Kernel and boot script

Our standard boot script for non-Android use only loads a kernel and points the kernel at a root filesystem using either root=/dev/mmcblk0p1 (SD card boot) or root=/dev/sda1 (SATA).

To load the RAM disk, we had to add another command to load uInitrd, and we configured the console to use one of the display ports instead of the serial port. Since the Debian installer is semi-graphical, it's much easier to navigate with a native display than through serial.

This was enough to boot the installation image, but a short way into the installation we found that the partition editor for the Debian installer wanted the Linux Logical Volume Manager (LVM) kernel component, so we added that.

The installer also whinged about wanting kernel module directories, so we hacked the RAM disk to install an almost empty set.

You can download the network installer package here:

You can unzip it to a single-partition SD card and it will be immediately bootable.

As an alternative, you can also place the uImage and uInitrd on a TFTP server and boot over the network like this (assumes 720P video on HDMI and server IP address 192.168.0.44):

U-Boot > setenv bootargs enable_wait_mode=off U-Boot > setenv bootargs $bootargs video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24 U-Boot > dhcp 10800000 192.168.0.44:uImage U-Boot > tftp 12800000 192.168.0.44:uInitrd U-Boot > bootm 10800000 12800000

With no more than these components, the installer will run to completion with only a few complaints (missing kernel and boot loader, lack of RAID support).

If you simply follow the defaults, the installer will create three partitions:

  • A boot loader partition,
  • A root filesystem partition, and
  • A swap partition

The first was formatted as ext2 and is left empty by the installer, and the second is formatted as ext4 and contains the Debian root filesystem.

Post-installation fixup

If you've followed things to this point, you now have a Debian image with a root filesystem, but an empty boot partition. We'll need to add a boot script, a kernel, and a set of loadable modules to complete the process.

You can use our overlay image to load a kernel on top of this, but the boot script contained in that image expects a single partition system (so root=/dev/mmcblk0p1 or root=/dev/sda1).

We created a boot script with this choice and packaged it with a recent kernel that you can download from here:

If your SD card or SATA partitions are mounted in /media, you can probably copy them in more or less this fashion:

~/Downloads$ tar zxvf debian-overlay-20131114.tar.gz ~/Downloads$ cd debian-overlay ~/Downloads/debian-overlay$ sudo cp -ravf p1/* /media/boot/ ~/Downloads/debian-overlay$ sudo cp -ravf p2/* /media/rootfs

I say more or less because the Debian installer generates UUIDs for the filesystem labels, and the clean /media/boot will be something more like /media/44fa3e18-b095-482a-a8de-85b19e708f7b.

You'll also probably want a login (getty) on the serial console. To add that, you can append a line to /etc/inittab in the root filesystem:

T0:23:respawn:/sbin/getty -L ttymxc1 115200 vt100

Also, don't forget to sync and umount the partitions before removing:

~/Downloads/debian-overlay$ sync && sudo umount /media/*

That should be enough to boot your device into a full-fledged Debian. You'll have access to the package manager and can use it to configure your device from there.

Wrap up and commentary

This post is clearly just an entry point. As mentioned earlier, it was brought on by some customer requests, and part of the exercise was to put us in a better position to test things under Debian.

This isn't a typical use-case for most of our customers because Debian is a native-compilation environment, but especially when used with a SATA drive, Debian has a lot going for it:

  • It's very well supported and stable,
  • A tremendous number of packages are one apt-get away from being runnable. This can be incredibly useful when testing a component for inclusion in another toolset, and
  • Because many packages are difficult to cross-compile, using native compilation first can give insight into how things are supposed to work

We'll follow up this initial post with some additional details about how you can enable the Freescale-specific bits like video and graphics acceleration on Debian in future posts.