On 2024-10-25, Pascal Hambourg wrote:
> On 24/10/2024 at 22:04, Diederik de Haas wrote:
>> On Thu Oct 24, 2024 at 9:08 PM CEST, Holger Wansing wrote:
>>>
>>> here you have a device|installation, which has the legacy_boot flag
>>> installed, but it did not work|boot despite of this. And you changed that
>>> legacy_boot flag into a boot flag, and that made the problem go away?
>>> (so the device boots fine).
>
> IIUC, it booted successfully after setting the legacy_boot flag on the 
> /boot partition. And it still booted successfully after setting the 
> boot/esp flag and removing the legacy_boot flag.

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...


Mixed feelings about leaving the first 16MB unpartitioned vs. specifying
some partition for it that has some special flag set. Creating a
partition and marking it with MBR boot or legacy_bios_boot might trip up
u-boot if it does not contain the extlinux/boot.scr/efi stuff it is
expecting.


live well,
  vagrant

Attachment: signature.asc
Description: PGP signature

Reply via email to