(Forwarding the relevant part of this reply from bug#1078871 to bug#1086051)

On 26/10/2024 at 02:35, Vagrant Cascadian wrote:

I think there are several things that u-boot treats as bootable ...

https://source.denx.de/u-boot/u-boot/-/blob/3fbc657669591ca893613f14d42e07069b7d56cd/doc/develop/distro.rst?plain=1#L38-62

  Distros simply need to install the boot configuration files (see next
  section) in an ext2/3/4 or FAT partition, mark the partition bootable (via
  the MBR bootable flag, or GPT legacy_bios_bootable attribute), and U-Boot (or
  any other bootloader) will find those boot files and execute them. This is
  conceptually identical to creating a grub2 configuration file on a desktop
  PC.

  Note that in the absence of any partition that is explicitly marked bootable,
  U-Boot falls back to searching the first valid partition of a disk for boot
  configuration files. Other bootloaders are recommended to do the same, since
  I believe that partition table bootable flags aren't so commonly used outside
  the realm of x86 PCs.

So this is both relevent if using u-boot to using various boot methods,
such as extlinux.conf style configuration produced by u-boot-menu or
boot.scr produced by flash-kernel... but also it might be relevent if
you are using u-boot as your EFI implementation to load grub-efi.

I am not entirely sure the above documentation is exhaustive; I seem to
recall u-boot also treating the ESP/EFI partition as bootable, but that
may be because various other flags get set at the same time... though I
have used ESP/EFI partitions as /boot with u-boot before without any EFI
implementation.

A very cursory search of u-boot source code did not reveal any
additional ways u-boot might treat a partition as "bootable", though the
documentation I quoted from is kind of the old style "distro" boot
vs. the newer "bootstd" which I am less familiar with...

Unless I am missing something, things seem to be quite simple to me:
- EFI boot -> set the ESP type (partman "efi" method, parted 'esp' flag) to the EFI partition (already done); - non-EFI boot -> set the "legacy BIOS bootable" attribute on GPT (parted 'legacy_boot' flag) or the "boot" flag on DOS/MBR (partman "bootable" specifier, parted 'boot' flag).

Now how do we make partman manage the 'legacy_boot' flag in recipes and manual partitioning ? See proposals in previous mails.

Reply via email to