Re: svn commit: r323063 - head/sys/boot/efi/boot1

2017-09-07 Thread Andrew Turner
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  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  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, , (VOID**));
>> +   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, 
>> ,
>> +   (void **));
>> +   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 
>> **)))
>> @@ -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, , (VOID**));
>> -   imgpath = NULL;
>> -   if (status == EFI_SUCCESS) {
>> -   status = BS->HandleProtocol(img->DeviceHandle, 
>> ,
>> -   (void **));
>> -   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);
>> 
> 

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r323063 - head/sys/boot/efi/boot1

2017-09-07 Thread Conrad Meyer
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  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, , (VOID**));
> +   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, 
> ,
> +   (void **));
> +   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 
> **)))
> @@ -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, , (VOID**));
> -   imgpath = NULL;
> -   if (status == EFI_SUCCESS) {
> -   status = BS->HandleProtocol(img->DeviceHandle, 
> ,
> -   (void **));
> -   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);
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r323063 - head/sys/boot/efi/boot1

2017-09-07 Thread Warner Losh
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  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  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  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, , (VOID**));
> >> +   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,
> ,
> >> +   (void **));
> >> +   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
> **)))
> >> @@ -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, , (VOID**));
> >> -   imgpath = NULL;
> >> -   if (status == EFI_SUCCESS) {
> >> -   status = BS->HandleProtocol(img->DeviceHandle,
> ,
> >> -   (void **));
> >> -   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);
> >>
> >
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r323063 - head/sys/boot/efi/boot1

2017-09-05 Thread Jia-Shiun Li
On Tue, Sep 5, 2017 at 9:33 PM, Warner Losh  wrote:

> On Mon, Sep 4, 2017 at 11:51 PM, Jia-Shiun Li  wrote:
>
>> Seems to cause armv6 crossbuild to fail.
>> But did armv6 use efi anyway?
>>
>
>
Yea, this is just a command line flag. Will fix. Not sure why x86 doesn't
> suffer from this, but it's a wchar_t size difference I'm sure.
>

amd64 has -fshort-wchar when compiling boot1.c. aarch64 has it too but
armv6 doesn't.
Looks it's missing from sys/boot/efi/Makefile.inc.

from build log,

amd64:
--- boot1.o ---
cc -target x86_64-unknown-freebsd12.0
--sysroot=/usr/obj/personal/freebsd/fbsdsrc/tmp
-B/usr/obj/personal/freebsd/fbsdsrc/tmp/usr/bin  -O2 -pipe
-DSKEIN_LOOP=111 -I.
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../include
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../include/amd64
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../../contrib/dev/acpica/include
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../.. -DEFI_UFS_BOOT
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../zfs/
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../../cddl/boot/zfs/
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../../crypto/skein
-DEFI_ZFS_BOOT -I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../common
-fPIC -ffreestanding -Wformat -mno-mmx -mno-sse -mno-avx -msoft-float
-fshort-wchar -mno-red-zone -mno-aes -g -MD  -MF.depend.boot1.o -MTboot1.o
-std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W
-Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow
-Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs
-Wredundant-decls -Wold-style-definition -Wno-pointer-sign
-Wmissing-variable-declarations -Wthread-safety -Wno-empty-body
-Wno-string-plus-int -Wno-unused-const-variable  -Qunused-arguments  -c
/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/boot1.c -o boot1.o


armv6:
--- boot1.o ---
cc -target armv6-gnueabihf-freebsd12.0
--sysroot=/usr/obj/arm.armv6/personal/freebsd/fbsdsrc/tmp
-B/usr/obj/arm.armv6/personal/freebsd/fbsdsrc/tmp/usr/bin  -O -pipe
-DSKEIN_LOOP=111 -I.
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../include
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../include/arm
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../../contrib/dev/acpica/include
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../.. -DEFI_UFS_BOOT
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../zfs/
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../../cddl/boot/zfs/
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../../crypto/skein
-DEFI_ZFS_BOOT -I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../common
-ffreestanding -Wformat  -msoft-float -fPIC -g -MD  -MF.depend.boot1.o
-MTboot1.o -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W
-Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow
-Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs
-Wredundant-decls -Wold-style-definition -Wno-pointer-sign
-Wmissing-variable-declarations -Wthread-safety -Wno-empty-body
-Wno-string-plus-int -Wno-unused-const-variable  -mno-movt -mfpu=none
-Qunused-arguments  -c /personal/freebsd/fbsdsrc/sys/boot/efi/boot1/boot1.c
-o boot1.o

aarch64:
--- boot1.o ---
cc -target aarch64-unknown-freebsd12.0
--sysroot=/usr/obj/arm64.aarch64/personal/freebsd/fbsdsrc/tmp
-B/usr/obj/arm64.aarch64/personal/freebsd/fbsdsrc/tmp/usr/bin  -O2 -pipe
-DSKEIN_LOOP=111 -I.
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../include
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../include/arm64
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../../contrib/dev/acpica/include
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../.. -DEFI_UFS_BOOT
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../zfs/
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../../cddl/boot/zfs/
-I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../../crypto/skein
-DEFI_ZFS_BOOT -I/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/../../common
-mgeneral-regs-only -ffreestanding -Wformat  -fshort-wchar -fPIC -g -MD
-MF.depend.boot1.o -MTboot1.o -std=gnu99 -Wsystem-headers -Werror -Wall
-Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual
-Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align
-Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
-Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations
-Wthread-safety -Wno-empty-body -Wno-string-plus-int
-Wno-unused-const-variable  -Qunused-arguments  -c
/personal/freebsd/fbsdsrc/sys/boot/efi/boot1/boot1.c -o boot1.o

