u-boot-brain/disk
Andre Przywara eefa0a647d EFI: find EFI system partition by legacy MBR partition type
The UEFI spec allows an EFI system partition (ESP, with the bootloader or
kernel EFI apps on it) to reside on a disk using a "legacy" MBR
partitioning scheme.
But in contrast to actual legacy disks the ESP is not marked as
"bootable" using bit 7 in byte 0 of the legacy partition entry, but is
instead using partition *type* 0xef (in contrast to 0x0b or 0x0c for a
normal FAT partition). The EFI spec isn't 100% clear on this, but it even
seems to discourage the use of the bootable flag for ESPs.
Also it seems that some EFI implementations (EDK2?) even seem to ignore
partitions marked as bootable (probably since they believe they contain
legacy boot code).
The Debian installer [1] (*not* mini.iso), for instance, contains such an
MBR, where none of the two partitions are marked bootable, but the ESP
has clearly type 0xef.
Now U-Boot cannot find the ESP on such a disk (USB flash drive) and
fails to load the EFI grub and thus the installer.

Since it all boils down to the distro bootcmds eventually calling
"part list -bootable" to find potential boot partitions, it seems logical
to just add this "partition type is 0xef" condition to the is_bootable()
implementation.

This allows the bog standard arm64 Debian-testing installer to boot from
an USB pen drive on Allwinner A64 boards (Pine64, BananaPi-M64).
(Ubuntu and other distribution installers don't have a legacy MBR, so
U-Boot falls back to El Torito there).

[1] https://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/arm64/iso-cd/
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-09-18 23:53:56 +02:00
..
Kconfig SPARC: Remove 2017-04-05 13:52:20 -04:00
Makefile disk: convert CONFIG_EFI_PARTITION to Kconfig 2017-01-28 08:47:42 -05:00
part_amiga.c env: Rename getenv/_f() to env_get() 2017-08-16 08:30:24 -04:00
part_amiga.h disk: convert CONFIG_ISO_PARTITION to Kconfig 2017-01-28 08:47:35 -05:00
part_dos.c EFI: find EFI system partition by legacy MBR partition type 2017-09-18 23:53:56 +02:00
part_dos.h Coding Style cleanup: remove trailing white space 2013-10-14 16:06:53 -04:00
part_efi.c part: efi: Disable overlap check 2017-09-03 11:04:51 -04:00
part_iso.c disk: part: align buffer so it can be used with DMA enabled drivers 2017-08-26 14:56:15 -04:00
part_iso.h iso: Make little endian and 64bit safe 2016-04-18 17:11:33 -04:00
part_mac.c part: mac: Suppress the error message after reading ddb 2017-09-07 10:44:33 -04:00
part_mac.h disk: convert CONFIG_ISO_PARTITION to Kconfig 2017-01-28 08:47:35 -05:00
part.c fs: add fs_readdir() 2017-09-15 09:03:11 -04:00