Booting Alpine Linux on the Raspberry Pi Compute Module

In our project for a client we are using the Raspberry Pi Compute Module, along with a custom compute module carrier board (called the PCCB – Pi Control Carrier Board) which provides RS485, CAN, RS232, LAN, USB and a step-down for input voltages of 6 – 24 V. (If you are interested in customized hardware and Raspberry Pi embedded development, please get in touch. The initial conversation with us will be free for you, and might provide valuable insights and ideas.)

As operating system we decided to use Alpine Linux. Due to it’s read-only, RAM resident nature, it is a perfect fit for an embedded, long-lasting solution which wants to go easy on the Flash memory.

The PCCB offers the possibility to boot from SD card (with the compute module lite), and to boot from the built-in eMMC Flash on the “normal” compute modules.

While booting from SD card works without problems, when trying to boot from eMMC Flash, we initially ran into issues.

As you might know, Alpine Linux (per default) resides entirely on the FAT partition of the SD card.

image

The issue: screen stays black, ACT LED blinks 7 times

With the approach to simply copy the files used on the SD card to the eMMC (using the Raspberry Pi boot tool rpiboot on Windows, to mount the compute modules  eMMC) the compute module did not boot.

It displays a black screen, and the ACT LED blinks seven times, with a pause, then it again blinks seven times.

Consulting this page on elinux.org,  we can see that kernel.img was not found. The Raspberry Pi boot loader is not able to locate the kernel, and therefore unable to boot it.

The screen stays black because splash screens are normally disabled in the config.txt shipped with Alpine Linux (disable_splash=1), otherwise you would get a rainbow screen.

The solution: move the kernel and initramfs to the main folder

Apparently there are differences in the ability of the Raspberry Pi boot loader chain to access files in subfolders for the eMMC flash and the SD card.

The solution therefore is to move the kernel to the toplevel / “root” folder on the eMMC Flash FAT partition. (On Alpine Linux, the kernel is normally in the boot subdirectory):

Edit config.txt to say:

disable_splash=1
boot_delay=0
gpu_mem=64
[pi2]
kernel=vmlinuz-rpi2
initramfs initramfs-rpi2-pi3g
[pi3]
kernel=vmlinuz-rpi2
initramfs initramfs-rpi2-pi3g
[pi3+]
kernel=vmlinuz-rpi2
initramfs initramfs-rpi2-pi3g
[all]
include usercfg.txt

Move the kernel and the initramfs to the top folder on the eMMC Flash:

image

Note: we have created a custom version of the initramfs, to add keys for our custom package(s) which are located in the subfolder pi3g.

There is no need to move the loop filesystem (modloop-rpi2), the System.map-rpi2 or config-rpi2, indeed you would have to change some additional configuration to be able to do that.

After applying these changes, Alpine Linux will boot on the compute module.

We are happy to assist you in building embedded solutions on top of the Raspberry Pi – hardware and software. Please get in touch with us.