diff options
author | Nathan Whitehorn <nwhitehorn@FreeBSD.org> | 2017-12-28 01:21:30 +0000 |
---|---|---|
committer | Nathan Whitehorn <nwhitehorn@FreeBSD.org> | 2017-12-28 01:21:30 +0000 |
commit | 6134b18696cecbb846f6d793f5cb2d665d594dad (patch) | |
tree | 25bb6c905f73dfb47a136d81c316596095f60662 /usr.sbin/bsdinstall/partedit | |
parent | 2cc7a555409557fd54f8caa249daa715aafc93c4 (diff) |
Fix bug introduced in r326674, in which efi boot partitions created by
the installer but not mounted (i.e. with boot1.efifat dd'ed to them
rather than the forthcoming proper filesystem) would get newfs_msdos run
on them immediately after the boot code was copied. This would overwrite
the bootstrap code, causing the EFI system partition to be blanked and
resulting in an unbootable system.
PR: 224562
Notes
Notes:
svn path=/head/; revision=327258
Diffstat (limited to 'usr.sbin/bsdinstall/partedit')
-rw-r--r-- | usr.sbin/bsdinstall/partedit/gpart_ops.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c index e646f3050668..6ceccaf1200e 100644 --- a/usr.sbin/bsdinstall/partedit/gpart_ops.c +++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c @@ -942,7 +942,9 @@ add_boot_partition(struct ggeom *geom, struct gprovider *pp, choice = 0; if (choice == 0) { /* yes */ + struct partition_metadata *md; const char *bootmount = NULL; + char *bootpartname = NULL; char sizestr[7]; humanize_number(sizestr, 7, @@ -950,7 +952,21 @@ add_boot_partition(struct ggeom *geom, struct gprovider *pp, HN_NOSPACE | HN_DECIMAL); gpart_create(pp, bootpart_type(scheme, &bootmount), - sizestr, bootmount, NULL, 0); + sizestr, bootmount, &bootpartname, 0); + + if (bootpartname == NULL) /* Error reported to user already */ + return 0; + + /* If the part is not mountable, make sure newfs isn't set */ + if (bootmount == NULL) { + md = get_part_metadata(bootpartname, 0); + if (md != NULL && md->newfs != NULL) { + free(md->newfs); + md->newfs = NULL; + } + } + + free(bootpartname); return (bootpart_size(scheme)); } |