[PATCH 0/3] sandbox: HOST_ARCH improvements

Hi all,
This series is in respond to a review comment [1] I got from Heinrich.
It moved detection of HOST_ARCH to Kconfig, which allows us to control options based on HOST_ARCH.
It further improved detection and configuration of SDL2 so that it can work with cross toolchain provided sysroot.
Tested on x86_64, cross compile and loosely tesed with qemu-user on riscv64, arm, aarch64.
Thanks
[1]: https://lore.kernel.org/u-boot/2CD8D385-F0A9-4A1B-827D-1C55CD7E32ED@gmx.de/
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com --- Jiaxun Yang (3): sandbox: Move HOST_ARCH detection to Kconfig EFI: Make EFI loader depend sandbox HOST_ARCH sandbox: Use pkg-config to detect and config sdl2
Makefile | 27 ++--------------------- arch/sandbox/Kconfig | 25 ++++++++++++++++++++- arch/sandbox/config.mk | 17 +++++++------- arch/sandbox/lib/crt0_sandbox_efi.S | 14 ++++++------ arch/sandbox/lib/reloc_sandbox_efi.c | 14 ++++++------ doc/arch/sandbox/sandbox.rst | 6 ----- include/efi_default_filename.h | 14 ++++++------ include/host_arch.h | 26 ---------------------- lib/efi_loader/Kconfig | 7 ++++-- lib/efi_selftest/efi_selftest_miniapp_exception.c | 6 ++--- 10 files changed, 63 insertions(+), 93 deletions(-) --- base-commit: ad7dce5abd49ef3b5c93da5303e15449c8c162b4 change-id: 20240517-sandbox-hostarch-kconfig-a56a5f80b70d
Best regards,

