Alpine on ARM

From Alpine Linux
This material needs wiki syntax or style improvements ...

Please feel free to help us clean it up.

This page is proposed for moving ...

It should be renamed to ARM SOCs. (Discuss)

(Parts of this page are WIP, still incomplete and some might be incorrect.)


Supported SoCs

Alpine gets compiled with support files for so many ARM SoCs that it's best to find out for a particular chipset by further refining (filtering) the search results for DTB files in the Package database.

For example, by refining these search results in the current "edge" release:

For architecure "armhf": https://pkgs.alpinelinux.org/contents?repo=main&file=*.dtb&arch=armhf&branch=edge

For architecture "aarch64": https://pkgs.alpinelinux.org/contents?repo=main&file=*.dtb&arch=aarch64&branch=edge

Installing Alpine on supported SoCs

This provides some generic information, using the "Wandboard" as example. If particular devices happen to require more to successfully install Alpine on them, please consider adding the missing info here.

Get latest Alpine image

Download the last Generic ARM image at: https://alpinelinux.org/downloads/ And extract the archive somewhere.

Prepare SD Card

First install the SoCs particular boot loader(s), e.g. SPL and u-boot.img (this could change for other board), to the sdcard. (Useful hints about generally identifying and accessing your target sdcard device may also be found on https://wiki.alpinelinux.org/wiki/Installation.)

As user root, and from the location of the extracted image files, write the SPL from the extracted Alpine files to the sdcard:

dd if=u-boot/wandboard/SPL of=/dev/sdX seek=1 bs=1k

and the u-boot.img :

dd if=u-boot/wandboard/u-boot.img of=/dev/sdX seek=69 bs=1k

After creating a partition on the sd-card with fdisk, copy the folders apks/, boot/, efi/, extlinux/, and u-boot/ to the sd-card partition. (I'm not sure all folders are useful).

Finally, put the sd-card in the Wandboard and boot it with serial console connected.

The board should now boot from the sd-card. When the prompt asks for a login, you can follow https://wiki.alpinelinux.org/wiki/Installation to setup the alpine system as usual.

Specific guides

Unupported SoCs

If you have an armv6/armv7 SoC which is not listed above but is supported by mainline uboot/kernel then it's still possible to install Alpine


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. We will discuss to install Alpine in a more standard way like x86 with either DOS or GPT partitions. You will most likely have to install/flash the mainline uboot, which can be non-destructive if you use 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.


Partitioning

Either DOS or GPT patitions should work. Start of the first partition should be on block 2048 so there is space for SPL/uboot and marked bootable (with the MBR bootable flag, or GPT legacy_bios_bootable attribute).

  • SPL starts at block 64 (please consult the docs for your board)
  • uboot starts at block 256 (please consult the docs for your board)

Just dd SPL and boot with the correct offset to the media you wish to boot

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


References