Skip to content

Instantly share code, notes, and snippets.

@nnathan
Last active August 15, 2024 03:18
Show Gist options
  • Save nnathan/1ab33fd4b7518b1ba97a28e99fcbe2cd to your computer and use it in GitHub Desktop.
Save nnathan/1ab33fd4b7518b1ba97a28e99fcbe2cd to your computer and use it in GitHub Desktop.

As of 2024-08-05 the installation instructions to install Arch Linux ARM on pi 4 doesn't work.

This is my version, with the added bonus of using bcachefs instead of ext4 so you can get data checksumming, subvolumes, and compression.

Arch Linux ARM (aarch64) installation for Raspberry Pi 4 with bcacehfs

  1. Start cfdisk to partition the drive: cfdisk /dev/sdX.
  2. Create a dos partition table (my understanding is gpt doesn't work at this time).
  3. Press New, Partition Size 512M, press primary, and set type to c W95 FAT32 (LBA).
  4. Select "Free Space", and press New, use the suggested size which is remainder of space, press primary, and type should already be set to Linux.
  5. Press Write and confirm the prompt.
  6. Create and mount the FAT filesystem:
mkfs.vfat /dev/sdX1
mkdir /mnt/sdcard-boot
mount /dev/sdX1 /mnt/sdcard-boot
  1. Create and mount the bcachefs filesystem (you will need bcachefs-tools):
bcachefs format --compression=zstd /dev/sdX2
mkdir /mnt/sdcard-root
mount /dev/sdX2 /mnt/sdcard-root
  1. Download and extract the root filesystem (as root, not via sudo):
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
bsdtar -C /mnt/sdcard-root -vxpf ArchLinuxARM-rpi-aarch64-latest.tar.gz
sync
  1. Chroot into the filesystem and update to get the latest kernel which supports bcachefs
mount --bind /dev /mnt/sdcard-root/dev
mount --bind /sys /mnt/sdcard-root/sys
mount --bind /proc /mnt/sdcard-root/proc
mount --bind /run /mnt/sdcard-root/run
chroot /mnt/sdcard-root
pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu
exit
umount /mnt/sdcard-root/{dev,run,sys,proc}
  1. Patch the bootloader (this deviates from the instructions); you will need uboot-tools -- see last post in this forum post and also this post
(nano/vim/whatever) /mnt/sdcard-root/boot/boot.txt   # find the `booti` lines and change `${fdt_addr_r}` to `${fdt_addr}`
( cd /mnt/sdcard-root/boot; mkimage -A arm -T script -O linux -d boot.txt boot.scr; )
  1. Move boot files to the first partition:
mv /mnt/sdcard-root/boot/* /mnt/sdcard-boot/
sync
  1. Unmount the two partitions:
umount /mnt/sdcard-root /mnt/sdcard-boot
  1. Insert the SD card into the Raspberry Pi, connect ethernet, and apply 5V power.
  2. Use the serial console or SSH to the IP address given to the board by your router.
  • Login as the default user alarm with the password alarm.
  • The default root password is root.

Note: we ignore the instruction from the official Arch install of changing mmcblk0 to mmcblk1.

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