Skip to content

Commit

Permalink
Make simple-init optional
Browse files Browse the repository at this point in the history
  • Loading branch information
strongtz committed Mar 28, 2023
1 parent 91fcaad commit a92e992
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -109,6 +110,7 @@ function _build(){
-p "${ROOTDIR}/${DSC_FILE}" \
-b "${_MODE}" \
-D FIRMWARE_VER="${GITCOMMIT}" \
-D ENABLE_SIMPLE_INIT="${BUILD_GUI}" \
||return "$?"

_pack
Expand All @@ -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
Expand All @@ -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;;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

//
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions edk2-platforms/Platform/Radxa/ROCK5B/ROCK5B.fdf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a92e992

Please sign in to comment.