Alpine on ARM
Alpine Linux supports ARM architecture, a family of reduced instruction set computing (RISC) architectures for computer processors. ARM is the most widely used processor architecture in the world, powering most smartphones and millions of the simplest IoT devices to sophisticated machine learning applications.
Supported SoCs
Alpine Linux is compiled with support files for so many formidable SoCs — besides the Raspberry Pi — that to find out about a particular chipset's support it can be useful to refine the search for all *.dtb
files in the package database (i.e. filter for "*<some-board-or-SoC-identifying-string>*.dtb
" file).
For example, by refining the following search in the current "edge" release:
DTB-files in the current edge branch: https://pkgs.alpinelinux.org/contents?repo=main&file=*.dtb&branch=edge
Fully supported boards are those for which there is a working bootloader shipped in the download.
Preparing installation media
There are no ISO installation images for ARM, since different boards require slightly different builds of u-boot. Hence, preparation steps are a bit more involved than x86_64.
The latest images are available on the Alpine Linux downloads page.
For Raspberry Pi boards, use images specific for your board. In case the download page provides no specific image for your particular board, download the "Generic ARM" image. armv7 is the most compatible and aarch64 is the best choice for modern ARM SoCs.
Formating the sd card
To install Alpine, an SD card is required, and it will be completely wiped while preparing it for use as installation media.
Insert the SD card onto the host where you've downloaded the Alpine tarball and find out its devices name with dmesg
or fdisk -l
.
Create a partition in the SD card. The usual choice is to use doas fdisk /dev/sdX
. Care must be taken when creating the partition; it should never overlap with the u-boot (which will be set up in the following step). It is recommended to use start: 32768
as a safe choice when creating the partition. Make sure that the partition is also marked as bootable.
It is also recommended to use FAT32, since ext4 is sometimes problematic with GRUB2, so set the partition type to W95 FAT32 (LBA)
.
Once the partition has been created, it needs to be formatted. Use, for example: mkfs.vfat /dev/sdX1
Copying installation files onto the sd card
Now extract the downloaded tarball into the SD card:
doas mount /dev/sdX1 /mnt cd /mnt doas tar -xf $HOME/downloads/alpine-uboot-3.18.2-aarch64.tar.gz
Installing u-boot onto the SD card
Finally, u-boot needs to be installed into the SD card. The exact steps vary per board. The following example installs u-boot for a pinebook-pro:
# Copy the U-Boot TPL/SPL doas dd if=u-boot/pinebook-pro-rk3399/idbloader.img of=/dev/sdb bs=512 seek=64 conv=notrunc # Copy u-boot.itb itself doas dd if=u-boot/pinebook-pro-rk3399/u-boot.itb of=/dev/sdb bs=512 seek=16384 conv=notrunc
For rk3399-based boards, these steps should be quite similar. Other boards are an exercise left to the reader.
Installing Alpine
Insert the SD card into the ARM board, and turn it on. At this point, you should continue the general installation process as described in the Installation#Installation Step Details.
Board-specific notes for supported boards
Raspberry Pi
List of all Raspberry related Articles.
Wandboard
Follow the steps above on Preparing installation media. To install u-boot into the SD card, use:
dd if=u-boot/wandboard/SPL of=/dev/sdX seek=1 bs=1k dd if=u-boot/wandboard/u-boot.img of=/dev/sdX seek=69 bs=1k
Finally, put the SD card in the Wandboard and boot it with a serial console connected. The board should now boot from the SD card.
Pine64 A64 LTS
Use the "Generic ARM aarch64" image. Install u-boot using:
dd if=u-boot-sunxi-with-spl.bin of=/dev/SDX bs=1024 seek=8
Decompress (gunzip
) the kernel image (boot/vmlinuz-lts
) as the device's u-boot can't boot from a compressed kernel
Libre Computer "Le Potato"
For this system to boot at all, it must have an SD card with the bootloader in sector 1. This can't coexist with a GPT partition table. You will have to prepare the SD card manually from another machine:
- Use e.g.
fdisk
to create an MBR (DOS) disklabel. Leave at least 1 MB before the start of the first partition. Create one partition of type EFI and at least one of type Linux. For example:
Device Boot Start End Sectors Size Id Type /dev/sdc1 * 2048 1050623 1048576 512M ef EFI (FAT-12/16/32) /dev/sdc2 1050624 9005055 7954432 3.8G 82 Linux swap / Solaris /dev/sdc3 9005056 122136575 113131520 53.9G 83 Linux
- Find bootloader binaries here: Libre Computer
- Copy to SD card:
sudo dd if=aml-s905x-cc of=/dev/sdTARGET bs=512 seek=1
- With this SD card in the Potato, it should now be possible to boot a (separate) USB stick containing any of the aarch64 ISO images. The rest of the steps should be done from the Potato:
- Format the partitions (device names will have changed):
mkfs.ext4 /dev/mmcblk1p3 mkfs.vfat /dev/mmcblk1p1
- Mount the partitions:
mount /dev/mmcblk1p3 /mnt mount /dev/mmcblk1p1 /mnt/boot
- Use
setup-disk /mnt
rather thansetup-alpine
, to avoid rewriting the disklabel and damaging the bootloader.
More specific guides
- DIY Fully working Alpine Linux for Allwinner and Other ARM SOCs
- Odroid-C2
- NanoPi Neo build script
- A20 OLinuXino Lime2
Installing Alpine on boards without full support
![]() Please feel free to help us clean it up. |
If you have, for example, an armv6/armv7 board that is not fully supported, but whose SoC is already supported by the mainline kernel and uboot, then it's still possible to install Alpine. It may involve a couple more manual steps.
Requirements
- Alpine's forked uboot to support tarballs (fabled?)
- serial console
- crosscompiler/toolchain if you can not compile natively
The embedded world
A lot of the SoCs have their own way of doing things, although they use uboot and Linux kernel but often they are heavily modified to suit easy flashing of "ROMs" or other unknown reasons, e.g. Rockchip's notion "partition" are neither DOS nor GPT partitions. Here, we will try to install Alpine in a more standard way, like on the x86 platform, with either DOS or GPT partitions. To boot this, you will most likely have to install/flash the mainline uboot, which can be non-destructive if you can load it from external storage.
Storage
One can load uboot from the following block devices if it's supported.
- NAND
- eMMC
- SD card
- USB
Power on
Some SoCs need both SPL and uboot, you need to check uboot for your board. Most (if not all) boards boots from the internal storage first (either NAND or eMMC) you will have to check documentation of your board if you wish to boot the SPL/uboot from SD/USB.
One can view SPL+uboot as BIOS and boot-loader on PC. Think that you could put the BIOS on an external storage :D
Once you have loaded the "standard" uboot, things are more or less like on x86.
Booting Linux kernel
- uboot uses extlinux.conf file to locate the kernel/initramfs/... just like syslinx, you need to put that file on the partitions which is marked bootable in the /boot directory
- there should be an extra line "FDTDIR" which points to the DTBs
e.g.
label Fedora (3.17.0-0.rc4.git2.1.fc22.armv7hl) 22 (Rawhide) kernel /boot/vmlinuz-3.17.0-0.rc4.git2.1.fc22.armv7hl append ro root=UUID=8eac677f-8ea8-4270-8479-d5ddbb797450 console=ttyS0,115200n8 LANG=en_US.UTF-8 drm.debug=0xf fdtdir /boot/dtb-3.17.0-0.rc4.git2.1.fc22.armv7hl initrd /boot/initramfs-3.17.0-0.rc4.git2.1.fc22.armv7hl.img
Using QEMU
qemu-system-arm -M vexpress-a9 -kernel zImage -initrd initramfs-grsec -dtb vexpress-v2p-ca9.dtb -hda hda.img -serial stdio