Subject: [PATCH 00/15] Rewrite bootloader subsystem.

From: Lilah Tascheter <[email-masked]>
Date: Sat, 3 Aug 2024 22:50:52 -0500

Months in the making! Requires patchset #69343 "Simplify bootloader data
structures and procedures", to be regarded less of a blocker and more of a
conjoined patchset.

This is a massive rewrite to the entire way Guix handles bootloaders. Guix
currently ad-hocs non-GRUB support on top of a layer that was designed for GRUB
and nothing else. Big features enabled by this patchset include:

* Multiple separate bootloaders! This takes over the previous multi-target
  functionality used in RAID systems, as well as the previous abuse of the GRUB
  bootloader on Raspberry Pis when trying to chainload GRUB through EFI provided
  by U-Boot.
* Multiple distinct bootloader targets! Some bootloaders need more than just a
  single target, such as p-boot, which requires both a data target and a
  configuration partition.
* Proper disk image support! Now every bootloader will be able to be dynamically
  installed to disk images, without any special support.
* Support for bootloaders without configuration-file semantics! The install
  process is now much more generalized and no longer assumes bootloaders have a
  configuration file to be installed to a static, unchangable location.
* Proper rollback support! No longer just guesses at a bootloader-configuration
  when doing rollbacks, which prevented significant configuration from being
  done.
* The ability to specify either no bootloader or a bootloader without any
  targets, for situations in which it doesn't make sense (eg qemu images and
  disk images, respectively).
* A more robust target system allowing any bootloader to be able to transform
  the user-specified target into a mount path, device-relative path, device
  file, label, or uuid.

In addition, these changes allow the uki-efi-bootloader to be added, providing
secure boot support and the ability to boot Guix from EFI without another
bootloader intermediary.

This should make adding new types of bootloaders way easier in the future as
well. Especially EFI bootloaders, since the entire EFI install process is now
abstracted away, so specific bootloaders don't have to worry about setting
efivars or the limited ESP space.

The big thing is that this definately needs to be tested. We support lots of
bootloaders for lots of hardware and I definately do not possess any of it.
Please test this and send back the results for me to revise any bugs. I've made
sure as many tests as I could run work, and that GRUB and uefi-uki-bootloader
work both in regular systems and disk images.

Lilah Tascheter (15):
  guix: scripts: Rewrite reinstall-bootloader to use provenance data.
  gnu: Add bootloader target infastructure.
  guix: scripts: Remove unused code.
  gnu: Core bootloader changes.
  gnu: system: Remove useless boot parameters.
  gnu: bootloader: Add raspberry pi bootloader.
  gnu: system: Fix bootloader crypto device recognition.
  gnu: packages: Add pesign.
  gnu: packages: Add ukify.
  gnu: packages: Add systemd-stub.
  gnu: bootloaders: Add uki-efi-bootloader.
  gnu: system: Update examples.
  doc: Update bootloader documentation.
  gnu: tests: Update tests to new targets system.
  teams: Add bootloading team.

 doc/guix.texi                                 |  458 +++---
 etc/teams.scm                                 |   10 +
 gnu/bootloader.scm                            |  644 ++++++---
 gnu/bootloader/depthcharge.scm                |  153 +-
 gnu/bootloader/extlinux.scm                   |  149 +-
 gnu/bootloader/grub.scm                       | 1279 +++++++----------
 gnu/bootloader/u-boot.scm                     |  505 +++----
 gnu/bootloader/uki.scm                        |   96 ++
 gnu/build/bootloader.scm                      |  157 +-
 gnu/build/image.scm                           |   40 +-
 gnu/build/install.scm                         |   16 +-
 gnu/image.scm                                 |    3 +
 gnu/installer/parted.scm                      |   12 +-
 gnu/local.mk                                  |    1 +
 gnu/machine/ssh.scm                           |   71 +-
 gnu/packages/bootloaders.scm                  |  277 ++--
 gnu/packages/efi.scm                          |   47 +
 gnu/packages/raspberry-pi.scm                 |   18 -
 gnu/services/virtualization.scm               |   11 +-
 gnu/system.scm                                |   61 +-
 gnu/system/boot.scm                           |   16 +-
 gnu/system/examples/asus-c201.tmpl            |    6 +-
 gnu/system/examples/bare-bones.tmpl           |    7 +-
 gnu/system/examples/bare-hurd.tmpl            |    4 +-
 gnu/system/examples/beaglebone-black.tmpl     |    6 +-
 gnu/system/examples/desktop.tmpl              |    4 +-
 gnu/system/examples/docker-image.tmpl         |    6 +-
 gnu/system/examples/lightweight-desktop.tmpl  |    4 +-
 gnu/system/examples/plasma.tmpl               |    4 +-
 .../examples/raspberry-pi-64-nfs-root.tmpl    |   23 +-
 gnu/system/examples/raspberry-pi-64.tmpl      |   18 +-
 gnu/system/examples/vm-image.tmpl             |    5 +-
 gnu/system/hurd.scm                           |    4 +-
 gnu/system/image.scm                          |  162 ++-
 gnu/system/images/hurd.scm                    |    4 +-
 gnu/system/images/novena.scm                  |    3 +-
 .../images/orangepi-r1-plus-lts-rk3328.scm    |    3 +-
 gnu/system/images/pine64.scm                  |    3 +-
 gnu/system/images/pinebook-pro.scm            |    3 +-
 gnu/system/images/rock64.scm                  |    3 +-
 gnu/system/images/unmatched.scm               |    3 +-
 gnu/system/images/visionfive2.scm             |    3 +-
 gnu/system/images/wsl2.scm                    |   14 +-
 gnu/system/install.scm                        |   43 +-
 gnu/system/vm.scm                             |   11 -
 gnu/tests.scm                                 |    4 +-
 gnu/tests/ganeti.scm                          |    4 +-
 gnu/tests/image.scm                           |    4 +-
 gnu/tests/install.scm                         |   80 +-
 gnu/tests/nfs.scm                             |    4 +-
 gnu/tests/reconfigure.scm                     |   86 +-
 gnu/tests/telephony.scm                       |    4 +-
 gnu/tests/vnc.scm                             |    4 +-
 guix/scripts/system.scm                       |  161 +--
 guix/scripts/system/reconfigure.scm           |  159 +-
 guix/ui.scm                                   |    8 +
 tests/boot-parameters.scm                     |   16 +-
 57 files changed, 2371 insertions(+), 2533 deletions(-)
 create mode 100644 gnu/bootloader/uki.scm

base-commit: 7d781027c78bdea5fdb3f1c9c9ec432b9606d2b5
-- 
2.45.2