Move host arch detection to Kconfig so we can make some options depend on HOST_ARCH.
Also now we are using compiler macros to detect target arch, which is more robust than looking at uname -a.
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com --- Makefile | 24 --------------------- arch/sandbox/Kconfig | 23 ++++++++++++++++++++ arch/sandbox/config.mk | 12 +++++------ arch/sandbox/lib/crt0_sandbox_efi.S | 14 ++++++------ arch/sandbox/lib/reloc_sandbox_efi.c | 14 ++++++------ include/efi_default_filename.h | 14 ++++++------ include/host_arch.h | 26 ----------------------- lib/efi_selftest/efi_selftest_miniapp_exception.c | 6 +++--- 8 files changed, 53 insertions(+), 80 deletions(-)
diff --git a/Makefile b/Makefile index 44deb339af19..596f6458e6b2 100644 --- a/Makefile +++ b/Makefile @@ -16,29 +16,6 @@ NAME = # (this increases performance and avoids hard-to-debug behaviour) MAKEFLAGS += -rR
-# Determine target architecture for the sandbox -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'}" -endif -unexport HOST_ARCH -ifeq ("x86_64", $(MK_ARCH)) - export HOST_ARCH=$(HOST_ARCH_X86_64) -else ifneq (,$(findstring $(MK_ARCH), "i386" "i486" "i586" "i686")) - export HOST_ARCH=$(HOST_ARCH_X86) -else ifneq (,$(findstring $(MK_ARCH), "aarch64" "armv8l")) - export HOST_ARCH=$(HOST_ARCH_AARCH64) -else ifneq (,$(findstring $(MK_ARCH), "arm" "armv7" "armv7a" "armv7l")) - export HOST_ARCH=$(HOST_ARCH_ARM) -else ifeq ("riscv32", $(MK_ARCH)) - export HOST_ARCH=$(HOST_ARCH_RISCV32) -else ifeq ("riscv64", $(MK_ARCH)) - export HOST_ARCH=$(HOST_ARCH_RISCV64) -endif -undefine MK_ARCH - # Avoid funny character set dependencies unexport LC_ALL LC_COLLATE=C @@ -1963,7 +1940,6 @@ define filechk_version.h echo #define U_BOOT_VERSION_NUM $(VERSION); \ echo #define U_BOOT_VERSION_NUM_PATCH $$(echo $(PATCHLEVEL) | \ sed -e "s/^0*//"); \ - echo #define HOST_ARCH $(HOST_ARCH); \ echo #define CC_VERSION_STRING "$$(LC_ALL=C $(CC) --version | head -n 1)"; \ echo #define LD_VERSION_STRING "$$(LC_ALL=C $(LD) --version | head -n 1)"; ) endef diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 1c8353d6156d..c3954e33aceb 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -47,6 +47,29 @@ config HOST_32BIT config HOST_64BIT def_bool $(cc-define,_LP64)
+config HOST_ARCH_X86 + def_bool $(cc-define,__i386__) + +config HOST_ARCH_X86_64 + def_bool $(cc-define,__x86_64__) + +config HOST_ARCH_ARM + def_bool $(cc-define,__arm__) + +config HOST_ARCH_AARCH64 + def_bool $(cc-define,__aarch64__) + +config HOST_ARCH_RISCV32 + def_bool $(cc-define,__riscv_xlen 32) + +config HOST_ARCH_RISCV64 + def_bool $(cc-define,__riscv_xlen 64) + +config HOST_ARCH_UNKNOWN + def_bool !HOST_ARCH_X86 && !HOST_ARCH_X86_64 && \ + !HOST_ARCH_ARM && !HOST_ARCH_AARCH64 && \ + !HOST_ARCH_RISCV32 && !HOST_ARCH_RISCV64 + config HOST_HAS_SDL def_bool $(success,sdl2-config --version)
diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk index 405843800e9e..6b1da993ba4e 100644 --- a/arch/sandbox/config.mk +++ b/arch/sandbox/config.mk @@ -44,27 +44,27 @@ cmd_u-boot-spl = (cd $(obj) && $(CC) -o $(SPL_BIN) -Wl,-T u-boot-spl.lds \ -Wl,--no-whole-archive \ $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot-spl.map -Wl,--gc-sections)
-ifeq ($(HOST_ARCH),$(HOST_ARCH_X86_64)) +ifeq ($(CONFIG_HOST_ARCH_X86_64),y) EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_x86_64_efi.lds EFI_TARGET := --target=efi-app-x86_64 -else ifeq ($(HOST_ARCH),$(HOST_ARCH_X86)) +else ifeq ($(CONFIG_HOST_ARCH_X86),y) EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_ia32_efi.lds EFI_TARGET := --target=efi-app-ia32 -else ifeq ($(HOST_ARCH),$(HOST_ARCH_AARCH64)) +else ifeq ($(CONFIG_HOST_ARCH_AARCH64),y) EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_aarch64_efi.lds OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \ -j __u_boot_list -j .rela.dyn -j .got -j .got.plt \ -j .binman_sym_table -j .text_rest \ -j .efi_runtime -j .efi_runtime_rel -else ifeq ($(HOST_ARCH),$(HOST_ARCH_ARM)) +else ifeq ($(CONFIG_HOST_ARCH_ARM),y) EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_arm_efi.lds OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \ -j .data -j .got -j .got.plt -j __u_boot_list -j .rel.dyn \ -j .binman_sym_table -j .text_rest \ -j .efi_runtime -j .efi_runtime_rel -else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV32)) +else ifeq ($(CONFIG_HOST_ARCH_RISCV32),y) EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv32_efi.lds -else ifeq ($(HOST_ARCH),$(HOST_ARCH_RISCV64)) +else ifeq ($(CONFIG_HOST_ARCH_RISCV64),y) EFI_LDS := ${SRCDIR}/../../../arch/riscv/lib/elf_riscv64_efi.lds endif EFI_CRT0 := crt0_sandbox_efi.o diff --git a/arch/sandbox/lib/crt0_sandbox_efi.S b/arch/sandbox/lib/crt0_sandbox_efi.S index 88537345ddb3..ffac3520f7df 100644 --- a/arch/sandbox/lib/crt0_sandbox_efi.S +++ b/arch/sandbox/lib/crt0_sandbox_efi.S @@ -5,28 +5,28 @@ * Copyright (c) 2019 Heinrich Schuchardt */
-#include <host_arch.h> +#include <config.h>
-#if HOST_ARCH == HOST_ARCH_X86_64 +#if CONFIG_IS_ENABLED(HOST_ARCH_X86_64) #include "../../../arch/x86/lib/crt0_x86_64_efi.S" #endif
-#if HOST_ARCH == HOST_ARCH_X86 +#if CONFIG_IS_ENABLED(HOST_ARCH_X86) #include "../../../arch/x86/lib/crt0_ia32_efi.S" #endif
-#if HOST_ARCH == HOST_ARCH_AARCH64 +#if CONFIG_IS_ENABLED(HOST_ARCH_AARCH64) #include "../../../arch/arm/lib/crt0_aarch64_efi.S" #endif
-#if HOST_ARCH == HOST_ARCH_ARM +#if CONFIG_IS_ENABLED(HOST_ARCH_ARM) #include "../../../arch/arm/lib/crt0_arm_efi.S" #endif
-#if HOST_ARCH == HOST_ARCH_RISCV32 +#if CONFIG_IS_ENABLED(HOST_ARCH_RISCV32) #include "../../../arch/riscv/lib/crt0_riscv_efi.S" #endif
-#if HOST_ARCH == HOST_ARCH_RISCV64 +#if CONFIG_IS_ENABLED(HOST_ARCH_RISCV64) #include "../../../arch/riscv/lib/crt0_riscv_efi.S" #endif diff --git a/arch/sandbox/lib/reloc_sandbox_efi.c b/arch/sandbox/lib/reloc_sandbox_efi.c index a21e6757c551..b88c427b5f74 100644 --- a/arch/sandbox/lib/reloc_sandbox_efi.c +++ b/arch/sandbox/lib/reloc_sandbox_efi.c @@ -5,28 +5,28 @@ * Copyright (c) 2019 Heinrich Schuchardt */
-#include <host_arch.h> +#include <config.h>
-#if HOST_ARCH == HOST_ARCH_X86_64 +#if CONFIG_IS_ENABLED(HOST_ARCH_X86_64) #include "../../../arch/x86/lib/reloc_x86_64_efi.c" #endif
-#if HOST_ARCH == HOST_ARCH_X86 +#if CONFIG_IS_ENABLED(HOST_ARCH_X86) #include "../../../arch/x86/lib/reloc_ia32_efi.c" #endif
-#if HOST_ARCH == HOST_ARCH_AARCH64 +#if CONFIG_IS_ENABLED(HOST_ARCH_AARCH64) #include "../../../arch/arm/lib/reloc_aarch64_efi.c" #endif
-#if HOST_ARCH == HOST_ARCH_ARM +#if CONFIG_IS_ENABLED(HOST_ARCH_ARM) #include "../../../arch/arm/lib/reloc_arm_efi.c" #endif
-#if HOST_ARCH == HOST_ARCH_RISCV32 +#if CONFIG_IS_ENABLED(HOST_ARCH_RISCV32) #include "../../../arch/riscv/lib/reloc_riscv_efi.c" #endif
-#if HOST_ARCH == HOST_ARCH_RISCV64 +#if CONFIG_IS_ENABLED(HOST_ARCH_RISCV64) #include "../../../arch/riscv/lib/reloc_riscv_efi.c" #endif diff --git a/include/efi_default_filename.h b/include/efi_default_filename.h index 77932984b557..480fa694b6a9 100644 --- a/include/efi_default_filename.h +++ b/include/efi_default_filename.h @@ -11,23 +11,23 @@ #ifndef _EFI_DEFAULT_FILENAME_H #define _EFI_DEFAULT_FILENAME_H
-#include <host_arch.h> +#include <config.h>
#undef BOOTEFI_NAME
#ifdef CONFIG_SANDBOX
-#if HOST_ARCH == HOST_ARCH_X86_64 +#if CONFIG_IS_ENABLED(HOST_ARCH_X86_64) #define BOOTEFI_NAME "BOOTX64.EFI" -#elif HOST_ARCH == HOST_ARCH_X86 +#elif CONFIG_IS_ENABLED(HOST_ARCH_X86) #define BOOTEFI_NAME "BOOTIA32.EFI" -#elif HOST_ARCH == HOST_ARCH_AARCH64 +#elif CONFIG_IS_ENABLED(HOST_ARCH_AARCH64) #define BOOTEFI_NAME "BOOTAA64.EFI" -#elif HOST_ARCH == HOST_ARCH_ARM +#elif CONFIG_IS_ENABLED(HOST_ARCH_ARM) #define BOOTEFI_NAME "BOOTARM.EFI" -#elif HOST_ARCH == HOST_ARCH_RISCV32 +#elif CONFIG_IS_ENABLED(HOST_ARCH_RISCV32) #define BOOTEFI_NAME "BOOTRISCV32.EFI" -#elif HOST_ARCH == HOST_ARCH_RISCV64 +#elif CONFIG_IS_ENABLED(HOST_ARCH_RISCV64) #define BOOTEFI_NAME "BOOTRISCV64.EFI" #else #error Unsupported UEFI architecture diff --git a/include/host_arch.h b/include/host_arch.h deleted file mode 100644 index 261194bd7c6e..000000000000 --- a/include/host_arch.h +++ /dev/null @@ -1,26 +0,0 @@ -#if 0 -# SPDX SPDX-License-Identifier: GPL-2.0+ -# -# Constants defining the host architecture in assembler, C, and make files. -# The values are arbitrary. -# -# Copyright 2019 Heinrich Schuchardt xypron.glpk@gmx.de -#endif - -#if 0 -export HOST_ARCH_AARCH64=0xaa64 -export HOST_ARCH_ARM=0x00a7 -export HOST_ARCH_RISCV32=0x5032 -export HOST_ARCH_RISCV64=0x5064 -export HOST_ARCH_X86=0x0386 -export HOST_ARCH_X86_64=0x8664 -#endif - -#include <version.h> - -#define HOST_ARCH_AARCH64 0xaa64 -#define HOST_ARCH_ARM 0x00a7 -#define HOST_ARCH_RISCV32 0x5032 -#define HOST_ARCH_RISCV64 0x5064 -#define HOST_ARCH_X86 0x0386 -#define HOST_ARCH_X86_64 0x8664 diff --git a/lib/efi_selftest/efi_selftest_miniapp_exception.c b/lib/efi_selftest/efi_selftest_miniapp_exception.c index f668cdac4ab2..2dfbb7c74075 100644 --- a/lib/efi_selftest/efi_selftest_miniapp_exception.c +++ b/lib/efi_selftest/efi_selftest_miniapp_exception.c @@ -36,11 +36,11 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, #elif defined(CONFIG_X86) asm volatile (".word 0xffff\n"); #elif defined(CONFIG_SANDBOX) -#if (HOST_ARCH == HOST_ARCH_ARM || HOST_ARCH == HOST_ARCH_AARCH64) +#if (CONFIG_IS_ENABLED(HOST_ARCH_ARM) || CONFIG_IS_ENABLED(HOST_ARCH_AARCH64)) asm volatile (".word 0xe7f7defb\n"); -#elif (HOST_ARCH == HOST_ARCH_RISCV32 || HOST_ARCH == HOST_ARCH_RISCV64) +#elif (CONFIG_IS_ENABLED(HOST_ARCH_RISCV32) || CONFIG_IS_ENABLED(HOST_ARCH_RISCV64)) asm volatile (".word 0xffffffff\n"); -#elif (HOST_ARCH == HOST_ARCH_X86 || HOST_ARCH == HOST_ARCH_X86_64) +#elif (CONFIG_IS_ENABLED(HOST_ARCH_X86) || CONFIG_IS_ENABLED(HOST_ARCH_X86_64)) asm volatile (".word 0xffff\n"); #endif #endif

