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

2 Likes