On Wed, May 10, 2017 at 03:14:30PM +0200, Stefan Sperling wrote:
> On Tue, May 09, 2017 at 09:47:14PM +0200, Michele Curti wrote:
> > On Tue, May 09, 2017 at 09:36:02PM +0200, Michele Curti wrote:
> > > On Tue, May 09, 2017 at 10:20:03AM +0200, Michele Curti wrote:
> > > > Hi all, I tried to upgrade to OpenBSD 6.1 on an Asus X205TA (bay
> > > > trail, 32 bit efi, 64 bit os) but the bootloader do not correctly
> > > > detect the internal disk.
> > > > 
> > > > I also tried a fresh install, but things do not change.  Boot fails
> > > > and when I do a "machine diskinfo" I got a lot of "?" symbols (a video
> > > > here https://www.youtube.com/watch?v=fsomNX-oFTQ )
> > > > 
> > > > How can I debug the issue?
> > > > 
> > > 
> > > Compiling bootia32.efi :p
> > > 
> > > With sys/arch/amd64/stand/efiboot/efiboot.c revision 1.15 it works,
> > > revision 1.16 it fails.
> > > 
> > > I'll try to understand, thanks, Michele
> > 
> > 
> > With the following diff it works, bye!
> 
> Looks good to me. Is anyone handling this patch?
> 
> > Index: efiboot/efiboot.c
> > ===================================================================
> > RCS file: /cvs/src/sys/arch/amd64/stand/efiboot/efiboot.c,v
> > retrieving revision 1.17
> > diff -u -p -r1.17 efiboot.c
> > --- efiboot/efiboot.c       3 Mar 2017 08:56:18 -0000       1.17
> > +++ efiboot/efiboot.c       9 May 2017 19:44:30 -0000
> > @@ -92,7 +92,7 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TA
> >                     if (DevicePathType(dp) == MEDIA_DEVICE_PATH &&
> >                         DevicePathSubType(dp) == MEDIA_HARDDRIVE_DP) {
> >                             bios_bootdev = 0x80;
> > -                           efi_bootdp = dp0;
> > +                           efi_bootdp = dp;
> >                             break;
> >                     }
> >             }
> > 
> 

I don't think this is the correct fix.  It might solve your issue, but I
don't think it's completely right.  So EFI has those so called device
paths.  A path is basically a list of nodes.  To compare two paths you
need to compare the whole path and not just a single node of it.  If you
store dp instead of dp0 you will basically only save a part of the path,
not the full path.

What you can do is print the full path of efi_bootdp like..

    for (dp = efi_bootdp; !IsDevicePathEnd(dp);
        dp = NextDevicePathNode(dp)) {
            printf("%x %x - ", DevicePathType(dp), DevicePathSubType(dp));
    }
    printf("\n");

And do the same for the DPs that are being put into the
efi_device_path_cmp function.  That will at least print the types, but
not the content of the nodes.  That's a start into figuring out why it
does not correctly compare the paths.

Maybe there's a bug in the compare code?

Reply via email to