This repository provides scripts for building an up-to-date Arch Linux ARM rootfs from official sources for Raspberry Pi 4. The build process leverages an OCI container (Docker container) for a clean and isolated environment, and utilizes emulation to execute aarch64 binaries within the chroot during the bootstrapping process.
- Builds a minimal Arch Linux ARM rootfs for Raspberry Pi 4.
- Compatible with BCM2711 C0 stepping.
- Creates two users
root
andalarm
, with their username as passwords (same as official rootfs). - Configures DHCP for automatic network configuration.
- Enables SSH server for remote access.
- Addresses known build issues:
- Fixes untrusted GPG builder key issue with
allow-weak-key-signatures
option in/etc/pacman.d/gnupg/gpg.conf
. - Resolves
mkinitcpio
failure due to unsupportedkms
parameter by removingkms
from/etc/mkinitcpio.conf
.
- Fixes untrusted GPG builder key issue with
- Utilizes official Arch Linux ARM packages for a reliable build.
- Dockerfile simplifies building the containerized build environment even on non-Arch systems.
- Employs qemu-user-static and qemu-user-static-binfmt to execute aarch64 binaries within the chroot environment, enabling building on non-aarch64 platforms.
- Docker installed and running on your system.
- (Optional) Partitioned SD card. You can mount the root SD card partition directly into the container.
-
Clone this Repository:
git clone https://github.com/kleest/alarm-builder-rpi4.git
-
Build the Docker Image:
This creates a Docker image named
alarm-builder
containing the build scripts and tools.cd alarm-builder-rpi4 docker build . -f Dockerfile -t alarm-builder
-
Run the Build Script:
The build script resides within the container image. This command starts the container, executes the script, and mounts the output directory to
/build/chroot
within the container.docker run --rm -it --privileged -v /mnt/tmp-root:/build/chroot alarm-builder
Important Flags:
--privileged
: Grants elevated permissions required for runningpacstrap
andmount
inside the container.-v /mnt/tmp-root:/build/chroot
: Mounts the host directory/mnt/tmp-root
(replace with your desired location) to/build/chroot
within the container. This is the output directory where the rootfs will be generated.
-
Using the Rootfs:
After a successful build, you find the generated rootfs in the mounted directory. If you mounted the SD card root partition into the container, you need to follow the rest of the official instructions on how to copy data from
/boot
to the correct partition. Afterwards you can directly boot the SD card.Important: Do not apply the modifications to
/etc/fstab
that are outlined in the official instructions.
- Refer to the Arch Linux ARM documentation https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4 for details on SD card setup and rootfs installation.