[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Making U-Boot + grub-efi-arm(64) the default boot flow for Raspberry Pi hardware?



As part of my work with Kicksecure, I was tasked with seeing what
needed to be involved in making a Debian Raspberry Pi image that boots
using U-Boot and grub-efi-arm64 rather than using direct kernel boot
(which is what the existing Pi images use). I ended up researching the
topic pretty thoroughly, and wrote an extensive guide on how to convert
an existing Trixie RPi image to using this setup on the Raspberry Pi
4B. [1]

Booting in this way has a number of substantial advantages over the way
the Raspberry Pi boot process currently works:

* The kernel command line can be modified by /etc/default/grub and
  files under /etc/default/grub.d. Some software requires or benefits
  from modifications made to the kernel command line, and uses this
  mechanism in GRUB to make non-invasive changes to the command line.
  With direct kernel boot, these changes will be silently ignored,
  while with U-Boot + GRUB, these changes will be correctly used.
* In the event of a bad kernel update, users can trivially boot into
  older kernels like they would on a normal desktop system.
* Recovering from broken boot without a secondary system becomes much
  easier, since users can use the GRUB console and U-Boot console to
  debug issues and boot the system manually.
* Multiboot installations on the Pi become possible.

Kicksecure intends on using this boot method by default, building
Raspberry Pi 4 images with grml-debootstrap [2] and then converting
them to use U-Boot + GRUB in place of direct kernel boot.

Currently the main hurdles we've run into with this way of booting are
due to the raspi-firmware package - it is heavily geared towards
supporting a direct kernel boot scenario, and does not allow the
end-user to directly control the config.txt and cmdline.txt files
(something which is necessary to get U-Boot and GRUB to work properly).
This can most likely be worked around by dpkg-diverting the kernel
configuration file at `/etc/kernel/postinst.d/z50-raspi-firmware`
somewhere else, but this obviously is a hacky workaround and not
something we'd like to rely on long-term unless it's absolutely
necessary.

With all of the above in mind, how likely would it be that U-Boot +
GRUB support for the Raspberry Pi could be upstreamed into Debian,
perhaps even as the default boot flow for the Raspberry Pi 4? We'd be
interested in helping out in this regard if this is something others
here would be interested in having. Obviously, at this point, this
can only be added to Forky and later, but if this is something that is
desirable, we'd like to help out with it sooner rather than later.

Thanks for taking the time to read this :)

[1] https://www.kicksecure.com/wiki/Dev/boot#Booting_Debian_Trixie_with_GRUB_+_u-boot_on_Raspberry_Pi_4
[2] https://github.com/grml/grml-debootstrap/pull/335

--
Aaron

Attachment: pgp8zamgMqrx0.pgp
Description: OpenPGP digital signature


Reply to: