Skip to content

arenekosreal/raspberrypi4-uefi

Repository files navigation

Files for Booting Raspberry Pi in UEFI mode

LICENCE.WTFPL Auto Build Arch Packages

What is this?

Files needed for booting Raspberry Pi 4 in UEFI mode.

How to use?

PKGBUILD file is designed for Arch Build System (ABS), you can know more about it at there. Here are the steps for using these files correctly:

  • Clone this repository.
  • If you are using Arch Linux or other distributions based on it such as Manjaro, you can run bash start-build.sh command in the root directory of this repo after installed requirements (see start-build.sh for more info), finally, you can find software packages generated by makepkg program at out folder.
    If you are not using Arch Linux, you may have to understand Arch Build System and do the same when the makepkg program is run. You can also use docker, see CI config for more info. CI is running on Ubuntu x86_64 host and you can use it as a reference. Note: final artifacts in out folder is Arch Linux Package, if you want to create package for your distribution, you shouldn't use docker and you should turn to read makepkg files.
  • Choose packages you need to install. Normally, packages provide uefi-raspberrypi4 and raspberrypi-overlays are needed to be installed. You may have to remove uboot-raspberrypi in your original Arch Linux ARM Distribution.
  • Install bootloader. You can choose any bootloader you like such as grub, systemd-boot, rEFInd and so on, please take a look at #NOTE about how to make the bootloader you chose work.
  • Migrate your kernel parameters. They should be in the file /boot/cmdline.txt or /boot/cmdline.txt.pacsave, please add them to your bootloader. The old file is useless after this, you can remove them as you like.

Why not upload to AUR or Arch Linux ARM repository?

UEFI firmware needs root privilege to build on my Arch Distribution. So I think it can't be treated as a valid PKGBUILD because a valid one needs no manual interaction. This problem has been fixed.
UEFI firmware needs gcc10 to build, which is not provided on Arch Linux ARM. This problem will only be solved when pftf upgrade BrotilCompress to newer version which supports GCC 12 or Arch Linux ARM provides gcc10 package. Update: This can be workarounded by using clang as compiler, this is also the default behavior now.
As for other aspects, there should be no issue to upload, I have even set buildarch to meet Arch Linux ARM's requirements.
If you think pacman or other wrapper complains about not found these packages, please add them to IgnorePkg in /etc/pacman.conf

NOTE

  1. Backup your Pi's files or at least backup boot partition. Or you may have to reinstall your original system.
  2. UEFI firmware is experimental, that means maybe some features may not work properly. You can get more infomation at there
  3. Install grub with --removeable flag, or you have to choose boot from /EFI/grub/grubaa64.efi file in UEFI manually when your Pi is powering on. Also you can add a boot entry in UEFI manualy to solve this. For systemd-boot, --no-variables should be OK.
  4. According to kernel documentation, a compressed aarch64 kernel does not have a decompressor, so you have to choose a bootloader which can do the decompression job. GRUB works well on Raspberry Pi 4B even with the compressed vmlinuz kernel.
  5. GRUB may create some useless entries in advanced menu, like booting from vmlinux without initramfs, booting from Image without initramfs and so on, you can remove them as you like, booting from vmlinuz with initramfs works well.

References

UEFI provided by this project. Thanks to pftf and others' contribution, we can use UEFI Firmware in RaspberryPi.
Overlays provided by raspberrypi/firmware.