Skip to content

Commit

Permalink
snapcraft: start to ship edk2 debug build
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
  • Loading branch information
mihalicyn committed Nov 21, 2023
1 parent 1603fe6 commit 8ff81e5
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,15 @@ parts:
shift
TARGET_VARS="$1"
shift
TARGET_BUILD_TYPE="$1"
shift
set -ex
(
cat << EOF
. ./edksetup.sh
make -C BaseTools ARCH="${ARCH}"
build -a "${ARCH}" -t GCC5 -b RELEASE -p "${PKG}" \
build -a "${ARCH}" -t GCC5 -b "${TARGET_BUILD_TYPE}" -p "${PKG}" \
-DSMM_REQUIRE=FALSE \
-DSECURE_BOOT_ENABLE=TRUE \
-DNETWORK_IP4_ENABLE=TRUE \
Expand All @@ -390,8 +392,8 @@ parts:
EOF
) | bash -e
cp Build/*/*/FV/${FV_CODE}.fd "${TARGET_CODE}"
cp Build/*/*/FV/${FV_VARS}.fd "${TARGET_VARS}"
cp Build/*/${TARGET_BUILD_TYPE}*/FV/${FV_CODE}.fd "${TARGET_CODE}"
cp Build/*/${TARGET_BUILD_TYPE}*/FV/${FV_VARS}.fd "${TARGET_VARS}"
if [ "$(uname -m)" = "aarch64" ]; then
truncate -s 64m "${TARGET_CODE}"
Expand All @@ -406,16 +408,34 @@ parts:
build_edk2 \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.4MB.fd" \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.fd" \
RELEASE \
-DFD_SIZE_4MB
# Legacy firmware (4MB, CSM)
if [ "$(uname -m)" = "x86_64" ]; then
build_edk2 \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.4MB.CSM.fd" \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.CSM.fd" \
RELEASE \
-DFD_SIZE_4MB \
-DCSM_ENABLE=TRUE
fi
# Debug firmware (4MB, debug mode)
# Can be enabled with the LXD boot.debug_edk2 instance option
# Set DEBUG_VERBOSE flag
if [ "$(uname -m)" = "aarch64" ]; then
sed -i "s#DEBUG_PRINT_ERROR_LEVEL = 0x8000004F#DEBUG_PRINT_ERROR_LEVEL = 0x8040004F#g" ArmVirtPkg/ArmVirt.dsc.inc
fi
if [ "$(uname -m)" = "x86_64" ]; then
sed -i "s#PcdDebugPrintErrorLevel|0x8000004F#PcdDebugPrintErrorLevel|0x8040004F#g" "${PKG}"
fi
build_edk2 \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.4MB.debug.fd" \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.debug.fd" \
DEBUG \
-DFD_SIZE_4MB
rm "${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.debug.fd"
prime:
- share/qemu/*

Expand Down Expand Up @@ -943,8 +963,8 @@ parts:
# 4MB variant
./edk2-vars-generator -f "${FIRMWARE}" \
-e ../../edk2/build/Build/*/*/*/EnrollDefaultKeys.efi \
-s ../../edk2/build/Build/*/*/*/Shell.efi \
-e ../../edk2/build/Build/*/RELEASE*/*/EnrollDefaultKeys.efi \
-s ../../edk2/build/Build/*/RELEASE*/*/Shell.efi \
-c "${CRAFT_STAGE}/share/qemu/OVMF_CODE.4MB.fd" \
-V "${CRAFT_STAGE}/share/qemu/OVMF_VARS.4MB.fd" \
-C "$(cat ubuntu-sb.crt)" \
Expand Down

0 comments on commit 8ff81e5

Please sign in to comment.