How to Get ALARM working on a CuBox-i4 Pro

This forum is for supported devices using an ARMv7 Freescale SoC.

How to Get ALARM working on a CuBox-i4 Pro

Postby necopinus » Sun Apr 17, 2016 8:57 pm

I'm writing this up because other ALARM users may find it useful and in hopes that Google will index it so anyone who's not on the forums who find themselves having similar problems will find a nice, working, installation walk-through. It's possible that the instructions below are now no longer necessary, but I found that they were the only way of getting a bootable CuBox-i4 Pro system as of the 2016-04-09 filesystem image.

I recently purchased a CuBox-i4 Pro from Solid Run. Unfortunately, running through the installation instructions on the ALARM CuBox-i page resulted in an unbootable system: The CuBox complains about not being able to find /uEnv.txt, /zImage, and a few other (alternate) boot files, and finally falls back to trying to boot using TFTP over the network. Solid Run's Ignition Installer didn't work either, complaining that any microSD card I used was "unreadable". The make-sdcard script mentioned in Solid Run's Arch Linux wiki page got me a bit further - the CuBox at least found the kernel - but left me with a system that died with a kernel panic immediately upon boot.

If you've experienced any of the above though, don't panic! You can still use ALARM with your CuBox. Here's how I got a bootable, fully-functional system up on mine.

$this->bbcode_list('1')
  • Begin by zeroing out the first few MB of your microSD card using another system.

    $this->bbcode_second_pass_code('', '
    dd if=/dev/zero of=/dev/sdX bs=1M count=4
    ')
  • Now, fire up fdisk on that system (I'm going to call the card is called sdX from here on out).

    $this->bbcode_second_pass_code('', '
    fdisk /dev/sdX
    ')
    Create two new partitions. The first should have an offset of 2048 and be of type c (WIN FAT32 LBA). It doesn't need to be that big - 32MB is more than enough. The second partition can cover the remainder of the microSD card, and should use the "normal" Linux filesystem type (83).

  • Now you'll need to format the two partitions. The first will be /boot, and must be FAT-formatted. The second will be your root (/) filesystem; unfortunately, I found that using a journaled filesystem here resulted in corruption on either the first or second boot (normally the first), so you'll need to format it ext2 instead of ext4 as ALARM's documentation suggests.

    $this->bbcode_second_pass_code('', '
    mkfs.vfat -n BOOT /dev/sdX1
    mkfs.ext2 -L root /dev/sdX2
    ')
  • Now, create a temporary directory, mount sdX2 on it, and then create a boot directory within this and mount sdX1 there.

    $this->bbcode_second_pass_code('', '
    mkdir root
    mount /dev/sdX2 root
    mkdir root/boot
    mount /dev/sdX1 root/boot
    ')
  • You can now download the latest ALARM filesystem image for the CuBox-i and extract it into the root directory you just prepped.

    $this->bbcode_second_pass_code('', '
    curl --location --remote-name http://os.archlinuxarm.org/os/ArchLinuxARM-imx6-cubox-latest.tar.gz
    bsdtar -xpf ArchLinuxARM-imx6-cubox-latest.tar.gz -C root
    ')
  • You're not quite done yet though! ALARM's default uEnv.txt file tells the kernel to expect the root filesystem on the first partition (/dev/mmcblk0p1), but that's now just the contents of /boot! So fire up your favorite text editor, open up root/boot/uEnv.txt, and change the reference to /dev/mmcblk0p1 to /dev/mmcblk0p2. I also found it useful to bump up the console resolution from 720p (1280x720) to full HD (1920x1080), but that's not strictly necessary.

    $this->bbcode_second_pass_code('', '
    vim root/boot/uEnv.txt
    ')
    It's also a good idea to make sure that /dev/mmcblk0p1 is always mounted on /boot so that when you upgrade your kernel everything winds up in the right place (otherwise when you reboot you'll wind up using your old kernel, rather than the update pacman downloads for you). You can do this by editing root/etc/fstab and adding a line to mount /dev/mmcblk0p1 on /boot.

    $this->bbcode_second_pass_code('', '
    vim root/etc/fstab
    ')
    If you're not familiar with what /etc/fstab should look like, I suggest taking a look at the Arch Linux wiki's `fstab` page so you know what to do here.

  • Now you can pretty much follow the rest of the ALARM installation guide; write root/boot/SPL and root/boot/u-boot.img to the first few sectors of the microSD card, sync everything to make sure that your changes are flushed out to disk, and then unmount and clean up everything!

    $this->bbcode_second_pass_code('', '
    dd if=root/boot/SPL of=/dev/sdX bs=1K seek=1
    dd if=root/boot/u-boot.img of=/dev/sdX bs=1K seek=42

    sync
    umount root/boot
    umount root
    rm -f root
    ')
  • That's it! Just pop your microSD card into the CuBox, plug in a network cable and power (or alternately, attach an HDMI monitor and keyboard), and enjoy your new system! The default user is alarm (with password alarm), and the root password is root; you should probably update both of these passwords right away, and then run pacman -Syu (as root) to make sure everything is up-to-date.
  • necopinus
     
    Posts: 5
    Joined: Tue Oct 30, 2012 11:15 pm

    Return to Freescale

    Who is online

    Users browsing this forum: No registered users and 10 guests