在2024年5月17日五月 下午11:09,Jiaxun Yang写道: [...]
diff --git a/lib/efi_selftest/efi_selftest_miniapp_exception.c b/lib/efi_selftest/efi_selftest_miniapp_exception.c index f668cdac4ab2..2dfbb7c74075 100644 --- a/lib/efi_selftest/efi_selftest_miniapp_exception.c +++ b/lib/efi_selftest/efi_selftest_miniapp_exception.c
Seeme like I forgot to move host_arch.h from this file, I don't understand why does it only cause problem non-sandbox build.
Will resend if no further review comments.
Thanks - Jiaxun
@@ -36,11 +36,11 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, #elif defined(CONFIG_X86) asm volatile (".word 0xffff\n"); #elif defined(CONFIG_SANDBOX) -#if (HOST_ARCH == HOST_ARCH_ARM || HOST_ARCH == HOST_ARCH_AARCH64) +#if (CONFIG_IS_ENABLED(HOST_ARCH_ARM) || CONFIG_IS_ENABLED(HOST_ARCH_AARCH64)) asm volatile (".word 0xe7f7defb\n"); -#elif (HOST_ARCH == HOST_ARCH_RISCV32 || HOST_ARCH == HOST_ARCH_RISCV64) +#elif (CONFIG_IS_ENABLED(HOST_ARCH_RISCV32) || CONFIG_IS_ENABLED(HOST_ARCH_RISCV64)) asm volatile (".word 0xffffffff\n"); -#elif (HOST_ARCH == HOST_ARCH_X86 || HOST_ARCH == HOST_ARCH_X86_64) +#elif (CONFIG_IS_ENABLED(HOST_ARCH_X86) || CONFIG_IS_ENABLED(HOST_ARCH_X86_64)) asm volatile (".word 0xffff\n"); #endif #endif
-- 2.34.1

