-/* $OpenBSD: cmd.c,v 1.164 2022/07/25 17:45:16 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.165 2022/09/11 11:47:55 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
if (gh.gh_sig == GPTSIGNATURE) {
for (i = 0; i < gh.gh_part_num; i++) {
if (i == pn)
- gp[i].gp_attrs = GPTDOSACTIVE;
+ gp[i].gp_attrs = GPTPARTATTR_BOOTABLE;
else
gp[i].gp_attrs = 0;
}
-/* $OpenBSD: gpt.c,v 1.80 2022/08/29 19:39:10 krw Exp $ */
+/* $OpenBSD: gpt.c,v 1.81 2022/09/11 11:47:55 krw Exp $ */
/*
* Copyright (c) 2015 Markus Muller <mmu@grummel.net>
* Copyright (c) 2015 Kenneth R Westerback <krw@openbsd.org>
const struct unit_type *ut;
char *guidstr = NULL;
double size;
- uint64_t end, start;
+ uint64_t attrs, end, start;
uint32_t status;
start = gp[pn].gp_lba_start;
end = gp[pn].gp_lba_end;
size = units_size(units, (start > end) ? 0 : end - start + 1, &ut);
- printf("%c%3u: %-36s [%12lld: %12.0f%s]\n",
- gp[pn].gp_attrs & GPTDOSACTIVE ? '*' : ' ', pn,
+ printf(" %3u: %-36s [%12lld: %12.0f%s]\n", pn,
PRT_uuid_to_sname(&gp[pn].gp_type), start, size, ut->ut_abbr);
if (verbosity == VERBOSE) {
printf(" %-36s ", guidstr);
printf("%-36s\n", name_to_string(pn));
free(guidstr);
+ attrs = gp[pn].gp_attrs;
+ if (attrs) {
+ printf(" Attributes: (0x%016llx) ", attrs);
+ if (attrs & GPTPARTATTR_REQUIRED)
+ printf("Required " );
+ if (attrs & GPTPARTATTR_IGNORE)
+ printf("Ignore ");
+ if (attrs & GPTPARTATTR_BOOTABLE)
+ printf("Bootable");
+ printf("\n");
+ }
}
if (start > end)
memset(&gp, 0, sizeof(gp));
else {
for (pn = 0; pn < gh.gh_part_num; pn++) {
- if (PRT_protected_guid(&gp[pn].gp_type))
+ if (PRT_protected_guid(&gp[pn].gp_type) ||
+ (gp[pn].gp_attrs & GPTPARTATTR_REQUIRED))
continue;
memset(&gp[pn], 0, sizeof(gp[pn]));
}
-/* $OpenBSD: subr_disk.c,v 1.260 2022/09/03 15:29:43 kettenis Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.261 2022/09/11 11:47:55 krw Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
partoff = DL_SECTOBLK(lp, lbastart);
obsdfound = 0;
for (i = 0; i < partnum; i++) {
+ if (letoh64(gp[i].gp_attrs) & GPTPARTATTR_REQUIRED) {
+ DPRINTF("spoofgpt: Skipping partition %u (REQUIRED)\n");
+ continue;
+ }
+
start = letoh64(gp[i].gp_lba_start);
if (start > lbaend || start < lbastart)
continue;
-/* $OpenBSD: disklabel.h,v 1.80 2022/09/06 14:14:44 krw Exp $ */
+/* $OpenBSD: disklabel.h,v 1.81 2022/09/11 11:47:55 krw Exp $ */
/* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */
/*
/* ASCII string "EFI PART" encoded as 64-bit */
#define GPTREVISION 0x10000 /* GPT header version 1.0 */
#define NGPTPARTITIONS 128
+#define GPTPARTATTR_REQUIRED (1 << 0)
+#define GPTPARTATTR_IGNORE (1 << 1)
+#define GPTPARTATTR_BOOTABLE (1 << 2)
#define GPTDOSACTIVE 0x2
#define GPTMINHDRSIZE 92
#define GPTMINPARTSIZE 128