1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-12 19:09:56 +03:00

Don't set esp flag for msdos boot partitions

When using an msdos partition table and parted is called to enable the
esp flag on the boot partition, it will disable a previously existing
lba flag on that partition. However, some devices (at least the
Raspberry Pi 3) will not boot without that flag.

Only set that flag if the partition type is gpt.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2632
This commit is contained in:
Marc Lehmann 2025-06-30 10:38:43 +02:00 committed by Oliver Smith
parent eaaa7091ff
commit ec49117cff
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -104,17 +104,16 @@ def partition(layout: PartitionLayout, size_boot: int, size_reserve: int) -> Non
arch = str(pmb.parse.deviceinfo().arch)
commands += [
["mkpart", "primary", mb_root_start, "100%"],
["type", str(layout["root"]), pmb.core.dps.root[arch][1]],
# esp is an alias for boot on GPT
# setting this should be fine for msdos since we set boot later
["set", str(layout["boot"]), "esp", "on"],
["type", str(layout["boot"]), pmb.core.dps.boot["esp"][1]],
]
commands += [["mkpart", "primary", mb_root_start, "100%"]]
if partition_type.lower() == "gpt":
commands += [
["type", str(layout["root"]), pmb.core.dps.root[arch][1]],
# esp is an alias for boot on GPT
["set", str(layout["boot"]), "esp", "on"],
["type", str(layout["boot"]), pmb.core.dps.boot["esp"][1]],
]
# Some devices still use MBR and will not work with only esp set
if partition_type.lower() == "msdos":
elif partition_type.lower() == "msdos":
commands += [["set", str(layout["boot"]), "boot", "on"]]
for command in commands: