summaryrefslogtreecommitdiff
path: root/disk/part_dos.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-03-19 13:49:34 +0100
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-04-30 10:25:07 +0200
commit25801acc1fd64b284d250e8cee7c5ea0c5186f1c (patch)
tree11aa991de56aeb05cf0fea959c97ef6b70b1b7ed /disk/part_dos.c
parent4fe050e65f61cc5e7734aee0637a18ac16b10061 (diff)
part: detect EFI system partition
Up to now for MBR and GPT partitions the info field 'bootable' was set to 1 if either the partition was an EFI system partition or the bootable flag was set. Turn info field 'bootable' into a bit mask with separate bits for bootable and EFI system partition. This will allow us to identify the EFI system partition in the UEFI sub-system. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'disk/part_dos.c')
-rw-r--r--disk/part_dos.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/disk/part_dos.c b/disk/part_dos.c
index 83ff40d310..813379f851 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -45,9 +45,15 @@ static inline int is_extended(int part_type)
part_type == 0x85);
}
-static inline int is_bootable(dos_partition_t *p)
+static int get_bootable(dos_partition_t *p)
{
- return (p->sys_ind == 0xef) || (p->boot_ind == 0x80);
+ int ret = 0;
+
+ if (p->sys_ind == 0xef)
+ ret |= PART_EFI_SYSTEM_PARTITION;
+ if (p->boot_ind == 0x80)
+ ret |= PART_BOOTABLE;
+ return ret;
}
static void print_one_part(dos_partition_t *p, lbaint_t ext_part_sector,
@@ -60,7 +66,7 @@ static void print_one_part(dos_partition_t *p, lbaint_t ext_part_sector,
"u\t%08x-%02x\t%02x%s%s\n",
part_num, lba_start, lba_size, disksig, part_num, p->sys_ind,
(is_extended(p->sys_ind) ? " Extd" : ""),
- (is_bootable(p) ? " Boot" : ""));
+ (get_bootable(p) ? " Boot" : ""));
}
static int test_block_type(unsigned char *buffer)
@@ -258,7 +264,7 @@ static int part_get_info_extended(struct blk_desc *dev_desc,
(char *)info->name);
/* sprintf(info->type, "%d, pt->sys_ind); */
strcpy((char *)info->type, "U-Boot");
- info->bootable = is_bootable(pt);
+ info->bootable = get_bootable(pt);
#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
sprintf(info->uuid, "%08x-%02x", disksig, part_num);
#endif