Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Sep 2017 01:17:37 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Andrew Turner <andrew@fubar.geek.nz>
Cc:        "Conrad E. Meyer" <cem@freebsd.org>, Warner Losh <imp@freebsd.org>,  src-committers <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r323063 - head/sys/boot/efi/boot1
Message-ID:  <CANCZdfr%2BH8HHJQUh8Qc8aLAF2RW6Yp4yiZ_uTMg5xzw-aih-Ng@mail.gmail.com>
In-Reply-To: <F667D226-AF46-4F74-8150-9EA3451C597B@fubar.geek.nz>
References:  <201708311732.v7VHWEvs037245@repo.freebsd.org> <CAG6CVpVBwpXcFFQ3CrDozUvw8vK6phG1ZH_71mSTP_BsB6MNgw@mail.gmail.com> <F667D226-AF46-4F74-8150-9EA3451C597B@fubar.geek.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
Yup. I have those patches in my tree, pending testing after a day or so of
fires at work. They are a hack and I wanted to stop duplicating so much
Makefile code between sys/boot and lib/libstand before I pushed them in. I
think there's no issues with other versions of the loader.

We can also lie and cast the strings, but that has other issues.

So I'll fix this shortly.

Warner

On Thu, Sep 7, 2017 at 1:04 AM, Andrew Turner <andrew@fubar.geek.nz> wrote:

> And we need a constant wchar_t between loader and libstand as ld.bfd
> checks the attributes across these when linking.
>
> There are a few options, the simplest is probably to make sys/boot and
> libstand all build with 16bit wchar_t, but it would need someone to check
> on wchar_t usage in other loader versions.
>
> Andrew
> > On 7 Sep 2017, at 07:25, Conrad Meyer <cem@freebsd.org> wrote:
> >
> > This seems to break world on ARM due to the size difference CHAR16 vs
> > ARM wchat_t (currently 32-bit in loader, apparently).
> >
> > Best,
> > Conrad
> >
> > On Thu, Aug 31, 2017 at 10:32 AM, Warner Losh <imp@freebsd.org> wrote:
> >> Author: imp
> >> Date: Thu Aug 31 17:32:14 2017
> >> New Revision: 323063
> >> URL: https://svnweb.freebsd.org/changeset/base/323063
> >>
> >> Log:
> >>  boot1.efi: print more info about where boot1.efi is loaded from
> >>
> >>  Print the device that boot1.efi was loaded from. Print the path as
> >>  well (since it isn't included in DeviceHandle). Move block where we do
> >>  this earlier so all the block handle code is now together.
> >>
> >>  Sponsored by: Netflix
> >>
> >> Modified:
> >>  head/sys/boot/efi/boot1/boot1.c
> >>
> >> Modified: head/sys/boot/efi/boot1/boot1.c
> >> ============================================================
> ==================
> >> --- head/sys/boot/efi/boot1/boot1.c     Thu Aug 31 17:32:09 2017
>   (r323062)
> >> +++ head/sys/boot/efi/boot1/boot1.c     Thu Aug 31 17:32:14 2017
>   (r323063)
> >> @@ -344,6 +344,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE
> *Xsystab)
> >>        EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl = NULL;
> >>        SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL;
> >>        UINTN i, max_dim, best_mode, cols, rows, hsize, nhandles;
> >> +       CHAR16 *text;
> >>
> >>        /* Basic initialization*/
> >>        ST = Xsystab;
> >> @@ -387,6 +388,27 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE
> *Xsystab)
> >>        }
> >>        putchar('\n');
> >>
> >> +       /* Determine the devpath of our image so we can prefer it. */
> >> +       status = BS->HandleProtocol(IH, &LoadedImageGUID, (VOID**)&img);
> >> +       imgpath = NULL;
> >> +       if (status == EFI_SUCCESS) {
> >> +               text = efi_devpath_name(img->FilePath);
> >> +               printf("   Load Path: %S\n", text);
> >> +               efi_free_devpath_name(text);
> >> +
> >> +               status = BS->HandleProtocol(img->DeviceHandle,
> &DevicePathGUID,
> >> +                   (void **)&imgpath);
> >> +               if (status != EFI_SUCCESS) {
> >> +                       DPRINTF("Failed to get image DevicePath
> (%lu)\n",
> >> +                           EFI_ERROR_CODE(status));
> >> +               } else {
> >> +                       text = efi_devpath_name(imgpath);
> >> +                       printf("   Load Device: %S\n", text);
> >> +                       efi_free_devpath_name(text);
> >> +               }
> >> +
> >> +       }
> >> +
> >>        /* Get all the device handles */
> >>        hsize = (UINTN)NUM_HANDLES_INIT * sizeof(EFI_HANDLE);
> >>        if ((status = BS->AllocatePool(EfiLoaderData, hsize, (void
> **)&handles))
> >> @@ -421,24 +443,6 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE
> *Xsystab)
> >>        nhandles = hsize / sizeof(*handles);
> >>        printf("   Probing %zu block devices...", nhandles);
> >>        DPRINTF("\n");
> >> -
> >> -       /* Determine the devpath of our image so we can prefer it. */
> >> -       status = BS->HandleProtocol(IH, &LoadedImageGUID, (VOID**)&img);
> >> -       imgpath = NULL;
> >> -       if (status == EFI_SUCCESS) {
> >> -               status = BS->HandleProtocol(img->DeviceHandle,
> &DevicePathGUID,
> >> -                   (void **)&imgpath);
> >> -               if (status != EFI_SUCCESS)
> >> -                       DPRINTF("Failed to get image DevicePath
> (%lu)\n",
> >> -                           EFI_ERROR_CODE(status));
> >> -#ifdef EFI_DEBUG
> >> -               {
> >> -                       CHAR16 *text = efi_devpath_name(imgpath);
> >> -                       DPRINTF("boot1 imagepath: %S\n", text);
> >> -                       efi_free_devpath_name(text);
> >> -               }
> >> -#endif
> >> -       }
> >>
> >>        for (i = 0; i < nhandles; i++)
> >>                probe_handle_status(handles[i], imgpath);
> >>
> >
>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfr%2BH8HHJQUh8Qc8aLAF2RW6Yp4yiZ_uTMg5xzw-aih-Ng>