Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: No uefi install in VM



On Thu, Dec 12, 2019 at 08:41:15AM +0100, Martin Husemann wrote:
> Yes, it is. I took a bootable UEFI installation (in VirtualBox) and replaced
> the efi/boot/*.efi files on the MSDOS/EFI partition with the ones from
> the latest netbsd-9 build and it stopped booting as you describe.

I have a fix for that. Sorry for the delay it took to investigate, 
but 9.0_RC1 EFI boot crashes in qemu for other reason  (panic in 
cpu_svs_init -> pagezero), so it was not easy to reproduce.

This bugs is caused by the lack of labels on GPT partitions created
by sysinst. The consequence is that bootstrap cannot make the 
difference between EFI and FFS partition, and it looks for the
kernel on the first partition that matches "NAME=", which is 
EFI. A workaround is to drop to boot prompt and run boot hd0b:

The attached patch fixes the bug by avoid using NAME= when there
is no label. Once applied, rebuild src/sts/arch/i386/stand and
install updated bootstrap.

-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost
Index: sys/arch/i386/stand/efiboot/efidisk.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/efiboot/efidisk.c,v
retrieving revision 1.8
diff -U4 -r1.8 efidisk.c
--- sys/arch/i386/stand/efiboot/efidisk.c	18 Aug 2019 02:18:24 -0000	1.8
+++ sys/arch/i386/stand/efiboot/efidisk.c	16 Dec 2019 08:49:24 -0000
@@ -252,9 +252,9 @@
 			if (first) {
 				printf(" ");
 				first = false;
 			}
-			if (part[i].part_name != NULL)
+			if (part[i].part_name && part[i].part_name[0])
 				printf(" NAME=%s(", part[i].part_name);
 			else
 				printf(" hd%d%c(", edi->dev & 0x7f, i + 'a');
 			if (part[i].guid != NULL)
@@ -307,9 +307,9 @@
 			if (first) {
 				printf(" ");
 				first = 0;
 			}
-			if (part[j].part_name != NULL)
+			if (part[j].part_name && part[j].part_name[0])
 				printf(" NAME=%s(", part[j].part_name);
 			else
 				printf(" raid%d%c(",
 				       raidframe[i].last_unit, j + 'a');
Index: sys/arch/i386/stand/lib/biosdisk.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/biosdisk.c,v
retrieving revision 1.53
diff -U4 -r1.53 biosdisk.c
--- sys/arch/i386/stand/lib/biosdisk.c	10 Dec 2019 02:02:47 -0000	1.53
+++ sys/arch/i386/stand/lib/biosdisk.c	16 Dec 2019 08:49:24 -0000
@@ -907,9 +907,10 @@
 				printf(" ");
 				first = 0;
 			}
 #ifndef NO_GPT
-			if (d->part[part].part_name != NULL)
+			if (d->part[part].part_name &&
+			    d->part[part].part_name[0])
 				printf(" NAME=%s(", d->part[part].part_name);
 			else
 #endif
 				printf(" hd%d%c(", d->ll.dev & 0x7f, part + 'a');
@@ -986,9 +987,10 @@
 				printf(" ");
 				first = 0;
 			}
 #ifndef NO_GPT
-			if (d->part[part].part_name != NULL)
+			if (d->part[part].part_name &&
+			    d->part[part].part_name[0])
 				printf(" NAME=%s(", d->part[part].part_name);
 			else
 #endif
 				printf(" raid%d%c(", raidframe[i].last_unit,
@@ -1094,9 +1096,11 @@
 			boot_part = 0;
 
 		*partition = boot_part;
 #ifndef NO_GPT
-		if (part_name && d->part[boot_part].part_name) {
+		if (part_name &&
+		    d->part[boot_part].part_name &&
+		    d->part[boot_part].part_name[0]) {
 			strlcpy(namebuf, d->part[boot_part].part_name,
 				BIOSDISK_PART_NAME_LEN);
 			*part_name = namebuf;
 		}


Home | Main Index | Thread Index | Old Index