sandbox: Rework how SDL is enabled / disabled

Given that we can use Kconfig logic directly to see if we have a program
available on the host or not, change from passing NO_SDL to instead
controlling CONFIG_SANDBOX_SDL in Kconfig directly. Introduce
CONFIG_HOST_HAS_SDL as the way to test for sdl2-config and default
CONFIG_SANDBOX_SDL on if we have that, or not.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Tom Rini 2022-11-19 18:45:43 -05:00
parent 17f13e7119
commit d948c8988c
7 changed files with 15 additions and 17 deletions

View file

@ -30,7 +30,7 @@ stages:
%CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm --needed -Sy make gcc bison flex diffutils openssl-devel libgnutls-devel libutil-linux-devel" %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm --needed -Sy make gcc bison flex diffutils openssl-devel libgnutls-devel libutil-linux-devel"
displayName: 'Install Toolchain' displayName: 'Install Toolchain'
- script: | - script: |
echo make tools-only_defconfig tools-only NO_SDL=1 > build-tools.sh echo make tools-only_defconfig tools-only > build-tools.sh
%CD:~0,2%\msys64\usr\bin\bash -lc "bash build-tools.sh" %CD:~0,2%\msys64\usr\bin\bash -lc "bash build-tools.sh"
displayName: 'Build Host Tools' displayName: 'Build Host Tools'
env: env:
@ -47,7 +47,7 @@ stages:
- script: brew install make ossp-uuid - script: brew install make ossp-uuid
displayName: Brew install dependencies displayName: Brew install dependencies
- script: | - script: |
gmake tools-only_config tools-only NO_SDL=1 \ gmake tools-only_config tools-only \
HOSTCFLAGS="-I/usr/local/opt/openssl@1.1/include" \ HOSTCFLAGS="-I/usr/local/opt/openssl@1.1/include" \
HOSTLDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \ HOSTLDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \
-j$(sysctl -n hw.logicalcpu) -j$(sysctl -n hw.logicalcpu)

View file

@ -47,6 +47,13 @@ config HOST_32BIT
config HOST_64BIT config HOST_64BIT
def_bool $(cc-define,_LP64) def_bool $(cc-define,_LP64)
config HOST_HAS_SDL
def_bool $(success,sdl2-config --version)
config SANDBOX_SDL
bool "Enable SDL2 support in sandbox"
default HOST_HAS_SDL
config SANDBOX_CRASH_RESET config SANDBOX_CRASH_RESET
bool "Reset on crash" bool "Reset on crash"
help help

View file

@ -8,9 +8,7 @@ SDL_CONFIG ?= sdl2-config
# Define this to avoid linking with SDL, which requires SDL libraries # Define this to avoid linking with SDL, which requires SDL libraries
# This can solve 'sdl-config: Command not found' errors # This can solve 'sdl-config: Command not found' errors
ifneq ($(NO_SDL),) ifeq ($(CONFIG_SANDBOX_SDL),y)
PLATFORM_CPPFLAGS += -DSANDBOX_NO_SDL
else
PLATFORM_LIBS += $(shell $(SDL_CONFIG) --libs) PLATFORM_LIBS += $(shell $(SDL_CONFIG) --libs)
PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags) PLATFORM_CPPFLAGS += $(shell $(SDL_CONFIG) --cflags)
endif endif

View file

@ -56,11 +56,8 @@ To run sandbox U-Boot use something like::
Note: If you get errors about 'sdl-config: Command not found' you may need to Note: If you get errors about 'sdl-config: Command not found' you may need to
install libsdl2.0-dev or similar to get SDL support. Alternatively you can install libsdl2.0-dev or similar to get SDL support. Alternatively you can
build sandbox without SDL (i.e. no display/keyboard support) by removing build sandbox without SDL (i.e. no display/keyboard support) by disabling
the CONFIG_SANDBOX_SDL line in include/configs/sandbox.h or using:: CONFIG_SANDBOX_SDL in the .config file.
make sandbox_defconfig all NO_SDL=1
./u-boot
U-Boot will start on your computer, showing a sandbox emulation of the serial U-Boot will start on your computer, showing a sandbox emulation of the serial
console:: console::
@ -84,7 +81,7 @@ To exit, type 'poweroff' or press Ctrl-C.
Console / LCD support Console / LCD support
--------------------- ---------------------
Assuming that CONFIG_SANDBOX_SDL is defined when building, you can run the Assuming that CONFIG_SANDBOX_SDL is enabled when building, you can run the
sandbox with LCD and keyboard emulation, using something like:: sandbox with LCD and keyboard emulation, using something like::
./u-boot -d u-boot.dtb -l ./u-boot -d u-boot.dtb -l

2
doc/build/tools.rst vendored
View file

@ -44,4 +44,4 @@ applications using a linux toolchain (gcc, bash, etc), targeting respectively
Launch the MSYS2 shell of the MSYS2 environment, and do the following:: Launch the MSYS2 shell of the MSYS2 environment, and do the following::
$ make tools-only_defconfig $ make tools-only_defconfig
$ make tools-only NO_SDL=1 $ make tools-only

View file

@ -622,7 +622,7 @@ config VIDEO_ARM_MALIDP
config VIDEO_SANDBOX_SDL config VIDEO_SANDBOX_SDL
bool "Enable sandbox video console using SDL" bool "Enable sandbox video console using SDL"
depends on SANDBOX depends on SANDBOX_SDL
help help
When using sandbox you can enable an emulated LCD display which When using sandbox you can enable an emulated LCD display which
appears as an SDL (Simple DirectMedia Layer) window. This is a appears as an SDL (Simple DirectMedia Layer) window. This is a

View file

@ -18,8 +18,4 @@
#define CFG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ #define CFG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\
115200} 115200}
#ifndef SANDBOX_NO_SDL
#define CONFIG_SANDBOX_SDL
#endif
#endif #endif