On 20/10/2024 at 16:28, Diederik de Haas wrote:
AFAIUI, UEFI requires GPT, but GPT does not require UEFI.
No, UEFI does not require GPT, at least not on my amd64 machines
(including QEMU+OVMF). It also supports booting on MSDOS.
And as it happens to be the case, I have one device which actually does
use UEFI (I think; and GRUB) and another one which doesn't.
(...)
The 'cs21' device is a (different) Rock64 (rk3328):
```
root@cs21:~# parted -s /dev/mmcblk1 print
Model: MMC NCard (sd/mmc)
Disk /dev/mmcblk1: 61.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 32.8kB 16.8MB 16.7MB primary
2 16.8MB 256MB 239MB fat16 primary boot, esp
3 256MB 61.9GB 61.6GB ext4 primary
root@cs21:~# lsblk -o +PARTFLAGS,FSTYPE /dev/mmcblk1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS PARTFLAGS FSTYPE
mmcblk1 179:0 0 57.6G 0 disk
├─mmcblk1p1 179:1 0 16M 0 part
├─mmcblk1p2 179:2 0 228M 0 part /boot/efi vfat
└─mmcblk1p3 179:3 0 57.4G 0 part / ext4
```
Partition 2 looks like a regular EFI partition mounted on /boot/efi as
expected by GRUB. With a size of 239MB it should be FAT32 instead of
FAT16, but maybe the UEFI firmware expects only FAT16 or does not care.
No legacy_boot flag on any partition.
And 'quartz64a' is a Pine64 Quartz64 Model A (rk3566):
```
root@quartz64a:~# parted -s /dev/mmcblk1 print
Model: MMC A3A562 (sd/mmc)
Disk /dev/mmcblk1: 124GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 32.8kB 3670kB 3637kB loader1_part
2 8389kB 12.6MB 4194kB loader2_part
3 12.6MB 16.8MB 4194kB trust_part
4 16.8MB 134MB 117MB efi_part
5 134MB 124GB 124GB ext4 root_part legacy_boot
root@quartz64a:~# lsblk -o +PARTFLAGS,FSTYPE /dev/mmcblk1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS PARTFLAGS FSTYPE
mmcblk1 179:0 0 115.2G 0 disk
├─mmcblk1p1 179:1 0 3.5M 0 part
├─mmcblk1p2 179:2 0 4M 0 part
├─mmcblk1p3 179:3 0 4M 0 part
├─mmcblk1p4 179:4 0 112M 0 part
└─mmcblk1p5 179:5 0 115.1G 0 part / 0x4 ext4
```
Partitions 1-3 cover the first 16MiB, like cs21's partition 1 does.
Partition 4 has the name 'efi_part' but it does not have the 'esp' flag
and parted does not detect any filesystem, so I guess it is just empty
and unused too. The root partition has the 'legacy_boot' flag like the
Rock64 with which you did your test.
And I just changed the 'legacy_boot' flag to 'boot' on the SDcard with
which I did my test, which then (apparently) also triggers the 'esp'
flag and it booted with that too.
On GPT, parted 'boot' flag has the same meaning as 'esp' and both
represent the 'EFI System Partition' type GUID. 'legacy_boot' is a real
flag in a bit field.
So it looks like it just needs some indication (flag) of what the boot
device is, but it doesn't (seem to) matter which one.
Weird. Does it have to be on the boot/root partition or can it be on any
other partition ?
Note: partman allows to create EFI partitions only when the installer
was booted in EFI mode. I would like to change this, at least on
EFI-capable architectures such as x86 or ARM.