Skip to content

Commit

Permalink
minimize script output
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Korolev <[email protected]>
  • Loading branch information
universal-itengineer committed Jan 16, 2025
1 parent e533521 commit 1d5c55a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
40 changes: 37 additions & 3 deletions images/virt-firmware-artifact/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

# set -e

versionEdk2=stable202411
gitRepoName=edk2
versionEdk2="stable202411"
gitRepoName="edk2"
EDK2_DIR="/${gitRepoName}-${versionEdk2}"
FIRMWARE=/FIRMWARE
FIRMWARE="/FIRMWARE"

cp -f Logo.bmp $EDK2_DIR/MdeModulePkg/Logo/
cd $EDK2_DIR
Expand All @@ -37,6 +37,13 @@ download_DBXUpdate() {
curl -L $UEFI_BIN_URL_BASE/x64_DBXUpdate_$DBXDATE.bin -o $dst_dir/DBXUpdate-$DBXDATE.x64.bin
}

echo_dbg() {
local str=$1
echo ""
echo "===$str==="
echo ""
}

# compiler
CC_FLAGS="-t GCC5"
CC_FLAGS="${CC_FLAGS} -b RELEASE"
Expand Down Expand Up @@ -97,31 +104,40 @@ build_iso() {

# Build with neither SB nor SMM; include UEFI shell.
# mkdir -p OVMF
echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc"
build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc
cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.fd
cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.fd

# Build 4MB with neither SB nor SMM; include UEFI shell.
echo_dbg "build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc"
build ${OVMF_4M_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc
cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE_4M.fd
cp -p Build/OvmfX64/*/FV/OVMF_VARS.fd $FIRMWARE/OVMF_VARS_4M.fd

# Build with SB and SMM; exclude UEFI shell.
echo_dbg "build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc"
build ${OVMF_2M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc
cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE.secboot.fd

# Build 4MB with SB and SMM; exclude UEFI shell.
echo_dbg "build ${OVMF_4M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc"
build ${OVMF_4M_FLAGS} ${OVMF_SB_FLAGS} -a X64 -p OvmfPkg/OvmfPkgX64.dsc
cp -p Build/OvmfX64/*/FV/OVMF_CODE.fd $FIRMWARE/OVMF_CODE_4M.secboot.fd

# Build AmdSev and IntelTdx variants
touch OvmfPkg/AmdSev/Grub/grub.efi # dummy

echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc"
build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/AmdSev/AmdSevX64.dsc
cp -p Build/AmdSev/*/FV/OVMF.fd $FIRMWARE/OVMF.amdsev.fd

echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc"
build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/IntelTdx/IntelTdxX64.dsc
cp -p Build/IntelTdx/*/FV/OVMF.fd $FIRMWARE/OVMF.inteltdx.fd

# build shell
echo_dbg "build shell"
build ${OVMF_2M_FLAGS} -a X64 -p ShellPkg/ShellPkg.dsc
build ${OVMF_2M_FLAGS} -a IA32 -p ShellPkg/ShellPkg.dsc

Expand All @@ -133,10 +149,28 @@ cp -p Build/OvmfX64/*/X64/EnrollDefaultKeys.efi $FIRMWARE/
build_iso $FIRMWARE
download_DBXUpdate

enroll() {
virt-fw-vars --input OVMF/OVMF_VARS.fd \
--output OVMF/OVMF_VARS.secboot.fd \
--set-dbx DBXUpdate-%DBXDATE.x64.bin \
--secure-boot --enroll-altlinux --distro-keys altlinux

virt-fw-vars --input OVMF/OVMF_VARS_4M.fd \
--output OVMF/OVMF_VARS_4M.secboot.fd \
--set-dbx DBXUpdate-%DBXDATE.x64.bin \
--secure-boot --enroll-altlinux --distro-keys altlinux

virt-fw-vars --input OVMF/OVMF.inteltdx.fd \
--output OVMF/OVMF.inteltdx.secboot.fd \
--set-dbx DBXUpdate-%DBXDATE.x64.bin \
--secure-boot --enroll-altlinux --distro-keys altlinux
}

cp -p $FIRMWARE/OVMF_VARS.fd $FIRMWARE/OVMF_VARS.secboot.fd
cp -p $FIRMWARE/OVMF_VARS_4M.fd $FIRMWARE/OVMF_VARS_4M.secboot.fd
cp -p $FIRMWARE/OVMF.inteltdx.fd $FIRMWARE/OVMF.inteltdx.secboot.fd

# build microvm
echo_dbg "build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc"
build ${OVMF_2M_FLAGS} -a X64 -p OvmfPkg/Microvm/MicrovmX64.dsc
cp -p Build/MicrovmX64/*/FV/MICROVM.fd $FIRMWARE
2 changes: 1 addition & 1 deletion images/virt-firmware-artifact/werf.inc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ shell:
# mkdir -p /FIRMWARE
setup:
- |
/build.sh
/build.sh 2>&1 > /dev/null
ls -lah /FIRMWARE

0 comments on commit 1d5c55a

Please sign in to comment.