Current-Users archive

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

Re: GENERIC64 aarch64 failure to autoboot



mlelstv%serpens.de@localhost (Michael van Elst) writes:

>On Sun, Mar 05, 2023 at 12:56:29PM +0000, Chavdar Ivanov wrote:
>[   1.3797015] dk0 at sd0: "EFI system", 262144 blocks at 2048, type:
>msdos
>[   1.3897890] dk1 at sd0: "cc8f4a89-edc0-48d1-b9ce-b40d227a4a07",
>> netbsd,gpt-guid         894a8fcc c0edd148 b9ceb40d 227a4a07   .J.....H...."zJ.

>Means, the bootloader passes dk1 as the boot device.
>But the code only checks "ld", "sd" and "wd" devices:


This might help (compile tested only):


Index: sys/arch/evbarm/fdt/fdt_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/fdt/fdt_machdep.c,v
retrieving revision 1.100
diff -p -u -r1.100 fdt_machdep.c
--- sys/arch/evbarm/fdt/fdt_machdep.c	5 Feb 2023 22:42:39 -0000	1.100
+++ sys/arch/evbarm/fdt/fdt_machdep.c	5 Mar 2023 14:55:41 -0000
@@ -743,9 +743,6 @@ fdt_detect_root_device(device_t dev)
 {
 	int error, len;
 
-	if (booted_device)
-		return;
-
 	const int chosen = OF_finddevice("/chosen");
 	if (chosen < 0)
 		return;
@@ -801,7 +798,14 @@ fdt_detect_root_device(device_t dev)
 		const struct uuid *guid =
 		    fdtbus_get_prop(chosen, "netbsd,gpt-guid", &len);
 
-		if (guid != NULL && len == 16)
+		if (guid == NULL || len == 16)
+			return;
+
+		char guidstr[UUID_STR_LEN];
+		uuid_snprintf(guidstr, sizeof(guidstr), guid);
+
+		device_t dv = dkwedge_find_by_wname(guidstr);
+		if (dv != NULL)
 			booted_device = dev;
 
 		return;
@@ -895,8 +899,7 @@ fdt_cpu_rootconf(void)
 		if (device_class(dev) != DV_DISK)
 			continue;
 
-		if (device_is_a(dev, "ld") || device_is_a(dev, "sd") || device_is_a(dev, "wd"))
-			fdt_detect_root_device(dev);
+		fdt_detect_root_device(dev);
 
 		if (booted_device != NULL)
 			break;




Home | Main Index | Thread Index | Old Index