tests: Build correct sandbox configuration on 32bit

Currently sandbox configuration defautls to 64bit and there is no
automation for building 32bit sandbox on 32bit hosts.

Use _LP64 macro as heuristic for detecting 64bit targets.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Michal Suchanek 2022-10-14 22:52:33 +02:00 committed by Simon Glass
parent 6792bd999b
commit 5bde2e06ca
2 changed files with 7 additions and 15 deletions

View File

@ -13,7 +13,7 @@ config SYS_CPU
config SANDBOX64 config SANDBOX64
bool "Use 64-bit addresses" bool "Use 64-bit addresses"
select PHYS_64BIT select PHYS_64BIT
select HOST_64BIT depends on HOST_64BIT
config SANDBOX_RAM_SIZE_MB config SANDBOX_RAM_SIZE_MB
int "RAM size in MiB" int "RAM size in MiB"
@ -41,23 +41,11 @@ config SYS_CONFIG_NAME
default "sandbox_spl" if SANDBOX_SPL default "sandbox_spl" if SANDBOX_SPL
default "sandbox" if !SANDBOX_SPL default "sandbox" if !SANDBOX_SPL
choice
prompt "Run sandbox on 32/64-bit host"
default HOST_64BIT
help
Sandbox can be built on 32-bit and 64-bit hosts.
The default is to build on a 64-bit host and run
on a 64-bit host. If you want to run sandbox on
a 32-bit host, change it here.
config HOST_32BIT config HOST_32BIT
bool "32-bit host" def_bool ! $(cc-define,_LP64)
depends on !PHYS_64BIT
config HOST_64BIT config HOST_64BIT
bool "64-bit host" def_bool $(cc-define,_LP64)
endchoice
config SANDBOX_CRASH_RESET config SANDBOX_CRASH_RESET
bool "Reset on crash" bool "Reset on crash"

View File

@ -22,6 +22,10 @@ success = $(if-success,$(1),y,n)
# Return y if the compiler supports <flag>, n otherwise # Return y if the compiler supports <flag>, n otherwise
cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null)
# $(cc-define,<macro>)
# Return y if the compiler defines <macro>, n otherwise
cc-define = $(success,$(CC) -dM -E -x c /dev/null | grep -q '^#define \<$(1)\>')
# $(ld-option,<flag>) # $(ld-option,<flag>)
# Return y if the linker supports <flag>, n otherwise # Return y if the linker supports <flag>, n otherwise
ld-option = $(success,$(LD) -v $(1)) ld-option = $(success,$(LD) -v $(1))