[PATCH v10 06/10] sandbox: Report host default-filename in native mode

Quentin Schulz quentin.schulz at cherry.de
Mon Nov 11 13:55:11 CET 2024


Hi Simon,

On 11/11/24 1:41 PM, Simon Glass wrote:
> Hi Quentin,
> 
> On Mon, 11 Nov 2024 at 03:03, Quentin Schulz <quentin.schulz at cherry.de> wrote:
>>
>> Hi Simon,
>>
>> On 11/7/24 10:31 PM, Simon Glass wrote:
>>> When the --native flag is given, pretend to be running the host
>>> architecture rather than sandbox.
>>>
>>> Allow the same control for PXE too.
>>>
>>
>> Commit 7506c1566998 ("sandbox: Report host default-filename in native
>> mode") breaks building jaguar-rk3588_defconfig, I believe it's this patch?
>>
>> Reverting it makes the build pass again.
>>
>> HOST_ARCH is empty in include/generated/version_autogenerated.h for some
>> reason. Though it was also empty before.
>>
>> The error is:
>>
>> """
>> lib/efi_loader/efi_helper.c:26:15: error: operator '==' has no left operand
>>      26 | #if HOST_ARCH == HOST_ARCH_X86_64
>>         |               ^~
>> lib/efi_loader/efi_helper.c:29:17: error: operator '==' has no left operand
>>      29 | #elif HOST_ARCH == HOST_ARCH_X86
>>         |                 ^~
>> lib/efi_loader/efi_helper.c:32:17: error: operator '==' has no left operand
>>      32 | #elif HOST_ARCH == HOST_ARCH_AARCH64
>>         |                 ^~
>> lib/efi_loader/efi_helper.c:35:17: error: operator '==' has no left operand
>>      35 | #elif HOST_ARCH == HOST_ARCH_ARM
>>         |                 ^~
>> lib/efi_loader/efi_helper.c:38:17: error: operator '==' has no left operand
>>      38 | #elif HOST_ARCH == HOST_ARCH_RISCV32
>>         |                 ^~
>> lib/efi_loader/efi_helper.c:41:17: error: operator '==' has no left operand
>>      41 | #elif HOST_ARCH == HOST_ARCH_RISCV64
>>         |                 ^~
>> lib/efi_loader/efi_helper.c:45:2: error: #error Unsupported Host
>> architecture
>>      45 | #error Unsupported Host architecture
>>         |  ^~~~~
>> lib/efi_loader/efi_helper.c: In function ‘efi_get_basename’:
>> lib/efi_loader/efi_helper.c:73:38: error: ‘HOST_BOOTEFI_NAME’ undeclared
>> (first use in this function); did you mean ‘BOOTEFI_NAME’?
>>      73 |         return efi_use_host_arch() ? HOST_BOOTEFI_NAME :
>> BOOTEFI_NAME;
>>         |                                      ^~~~~~~~~~~~~~~~~
>>         |                                      BOOTEFI_NAME
>> lib/efi_loader/efi_helper.c:73:38: note: each undeclared identifier is
>> reported only once for each function it appears in
>> lib/efi_loader/efi_helper.c: In function ‘efi_get_pxe_arch’:
>> lib/efi_loader/efi_helper.c:79:24: error: ‘HOST_PXE_ARCH’ undeclared
>> (first use in this function); did you mean ‘HOST_ARCH’?
>>      79 |                 return HOST_PXE_ARCH;
>>         |                        ^~~~~~~~~~~~~
>>         |                        HOST_ARCH
>> lib/efi_loader/efi_helper.c: In function ‘efi_get_basename’:
>> lib/efi_loader/efi_helper.c:74:1: warning: control reaches end of
>> non-void function [-Wreturn-type]
>>      74 | }
>>         | ^
>> make[2]: *** [scripts/Makefile.build:256: lib/efi_loader/efi_helper.o]
>> Error 1
>> make[1]: *** [scripts/Makefile.build:398: lib/efi_loader] Error 2
>> make: *** [Makefile:1914: lib] Error 2
>> make: *** Waiting for unfinished jobs....
>> """
>>
>> The build host for me is Fedora 41.
> 
> Which cross-toolchain are you using? That variable is set at the top
> of Makefile so it would be worth seeing what MK_ARCH is returning.
> 

Ahah! I had forgotten I use ccache so my CROSS_COMPILE is "ccache 
aarch64-linux-gnu-", without "ccache" in there it works.

I can suggest:
"""
diff --git a/Makefile b/Makefile
index 7275a02f24c..2aa115f2097 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ include include/host_arch.h
  ifeq ("", "$(CROSS_COMPILE)")
    MK_ARCH="${shell uname -m}"
  else
-  MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 
's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}"
+  MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^\(ccache 
\)\?[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\3/p'}"
  endif
  unexport HOST_ARCH
  ifeq ("x86_64", $(MK_ARCH))
"""

an opinion on this or do I just send this as a patch and it can be 
discussed on the ML?

This works for me both with and without ccache in CROSS_COMILE.

Cheers,
Quentin


More information about the U-Boot mailing list