Installing Void Linux aarch64 on a Raspberry Pi4

Void distributes multiple images for various Raspberry Pi boards, but none of them work out of the box on a Pi4. This is (probably) because of numerous hardware changes from rpi3 to rpi4, including a new SoC and some accompanying chips.

TL;DR - the Void armv8 kernel is somehow broken compared to the official one distributed in the rpi-firmware GH repo. The fix is to manually download one from the repo and replace it on the /boot partition on the SD card.

Step-by-step installation guide

  1. Download the rpi3 image (void-rpi3-*.img.xz) from the void mirror.
    You could, in theory, get the rpi2 one if you'd need a 32-bit distro for.. whatever reason, but I don't recommend it.

  2. Unpack the XZ file xz -d void-rpi3-*.img.xz
  3. Write the image to the SD card dd if=void-rpi3-*.img of=/dev/XXX bs=4M status=progress Make sure that your "of" device points to the SD card, not to any of your internal HDs ;p

  4. After dd finishes writing the image, mount the first partition mount /dev/XXX1 /mnt/wrk
  5. Remove all files with a name starting with "kernel". This is because the pi may try to boot other kernels first, and we don't want that rm /mnt/wrk/kernel*
  6. Download the correct kernel from here curl "https://github.com/Hexxeh/rpi-firmware/blob/master/kernel8.img?raw=true" -o /mnt/wrk/kernel8.img
  7. Umount the partition, sync writes to card, boot the pi umount /mnt/wrk sync
  8. After booting the pi, remove /dev/mmcblk0p1 from /etc/fstab, umount /boot and run `xbps-install -Syu`.
    This is to make sure that you have the latest kernel modules installed, and that the OS won't overwrite the good kernel on update.

When updating your system in the future, make sure to manually mount /boot and download a new kernel from the rpi-firmware repo each time you update the linux package with xbps. While running different kernel and module versions may usually work well, if the update gap becomes too big, you may experience random problems ranging from kernel modules that don't want to load, all the way to kernel panics.


Comments: