On Sun, 5 Mar 2023 at 15:01, Michael van Elst <mlel...@serpens.de> wrote:
>
> mlel...@serpens.de (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):


It didn't, unfortunately. Copy/paste from the mail message didn't work
as a patch, I guess the usual tabs vs. spaces, so I applied it
manually and rebuilt, getting the same:
....
[   1.7028470] sd0: fabricating a geometry
[   1.7028470] sd0: 47694 MB, 47694 cyl, 64 head, 32 sec, 512
bytes/sect x 97677312 sectors
[   1.7228509] sd0: fabricating a geometry
[   1.7329004] dk0 at sd0: "EFI system", 262144 blocks at 2048, type: msdos
[   1.7429382] dk1 at sd0: "cc8f4a89-edc0-48d1-b9ce-b40d227a4a07",
97411072 blocks at 264192, type: ffs
[   1.7629942] sd0: async, 8-bit transfers, tagged queueing
[   2.1331596] uhidev0 at uhub1 port 1 configuration 1 interface 0
[   2.1432296] uhidev0: QEMU (0x0627) QEMU USB Keyboard (0x0001), rev
2.00/0.00, addr 1, iclass 3/1
[   2.1633250] ukbd0 at uhidev0
[   2.1633250] wskbd0 at ukbd0 mux 1
[   2.5836221] uhidev1 at uhub1 port 2 configuration 1 interface 0
[   2.5937434] uhidev1: QEMU (0x0627) QEMU USB Mouse (0x0001), rev
2.00/0.00, addr 2, iclass 3/1
[   2.6137849] ums0 at uhidev1: 3 buttons and Z dir
[   2.6137849] wsmouse0 at ums0 mux 0
[   3.0340582] uhidev2 at uhub1 port 3 configuration 1 interface 0
[   3.0441520] uhidev2: QEMU (0x0627) QEMU USB Tablet (0x0001), rev
2.00/0.00, addr 3, iclass 3/0
[   3.0541618] ums1 at uhidev2: 3 buttons and Z dir
[   3.0657830] wsmouse1 at ums1 mux 0
[   3.0657830] swwdog0: software watchdog initialized
[   3.0743900] WARNING: 1 error while detecting hardware; check system log.
[   3.0884404] boot device: <unknown>
[   3.0884404] root device: dk1        <---- manually entered, as before.
[   4.8980356] dump device:
[   5.0748269] file system (default generic):
[   5.9316952] root on dk1
[   5.9316952] root file system type: ffs
[   5.9316952] kern.module.path=/stand/evbarm/10.99.2/modules
[   5.9416986] init path (default /sbin/init):
[   6.9224038] init: trying /sbin/init
...

>
>
> 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;
>
>


-- 
----

Reply via email to