summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorallanjude <allanjude@FreeBSD.org>2015-07-15 02:23:55 +0000
committerallanjude <allanjude@FreeBSD.org>2015-07-15 02:23:55 +0000
commit44bd0010827a4824a52b77956e45d2c470574bf5 (patch)
treedcc97e351a3f3f145b33f3281395bb4427230f60 /sys/geom
parentca799427e154d9e2b4bfce1589e225dd762151aa (diff)
downloadFreeBSD-src-44bd0010827a4824a52b77956e45d2c470574bf5.zip
FreeBSD-src-44bd0010827a4824a52b77956e45d2c470574bf5.tar.gz
Add a new option to gpart(8) to fix Lenovo BIOS boot issue
PR: 184910 Reviewed by: ae, wblock Approved by: marcel MFC after: 3 days Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3065
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/part/g_part_gpt.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index 08a3198..922e814 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -1007,6 +1007,7 @@ g_part_gpt_setunset(struct g_part_table *basetable,
{
struct g_part_gpt_entry *entry;
struct g_part_gpt_table *table;
+ struct g_provider *pp;
uint8_t *p;
uint64_t attr;
int i;
@@ -1036,6 +1037,21 @@ g_part_gpt_setunset(struct g_part_table *basetable,
}
}
return (0);
+ } else if (strcasecmp(attrib, "lenovofix") == 0) {
+ /*
+ * Write the 0xee GPT entry to slot #1 (2nd slot) in the pMBR.
+ * This workaround allows Lenovo X220, T420, T520, etc to boot
+ * from GPT Partitions in BIOS mode.
+ */
+
+ if (entry != NULL)
+ return (ENXIO);
+
+ pp = LIST_FIRST(&basetable->gpt_gp->consumer)->provider;
+ bzero(table->mbr + DOSPARTOFF, DOSPARTSIZE * NDOSPART);
+ gpt_write_mbr_entry(table->mbr, ((set) ? 1 : 0), 0xee, 1,
+ MIN(pp->mediasize / pp->sectorsize - 1, UINT32_MAX));
+ return (0);
}
if (entry == NULL)
OpenPOWER on IntegriCloud