Skip to content

Instantly share code, notes, and snippets.

@kad
Last active March 21, 2025 17:06
Show Gist options
  • Save kad/85a778e0b63fb023defa7887b4521179 to your computer and use it in GitHub Desktop.
Save kad/85a778e0b63fb023defa7887b4521179 to your computer and use it in GitHub Desktop.
Create ArchLinux ARM bootstrap image for RPi
#!/bin/bash
mkdir aarch64
mount --bind aarch64 aarch64
pacstrap -c -K -M aarch64 base archlinuxarm-keyring dhcpcd \
net-tools openssh vi which \
firmware-raspberrypi linux-rpi \
iw ldns less openresolv \
wireless-regdb wireless_tools wpa_supplicant
arch-chroot aarch64 sh -c "systemctl enable systemd-networkd"
arch-chroot aarch64 sh -c "systemctl enable systemd-resolved"
arch-chroot aarch64 sh -c "systemctl enable systemd-timesyncd"
arch-chroot aarch64 sh -c "systemctl enable sshd"
arch-chroot aarch64 sh -c "useradd alarm -G wheel -m"
arch-chroot aarch64 sh -c "echo "root" | passwd -s root"
arch-chroot aarch64 sh -c "echo "alarm" | passwd -s alarm"
arch-chroot aarch64 sh -c "echo "alarm" > /etc/hostname"
rm -rf aarch64/etc/pacman.d/gnupg
rm -rf aarch64/etc/machine-id
umount aarch64
@kad
Copy link
Author

kad commented Jan 7, 2025

Works also with docker images.
e.g.:

# Don't forget to install emulation:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# Create archarm container, run script inside of it:
docker run --privileged --platform=linux/arm64/v8 --rm -it menci/archlinuxarm 

@hkfuertes
Copy link

Awesome gist! I was able to generate the image. Im now trying to user default archlinux docker image with qemu-XXXX-static and archlinuxarm pacman.conf...

On the other side... do you know why I do get wifi with dhcp on pi4 but not on pi3? how can it be fixed? Im using wpa_supplicant

@kad
Copy link
Author

kad commented Mar 21, 2025

it was some bug in the broadcom driver in upstream kernel or broadcom firmware, not sure. on some of my devices I was forced to use workaround:

$ cat /etc/modprobe.d/brcmfmac.conf
options brcmfmac roamoff=1 feature_disable=0x82000

@hkfuertes
Copy link

Wow! Magic! Thank you!!! several days wasted to make wifi work on the pi02w and pi3!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment