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 16, 2023
1 parent 1b59972 commit 1c8ba21
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,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 @@ -391,8 +393,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 @@ -407,12 +409,14 @@ 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
# Compatibility firmware (2MB, no CSM)
build_edk2 \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.2MB.fd" \
"${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.2MB.fd" \
RELEASE \
-DFD_SIZE_2MB
ln -s OVMF_CODE.2MB.fd "${CRAFT_PART_INSTALL}/share/qemu/OVMF_CODE.fd"
ln -s OVMF_VARS.2MB.fd "${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.fd"
Expand All @@ -422,9 +426,26 @@ parts:
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 @@ -952,17 +973,17 @@ 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)" \
-o "${CRAFT_PART_INSTALL}/share/qemu/OVMF_VARS.4MB.ms.fd"
# 2MB 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.2MB.fd" \
-V "${CRAFT_STAGE}/share/qemu/OVMF_VARS.2MB.fd" \
-C "$(cat ubuntu-sb.crt)" \
Expand Down

0 comments on commit 1c8ba21

Please sign in to comment.