OpenDuet: Re-use DEBUG EfiLdr in NOOPT build

NOOPT EfiLdr is too large to fit in 0x10000-x020000 allotted space, but
we would like to be able to debug everything else in NOOPT. By re-using
DEBUG build EfiLdr in NOOPT, we can.

In fairness, this is a horrible hack - in particular it requires DEBUG
OpenDuet to be built before NOOPT - but it works with the current build
system, and has the arguable advantage of not affecting non-NOOPT builds
at all.
This commit is contained in:
Mike Beaton 2024-04-24 23:23:29 +01:00
parent 18071fc9bf
commit 047b4d4af4
2 changed files with 9 additions and 2 deletions

View File

@ -180,7 +180,10 @@
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
OpenCorePkg/Legacy/BootPlatform/SmbiosGenDxe/SmbiosGen.inf
!if $(TARGET) != NOOPT
# We will reuse DEBUG EfiLdr in NOOPT build to keep within allotted 0x10000-0x20000 space.
OpenCorePkg/Legacy/BootPlatform/EfiLdr/EfiLdr.inf
!endif
OpenCorePkg/Legacy/BootPlatform/BdsDxe/BdsDxe.inf {
<LibraryClasses>
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf

View File

@ -36,8 +36,12 @@ imgbuild() {
"${BUILD_DIR_ARCH}/DxeIplUe.raw" || exit 1
echo "Generating Loader Image..."
ImageTool GenImage -c PE -x -b 0x10000 -o "${BUILD_DIR_ARCH}/EfiLoaderRebased.efi" "${BUILD_DIR_ARCH}/EfiLoader.efi" || exit 1
# Reuse DEBUG EfiLdr in NOOPT build to keep within allotted 0x10000-0x20000 space.
# With this approach, everything after EfiLdr is fully NOOPT, but EfiLdr starts.
# TODO: Look at moving EFILDR_BASE_SEGMENT (see also kBoot2Segment, BASE_ADDR_32)
# to make space for NOOPT loader.
SAFE_LOADER=$(echo "${BUILD_DIR_ARCH}/EfiLoader.efi" | sed -e 's/NOOPT/DEBUG/')
ImageTool GenImage -c PE -x -b 0x10000 -o "${BUILD_DIR_ARCH}/EfiLoaderRebased.efi" "${SAFE_LOADER}" || exit 1
"${FV_TOOLS}/EfiLdrImage" -o "${BUILD_DIR}/FV/Efildr${arch}" \
"${BUILD_DIR_ARCH}/EfiLoaderRebased.efi" "${BUILD_DIR}/FV/DxeIpl${arch}.z" \