diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-03-04 19:59:06 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-05 16:28:05 +0100 |
commit | 35c1e544eb11146dd9d872392a1bd928daebcb0c (patch) | |
tree | f2f64f48633402ad6b12e50cbd97eabd1c702fe0 /common/partitions/dos.c | |
parent | 3401bb2165854b7e625d8919cab42ce12ffe4990 (diff) | |
download | barebox-35c1e544eb11146dd9d872392a1bd928daebcb0c.tar.gz barebox-35c1e544eb11146dd9d872392a1bd928daebcb0c.tar.xz |
partitions: have parsers record bootable bits
barebox as EFI loader can use the information about which partitions are
bootable to guide its decision. Record this information.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240304190038.3486881-22-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/partitions/dos.c')
-rw-r--r-- | common/partitions/dos.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/partitions/dos.c b/common/partitions/dos.c index 1b0051f978..8e4edd885b 100644 --- a/common/partitions/dos.c +++ b/common/partitions/dos.c @@ -189,6 +189,15 @@ out: return; } +static void extract_flags(const struct partition_entry *p, + struct partition *pentry) +{ + if (p->boot_indicator == 0x80) + pentry->flags |= DEVFS_PARTITION_BOOTABLE_LEGACY; + if (p->type == 0xef) + pentry->flags |= DEVFS_PARTITION_BOOTABLE_ESP; +} + /** * Check if a DOS like partition describes this block device * @param blk Block device to register to @@ -237,6 +246,7 @@ static struct partition_desc *dos_partition(void *buf, struct block_device *blk) pentry->first_sec = first_sec; pentry->size = get_unaligned_le32(&table[i].partition_size); pentry->dos_partition_type = table[i].type; + extract_flags(&table[i], pentry); pentry->num = i; sprintf(pentry->partuuid, "%08x-%02d", signature, i + 1); |