-Jia-Shiun
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r323063 - head/sys/boot/efi/boot1

2017-09-05 Thread Warner Losh
On Mon, Sep 4, 2017 at 11:51 PM, Jia-Shiun Li  wrote:

> Seems to cause armv6 crossbuild to fail.
> But did armv6 use efi anyway?
>
>
> jsli@jsli-e5:/tmp/src # uname -a
> FreeBSD jsli-e5 12.0-CURRENT FreeBSD 12.0-CURRENT #59 r323150: Mon Sep  4
> 11:30:09 CST 2017 jsli@jsli-e5:/usr/obj/usr/src/sys/GENERIC-NODEBUG
> amd64
> jsli@jsli-e5:/tmp/src # svnversion
> 323170
> jsli@jsli-e5:/tmp/src # time nice +20 env MAKEOBJDIRPREFIX=/tmp/obj make
> -sj12 TARGET_ARCH=armv6 KERNCONF=RPI2 -DNO_CLEAN buildworld buildkernel
> ...
> ...
> ...
> /tmp/src/sys/boot/efi/boot1/boot1.c:474:32: error: format specifies type
> 'wchar_t *' (aka 'unsigned int *') but the argume
> nt has type 'CHAR16 *' (aka 'unsigned short *') [-Werror,-Wformat]
> printf("   Load Path: %S\n", text);
>   ~~ ^~~~
> /tmp/src/sys/boot/efi/boot1/boot1.c:485:35: error: format specifies type
> 'wchar_t *' (aka 'unsigned int *') but the argume
> nt has type 'CHAR16 *' (aka 'unsigned short *') [-Werror,-Wformat]
> printf("   Load Device: %S\n", text);
> ~~ ^~~~
>

Yea, this is just a command line flag. Will fix. Not sure why x86 doesn't
suffer from this, but it's a wchar_t size difference I'm sure.

Warner


> On Fri, Sep 1, 2017 at 1:32 AM, Warner Losh  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, , (VOID**));
>> +   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,
>> ,
>> +   (void **));
>> +   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
>> **)))
>> @@ -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, , (VOID**));
>> -   imgpath = NULL;
>> -   if (status == EFI_SUCCESS) {
>> -   status = BS->HandleProtocol(img->DeviceHandle,
>> ,
>> -   (void **));
>> -   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);
>> ___
>> svn-src-head@freebsd.org mailing list
>> 

Re: svn commit: r323063 - head/sys/boot/efi/boot1

2017-09-04 Thread Jia-Shiun Li
Seems to cause armv6 crossbuild to fail.
But did armv6 use efi anyway?


jsli@jsli-e5:/tmp/src # uname -a
FreeBSD jsli-e5 12.0-CURRENT FreeBSD 12.0-CURRENT #59 r323150: Mon Sep  4
11:30:09 CST 2017 jsli@jsli-e5:/usr/obj/usr/src/sys/GENERIC-NODEBUG
amd64
jsli@jsli-e5:/tmp/src # svnversion
323170
jsli@jsli-e5:/tmp/src # time nice +20 env MAKEOBJDIRPREFIX=/tmp/obj make
-sj12 TARGET_ARCH=armv6 KERNCONF=RPI2 -DNO_CLEAN buildworld buildkernel
...
...
...
/tmp/src/sys/boot/efi/boot1/boot1.c:474:32: error: format specifies type
'wchar_t *' (aka 'unsigned int *') but the argume
nt has type 'CHAR16 *' (aka 'unsigned short *') [-Werror,-Wformat]
printf("   Load Path: %S\n", text);
  ~~ ^~~~
/tmp/src/sys/boot/efi/boot1/boot1.c:485:35: error: format specifies type
'wchar_t *' (aka 'unsigned int *') but the argume
nt has type 'CHAR16 *' (aka 'unsigned short *') [-Werror,-Wformat]
printf("   Load Device: %S\n", text);
~~ ^~~~
2 errors generated.
--- boot1.o ---
*** [boot1.o] Error code 1

make[6]: stopped in /tmp/src/sys/boot/efi/boot1
1 error

make[6]: stopped in /tmp/src/sys/boot/efi/boot1
--- all_subdir_sys/boot/efi/boot1 ---
*** [all_subdir_sys/boot/efi/boot1] Error code 2

make[5]: stopped in /tmp/src/sys/boot/efi
1 error

make[5]: stopped in /tmp/src/sys/boot/efi
--- all_subdir_sys/boot/efi ---
*** [all_subdir_sys/boot/efi] Error code 2

make[4]: stopped in /tmp/src/sys/boot
1 error

make[4]: stopped in /tmp/src/sys/boot


-Jia-Shiun


On Fri, Sep 1, 2017 at 1:32 AM, Warner Losh  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, , (VOID**));
> +   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,
> ,
> +   (void **));
> +   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
> **)))
> @@ -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, , (VOID**));
> -   imgpath = NULL;
> -   if (status == EFI_SUCCESS) {
> -   status = BS->HandleProtocol(img->DeviceHandle,
> ,
> -   (void **));
> -   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++)
>