Since EFI loader on sandbox requires some architecture code, make it depend on HOST_ARCH to ensure it's only compiled on desired host.
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com --- lib/efi_loader/Kconfig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 430bb7f0f7dc..54d180fe31c1 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -1,11 +1,14 @@ config EFI_LOADER bool "Support running UEFI applications" - depends on OF_LIBFDT && ( \ + depends on OF_LIBFDT && (( \ ARM && (SYS_CPU = arm1136 || \ SYS_CPU = arm1176 || \ SYS_CPU = armv7 || \ SYS_CPU = armv8) || \ - X86 || RISCV || SANDBOX) + X86 || RISCV) || \ + (SANDBOX && (HOST_ARCH_X86 || HOST_ARCH_X86_64 || \ + HOST_ARCH_ARM || HOST_ARCH_AARCH64 || \ + HOST_ARCH_RISCV32 || HOST_ARCH_RISCV64))) # We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB depends on !EFI_STUB || !X86_64 || EFI_STUB_64BIT # We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUB

On 5/18/24 00:09, Jiaxun Yang wrote:
Since EFI loader on sandbox requires some architecture code, make it depend on HOST_ARCH to ensure it's only compiled on desired host.
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com
lib/efi_loader/Kconfig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 430bb7f0f7dc..54d180fe31c1 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -1,11 +1,14 @@ config EFI_LOADER bool "Support running UEFI applications"
- depends on OF_LIBFDT && ( \
- depends on OF_LIBFDT && (( \ ARM && (SYS_CPU = arm1136 || \ SYS_CPU = arm1176 || \ SYS_CPU = armv7 || \ SYS_CPU = armv8) || \
X86 || RISCV || SANDBOX)
X86 || RISCV) || \
The newly parentheses are not needed.
(SANDBOX && (HOST_ARCH_X86 || HOST_ARCH_X86_64 || \
HOST_ARCH_ARM || HOST_ARCH_AARCH64 || \
# We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB depends on !EFI_STUB || !X86_64 || EFI_STUB_64BIT # We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUBHOST_ARCH_RISCV32 || HOST_ARCH_RISCV64)))

sdl2-config is not cross compile friendly, it can only detect and config stuff from build host.
Use pkg-config instead, which is a generic way to config libraries on any sane system & cross toolchain should have it ready.
The output of pkg-config practically have no difference with sdl2-config.
Signed-off-by: Jiaxun Yang jiaxun.yang@flygoat.com --- Makefile | 3 ++- arch/sandbox/Kconfig | 2 +- arch/sandbox/config.mk | 5 ++--- doc/arch/sandbox/sandbox.rst | 6 ------ 4 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile index 596f6458e6b2..5e397e107a80 100644 --- a/Makefile +++ b/Makefile @@ -383,6 +383,7 @@ LDR = $(CROSS_COMPILE)ldr STRIP = $(CROSS_COMPILE)strip OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump +PKG_CONFIG = $(CROSS_COMPILE)pkg-config LEX = flex YACC = bison AWK = awk @@ -439,7 +440,7 @@ UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SU
export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR -export CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC +export CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC PKG_CONFIG export CPP AR NM LDR STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS export MAKE LEX YACC AWK PERL PYTHON PYTHON2 PYTHON3 export HOSTCXX KBUILD_HOSTCXXFLAGS CHECK CHECKFLAGS DTC DTC_FLAGS diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index c3954e33aceb..5af074e3e700 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -71,7 +71,7 @@ config HOST_ARCH_UNKNOWN !HOST_ARCH_RISCV32 && !HOST_ARCH_RISCV64
config HOST_HAS_SDL - def_bool $(success,sdl2-config --version) + def_bool $(success,$(PKG_CONFIG) sdl2)
config SANDBOX_SDL bool "Enable SDL2 support in sandbox" diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk index 6b1da993ba4e..94c11fd78918 100644 --- a/arch/sandbox/config.mk +++ b/arch/sandbox/config.mk @@ -4,13 +4,12 @@ PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE PLATFORM_CPPFLAGS += -fPIC -ffunction-sections -fdata-sections PLATFORM_LIBS += -lrt -SDL_CONFIG ?= sdl2-config
# Define this to avoid linking with SDL, which requires SDL libraries # This can solve 'sdl-config: Command not found' errors ifeq ($(CONFIG_SANDBOX_SDL),y) -PLATFORM_LIBS += $(shell $(SDL_CONFIG) --libs) -PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags) +PLATFORM_LIBS += $(shell $(PKG_CONFIG) sdl2 --libs) +PLATFORM_CPPFLAGS += $(shell $(PKG_CONFIG) sdl2 --cflags) endif
SANITIZERS := diff --git a/doc/arch/sandbox/sandbox.rst b/doc/arch/sandbox/sandbox.rst index 5f8db126657f..9ad1b654989c 100644 --- a/doc/arch/sandbox/sandbox.rst +++ b/doc/arch/sandbox/sandbox.rst @@ -526,12 +526,6 @@ For debugging with GDB or LLDB, it is preferable to reduce the compiler optimization level (CONFIG_CC_OPTIMIZE_FOR_DEBUG=y) and to disable Link Time Optimization (CONFIG_LTO=n).
-SDL_CONFIG ----------- - -If sdl-config is on a different path from the default, set the SDL_CONFIG -environment variable to the correct pathname before building U-Boot. -
Using valgrind / memcheck -------------------------
participants (2)
-
Heinrich Schuchardt
-
Jiaxun Yang