Skip to content

Instantly share code, notes, and snippets.

@mahiuchun
Created April 24, 2021 04:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahiuchun/ad0ffd75e46d37c35e7e21866eb055ec to your computer and use it in GitHub Desktop.
Save mahiuchun/ad0ffd75e46d37c35e7e21866eb055ec to your computer and use it in GitHub Desktop.
Chroot install Void Linux aarch64 on Raspberry Pi 4

Introduction

There is no Pi 4 image to download from https://voidlinux.org/download/.

Turns out there is (experimental) support of EFI boot for Raspberry Pi 4, meaning we could boot operating systems (including Linux, Windows, etc.) using EFI just like we do on x86 PC. At the same time, mainline Linux support of Raspberry Pi 4 is being constantly improved, the use of Raspberry Pi specfic kernel is not required. Therefore, we can try install Void using EFI boot and generic mainline kernel.

Prerequisite

  • Raspberry Pi 4 board and power supply.
  • USB input devices such as keyboard and mouse.
  • A display device connected to the Pi.
  • Micro SD card suitable for Raspberry Pi.
  • USB storage. Void Linux will be installed here.
  • Wired networking; wireless networking might not work yet.

Steps

  1. Follow https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md to enable USB boot. EEPROM upgrade of the Pi might be part of the process.

  2. Write 64-bit Ubuntu desktop image from https://ubuntu.com/download/raspberry-pi to the SD card. Boot from the SD card. Other aarch64 distro should work too.

  3. Connect and partition the USB storage so that there is a 250M (or bigger) FAT partition. Mark it as ESP (is this necessary?). Download and extract https://github.com/pftf/RPi4 there. Partition the rest of free space according to preference. The simplest scheme would be a single ext4 partition for the rest of the space.

  4. Follow https://docs.voidlinux.org/installation/guides/chroot.html#the-rootfs-method with Void aarch64 rootfs. Mount /boot/efi to the abovementioned FAT partion and change the GRUB install step to:

    (chroot) # xbps-install grub-arm64-efi
    (chroot) # grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id="Void" --no-nvram
    

    The rootfs might not contain a kernel. Install one by xbps-install linux, currently this means 5.11 series will be installed.

  5. Shutdown. Remove the SD card. Power on again and verify that it boots into Void Linux as expected.

  6. Reboot and disable 3 GB RAM limit from the EFI firmware setting. Note that only Linux kernel 5.8+ would work correctly after the limit is disabled.

What I do not know

  • Whether the SD card slot work after boot.
  • Whether WiFi work.
  • Whether Bluetooth work.
  • Whether GPIO work.
  • How to enable 3D acceleration.

Aside

Void packages with nocross=yes (e.g. emacs) are missing from the repository now. Most such packages should build natively without issue.

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