Raspberry Pi 4 : Manjaro on UEFI firmware with “Generic” ARM kernel

I’ve been able to convert my Raspberry Pi 4 Manjaro KDE installation to a full UEFI boot with grub, and run it with a Manjaro Generic 6.0.9-2-MANJARO-ARM (linux60) kernel.

So far everything seems to be working perfectly, so wouldn’t it be nice to have a Manjaro image for Raspberry Pi 4 prebuilt with an UEFI firmware that could use the generic kernel ?

I’m actually typing this on it :wink:

Here is how to proceed to get it working.

You will need either another ARM machine running Manjaro (I did it on my Pinebook Pro) or to duplicate your Raspberry Pi working SD card using i.e clonezilla, to work on the card which is not currently running your OS.

The SD card can keep its original MBR partition table, it is not necessary to convert it to GPT.

1/ Insert the SD Card that you want to convert on a running Manjaro ARM System

2/ Use a tool such as KDE partitions manager, or gparted, to create an empty 32 MB FAT 16 “SYSTEM” partition at the beginning of the SD card. Move or shrink other partitions as need be.

3/ The original /boot will the be on 2nd position on the SD Card.

4/ Remove the “boot” flag from the original /boot partition, and add it to the freshly created “SYSTEM” partition.

5/ Sort the partitions so that they are in the same order as their on-disk layout. You may use fdisk for this.

6/ Get the Raspberry Pi 4 UEFI firmware from Releases · pftf/RPi4 · GitHub

7/ Uncompress the zip file into the new system partition.

8/ Prepare to chroot into your Raspberry Pi OS :

  • Mount the SD card root FS, i.e.

mount /dev/mmcblk2p3 /mnt
(Adapt according to the actual partition name on your machine)

mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys

chroot /mnt

You are now virtually inside your Raspberry Pi Manjaro OS

9/ Mount all filesystems

mount -a

10/ Check with ls that /boot is mounted and contains the expected usual Pi files

11/ Create a mountpoint for efi

mkdir /boot/efi

12/ Edit /etc/fstab and create and entry for mounting the efi partition, i.e.:

UUID=A123-B456 /boot/efi vfat noexec,nodev,noatime 0 2

13/ Mount it

mount /boot/efi

Check with ls that it contains the UEFI FW files that we have previouly decompressed there.

14/ Edit config.txt found in /boot/efi as see fit

I added this to mine, I’m altough not sure whether this is necessary (but I hav a tricky hi-res TV for a monitor…)

gpu_mem=128
dtparam=audio=on
hdmi_group=1
hdmi_mode=16
enable_gic=1
hdmi_drive=2
arm_boost=1
arm_freq=1800

15/ Create a directory under which grub EFI will install

mkdir /boot/efi/EFI

16/ We will need a working DNS server in resolv.conf, so…

echo “nameserver 8.8.8.8” >> /etc/resolv.conf

17/ Now install needed packages

pacman -S efibootmgr boot-generic-efi grub grub-btrfs generic-efi-post-install

18/ Install grub

❯ grub-install
Installation pour la plate-forme arm64-efi.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
grub-install : erreur : efibootmgr n’a pas réussi à enregistrer l’entrée de démarrage: Aucun fichier ou dossier de ce type.

Don’t care about the efibootmgr error for now.

19/ Edit your /etc/default grub to reflect the boot parameters you have in your existing /boot/cmdline.txt file, as see fit, i.e. on mine (using BTRFS on LUKS):

GRUB_CMDLINE_LINUX=“rootflags=subvol=@,noatime,commit=60 rootwait console=tty1 selinux=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop cgroup_enable=memory cgroup_memory=1”
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash plymouth.enable=1 plymouth.ignore-serial-consoles usbhid.mousepoll=9 audit=0”

20/ Now we get to install the needed kernel(s) :

Pacman will want to remove the existing specific Raspberry Pi kernel, and that’s OK.

❯ pacman -S linux519 linux519-headers linux60 linux60-headers
résolution des dépendances…
recherche des conflits entre paquets…
:: linux519 et linux-rpi4 sont en conflit (linux). Supprimer linux-rpi4 ? [o/N] o
:: linux519-headers et linux-rpi4-headers sont en conflit (linux-headers). Supprimer linux-rpi4-headers ? [o/N] o

We’re about done !

21/ Umount everything

cd /
umount -a
umount /sys
umount /proc

22/ Exit chroot

exit

23/ Umount SD card root fs

umount /mnt

24/ BOOT OUR RASPBERRY PI using the SD Card !

We should see a neat UEFI boot screen.

25/ Press Esc to enter its setup

We should get a fine “UEFI-BIOS” setup utility

26/ Get in device manager, Raspberry Pi configuration, Advanced configuration, and set things per attached picture:

  • Don’t limit RAM to 3 GB
  • System table selection : ACPI + DeviceTree

Don’t forget to save with F10

27/ Exit this and go to “Boot Maintenance Manager”

  • Boot options :
  • Add a boot option for your grub (Find it into SYSTEM/EFI…)
  • Change boot order to get it first
  • Save, exit and Reset the machine.

Now the UEFI firmware should fire up your grub and the Manjaro !

You can adapt the timeouts both into the UEFI boot manager and grub to your liking.

The only thing I found is that grub loads the kernel and initramfs very slowly.

After that, the system just works as expected.

Pi4_UEFI_config_221023a
Pi4_UEFI_config_221023b

4 Likes

Nice stuff !! :clap:

Do you have new informations to share with us ?
On my side, I have some questions:

  • How the kernel update is managed with all the tools ? Are all the tools ok to enable a new one automatically ? Are you able to have more than 1 kernel in the menu to go back ?
  • Have you find any bugs since your installation ?
  • Did you test on a USB stick ?(because I try to avoid SD card to be honest)

Hi,
Replies to your questions :

  • I have no new information, as I did it for fun / testing purpose and have reverted back to “standard” boot since - for the only reason that grub would take forever to load the kernel and initramfs, so boot time was dreadfully slow (but system behaviour mostly OK afterwards).
  • When you have the standard kernel and grub, you can install several different kernels using pacman or pamac.
  • Grub even allows booting from BTRFS snapshots if your FS is BTRFS and you use Timeshift and have grub-btrfs installed.
  • You can’t use Manjaro Settings (as on Intel) for this only because the Manjaro ARM team has for now disabled kernel management from this tool - only because most ARM devices currently do not use standard booting mechanisms and kernels.
  • Not much bugs except for the absence of a working text console, probably having to do with the video settings, I guess this could be easily fixed.
  • I used an SD card, but I guess USB would do as well, provided your Pi has firmware recent enough to allow USB boot.

I have tested other operating systems on rpi4, fedora 37 for example, and it took a little bit longer but not “forever” to boot. And it was from a usb dirve.

Yes, that’s a solution but I would prefer have kernel choice as we can have with X86. For me, it’s a bit overkill if you jsut want to test a new kernel for instance. And Btrfs, which is not really supported for now on ARM (even if works). And to be fair, it’s a great solution to manage updates in general.

I may have a look later (winter holidays) to that configuration and keep you posted if you’re interested.

I hear you on the fun part :grin:

Part of the EFI specfification is the reliance on GPT - so not only did you manage to boot a PI using EFI you also managed to do it without GPT.

That is quite an achievement …

1 Like

BTRFS is perfectly suported on ARM, I’ve been using several Raspberry Pi “microservers” with filesystems on f2fs or BTRFS for years without an issue…

Yes, you’re right, I should have said “not really promoted by Manjaro ARM team for now”.

1 Like

Fortunately, for I just can’t live without BTRFS :wink:

1 Like