Sunday, October 5, 2014

Install Debian Jessie with a Debian u-boot and kernel on Cubox-i4pro


I picked up a Cubox-i4pro from solid-run and have been having fun testing out different distributions. I have put together the steps I used to get a Debian Jessie install going. This installation uses a Debian u-boot as well as a Debian kernel. There are many tutorials out there you can follow but I haven't found one yet that outlines how to achieve a pure Debian installation. Follow along, test it out, give me feedback. Here we go....


  • Cubox-i4pro
  • 16gb microsd card, class 10
  • Host system is a Debian derivative
  • Microusb to USB cable for serial connection


  1. Install necessary software in your host linux system.
  2. apt-get install qemu-user-static debootstrap screen
  3. Insert your microsd card into your host linux system.


  1. Find out what your device is. Mine is /dev/sdb. Replace sdX with sdb or whatever your device is.
  2. cat /proc/partitions
  3. Zero out the first few MB of the card to remove any previous U-Boot environment.
  4. dd if=/dev/zero of=/dev/sdX bs=1M count=4
  5. Create one partition and accept the defaults.
  6. fdisk /dev/sdX
  7. Create the filesystem on the partition.
  8. mkfs.ext4 /dev/sdX1
  9. Prep for bootstrap. Flash-kernel by default automatically detects the machine, but since we will be chrooted it cannot autodetect the cubox-i4pro. Flash-kernel will match the machine name to the entry for cubox-i in /usr/share/flash-kernel/db/all.db. This entry identifies the needed kernel type,*.dtb, boot.scr path, bootscr template, and required packages. Flash-kernel will build a correct boot.scr using the template in /usr/share/flash-kernel/bootscript/bootscr.cubox-i. The /usr/share/initramfs-tools/hooks/flash_kernel_set_root script reads /etc/fstab to define root. An error "Warning: root device $rootdev does not exist" will be thrown if the fstab entry doesn't exist
    #  Make a directory to mount your partition.
    mkdir /mnt/tmp
    #  Mount your partition.
    mount /dev/sdX1 /mnt/tmp
    #  Change directory.
    cd /mnt/tmp
    #  Make needed directories for initramfs and flash-kernel.
    mkdir -p etc/{default,flash-kernel}
    #  Define our machine so flash-kernel knows the hardware. 
    echo "SolidRun Cubox-i Dual/Quad" >> etc/flash-kernel/machine
    #  Define our linux kernel command line.
    #  boot.scr will be built with this.
    echo 'LINUX_KERNEL_CMDLINE="root=/dev/mmcblk0p1 rootfstype=ext4 ro rootwait console=ttymxc0,115200 console=tty1"' >> etc/default/flash-kernel
    #  Define root in fstab for initramfs.
    echo '/dev/mmcblk0p1 / ext4 defaults,noatime 0 0' >> etc/fstab
  11. Run bootstrap. It will be a successful installation including flash-kernel and initramfs.
    qemu-debootstrap --foreign  --include=ntp,ntpdate,less,u-boot,u-boot-tools,flash-kernel,linux-image-armmp,kmod,openssh-server,firmware-linux-free,bash-completion,dialog,fake-hwclock,locales --arch=armhf jessie /mnt/tmp
  13. Flash the Debian u-boot SPL and img. Change X to whatever your device is. In my case it was sdb.
  14. dd if=usr/lib/u-boot/mx6_cubox-i/SPL of=/dev/sdX bs=1K seek=1
    dd if=usr/lib/u-boot/mx6_cubox-i/u-boot.img of=/dev/sdX bs=1K seek=42


  1. Set a password for root.
  2. chroot /mnt/tmp passwd root
  3. Allow serial connection
  4. echo 'T0:23:respawn:/sbin/getty -L ttymxc0 115200 vt100' >> /mnt/tmp/etc/inittab
  5. Set hostname
  6. echo "cubox-i4" >> /mnt/tmp/etc/hostname
    nano /mnt/tmp/etc/hosts       localhost  cubox-i4
    ::1             localhost ip6-localhost ip6-loopback
    ff02::1         ip6-allnodes
    ff02::2         ip6-allrouters
  7. Network interfaces - /etc/network/interfaces reads from /etc/network/interfaces.d/
  8. #  Choose either static or dynamic IP entry from below.
    #  For static IP using router and opendns servers
    cat <<eof>> /mnt/tmp/etc/network/interfaces.d/eth0
    auto eth0
    iface eth0 inet static
    #  For dynamic IP
    cat <<eof>> /mnt/tmp/etc/network/interfaces.d/eth0
    auto eth0
    allow-hotplug eth0
    iface eth0 inet dhcp
    #  Loopback interface
    cat <<eof>> /mnt/tmp/etc/network/interfaces.d/lo
    auto lo
    iface lo inet loopback
    #  Manual edit of /etc/resolv.conf is not needed. It is generated by /usr/share/bash-completion/completions/resolvconf
  9. Edit apt sources.list. Comment out the existing line.
  10. nano /mnt/tmp/etc/apt/sources.list
    # deb http://debootstrap.invalid/ jessie main
  11. Paste the following or modify it to your liking and then paste.
  12. deb jessie main contrib non-free
    deb-src jessie main contrib non-free
    deb sid main contrib non-free
    deb-src sid main contrib non-free
    deb experimental main contrib non-free
    deb-src experimental main contrib non-free
  13. Set package priority
  14. cat <<eof>> /mnt/tmp/etc/apt/preferences.d/testing
    Package: *
    Pin: release o=Debian,a=testing
    Pin-Priority: 600
    Package: *
    Pin: release o=Debian,a=unstable
    Pin-Priority: 300
    Package: *
    Pin: release o=Debian,a=experimental
    Pin-Priority: 250
  15. Mount the chroot environment
  16. chroot /mnt/tmp
  17. Update your installation
  18. apt-get update
  19. Exit your chroot environment
  20. exit
  21. Unmount the partition
  22. umount /mnt/tmp


  1. Insert the micro sdcard into the cubox-i4pro.
  2. Connection the microusb-to-usb cable to the cubox-i4pro and then to the host linux system.
  3. Check that usbserial module is loaded. You should see something like: FTDI USB Serial Device converter now attached to ttyUSB0
  4. dmesg | grep ttyUSB
  5. Connect to the cubox-i with screen
  6. screen /dev/ttyUSB0 115200
  7. Power on the cubox-i. You should see output in screen. Hit enter to stop the boot. I get an error:
  8. *** Warning - bad CRC, using default environment
  9. Correct the above error. Type the following and hit enter:
  10. env default -a
  11. Save the environment. Type the following and hit enter:
  12. save
  13. Unplug the cubox-i4pro power and replug it to reboot.



  1. Hello, thank you for this work,
    can you write what is working and what is not?

    1. Absolutely! Is there anything specifically you are referring to that you want me to check? Would you like to provide examples of what you would like me to check?