From a92e99261c7eb8f38af360eb5372919ad0f9e83f Mon Sep 17 00:00:00 2001 From: Xilin Wu Date: Tue, 28 Mar 2023 09:44:38 +0800 Subject: [PATCH] Make simple-init optional --- build.sh | 6 +++++- .../Library/PlatformBootManagerLib/PlatformBm.c | 12 ++++++++++-- edk2-platforms/Platform/Radxa/ROCK5B/ROCK5B.fdf | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index e06ef330c..a53a5f28a 100755 --- a/build.sh +++ b/build.sh @@ -8,6 +8,7 @@ function _help(){ echo "Options: " echo " --device DEV, -d DEV: build for DEV." echo " --all, -a: build all devices." + echo " --gui: Enable simple-init GUI." echo " --release MODE, -r MODE: Release mode for building, default is 'DEBUG', 'RELEASE' alternatively." echo " --toolchain TOOLCHAIN: Set toolchain, default is 'GCC5'." echo " --skip-rootfs-gen: skip generating SimpleInit rootfs to speed up building." @@ -109,6 +110,7 @@ function _build(){ -p "${ROOTDIR}/${DSC_FILE}" \ -b "${_MODE}" \ -D FIRMWARE_VER="${GITCOMMIT}" \ + -D ENABLE_SIMPLE_INIT="${BUILD_GUI}" \ ||return "$?" _pack @@ -133,7 +135,8 @@ DISTCLEAN=false TOOLCHAIN=GCC5 export ROOTDIR OUTDIR export GEN_ROOTFS=true -OPTS="$(getopt -o t:d:haCDO:r -l toolchain:,device:,help,all,skip-rootfs-gen,clean,distclean,outputdir:,release: -n 'build.sh' -- "$@")"||exit 1 +export BUILD_GUI=false +OPTS="$(getopt -o t:d:haCDO:r -l toolchain:,device:,help,all,skip-rootfs-gen,gui,clean,distclean,outputdir:,release: -n 'build.sh' -- "$@")"||exit 1 eval set -- "${OPTS}" while true do case "${1}" in @@ -143,6 +146,7 @@ do case "${1}" in -D|--distclean) DISTCLEAN=true;shift;; -O|--outputdir) OUTDIR="${2}";shift 2;; --skip-rootfs-gen) GEN_ROOTFS=false;shift;; + --gui) BUILD_GUI=true;shift;; -r|--release) MODE="${2}";shift 2;; -t|--toolchain) TOOLCHAIN="${2}";shift 2;; -h|--help) _help 0;shift;; diff --git a/edk2-platforms/Platform/Radxa/ROCK5B/Library/PlatformBootManagerLib/PlatformBm.c b/edk2-platforms/Platform/Radxa/ROCK5B/Library/PlatformBootManagerLib/PlatformBm.c index d03878e04..8adeceae1 100755 --- a/edk2-platforms/Platform/Radxa/ROCK5B/Library/PlatformBootManagerLib/PlatformBm.c +++ b/edk2-platforms/Platform/Radxa/ROCK5B/Library/PlatformBootManagerLib/PlatformBm.c @@ -639,8 +639,9 @@ PlatformRegisterOptionsAndKeys ( // Map F3 to SimpleInit GUI F3.ScanCode = SCAN_F3; F3.UnicodeChar = CHAR_NULL; - +#ifdef ENABLE_SIMPLE_INIT PlatformRegisterFvBootOption (&gSimpleInitFileGuid, L"Simple Init", LOAD_OPTION_ACTIVE, &F3); +#endif } // @@ -966,8 +967,11 @@ PlatformBootManagerAfterConsole ( PcdGetPtr (PcdFirmwareVersionString) ); } - +#ifdef ENABLE_SIMPLE_INIT Print (L"Press ESCAPE for boot options, or F3 for SimpleInit GUI"); +#else + Print (L"Press ESCAPE for boot options"); +#endif } else if (FirmwareVerLength > 0) { Status = gBS->HandleProtocol ( gST->ConsoleOutHandle, @@ -1045,7 +1049,11 @@ PlatformBootManagerWaitCallback ( Status = BootLogoUpdateProgress ( White.Pixel, Black.Pixel, +#ifdef ENABLE_SIMPLE_INIT L"Press ESCAPE for boot options, or F3 for SimpleInit GUI", +#else + L"Press ESCAPE for boot options", +#endif White.Pixel, (Timeout - TimeoutRemain) * 100 / Timeout, 0 diff --git a/edk2-platforms/Platform/Radxa/ROCK5B/ROCK5B.fdf b/edk2-platforms/Platform/Radxa/ROCK5B/ROCK5B.fdf index 8ddb31b2e..33ef05c83 100644 --- a/edk2-platforms/Platform/Radxa/ROCK5B/ROCK5B.fdf +++ b/edk2-platforms/Platform/Radxa/ROCK5B/ROCK5B.fdf @@ -331,7 +331,9 @@ READ_LOCK_STATUS = TRUE # # Simple Init GUI # +!if $(ENABLE_SIMPLE_INIT) INF src/main/SimpleInitMain.inf +!endif [FV.BL33_AP_UEFI] FvAlignment = 8