Add firmware build script for OVMF UEFI
This commit is contained in:
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# build_ovmf.sh — Build OVMF UEFI firmware (EDK2) with SMM + Secure Boot
|
||||
# ---------------------------------------------------------------------------
|
||||
# Run from inside the EDK2 source tree (build/edk2).
|
||||
# Produces a combined OVMF.fd (CODE+VARS) at:
|
||||
# Build/OvmfX64/RELEASE_GCC5/FV/OVMF.fd
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
TOOLCHAIN="${TOOLCHAIN:-GCC5}"
|
||||
TARGET="${TARGET:-RELEASE}"
|
||||
ARCH="${ARCH:-X64}"
|
||||
EDK2_DIR="${EDK2_DIR:-$(pwd)}"
|
||||
|
||||
[ -f OvmfPkg/build.sh ] || {
|
||||
echo "ERROR: not in EDK2 tree (OvmfPkg/build.sh missing) in $EDK2_DIR" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "=== Building EDK2 BaseTools (C toolchain) ==="
|
||||
make -C BaseTools/Source/C -j"$(nproc)"
|
||||
|
||||
echo "=== Initializing EDK2 environment ==="
|
||||
# shellcheck disable=SC1091
|
||||
source edksetup.sh
|
||||
|
||||
echo "=== Building OVMF ($ARCH/$TARGET/$TOOLCHAIN, SMM + Secure Boot) ==="
|
||||
OvmfPkg/build.sh \
|
||||
-a "$ARCH" \
|
||||
-b "$TARGET" \
|
||||
-t "$TOOLCHAIN" \
|
||||
-D SMM_REQUIRE=TRUE \
|
||||
-D SECURE_BOOT_ENABLE=TRUE
|
||||
|
||||
OVMF_FD="Build/OvmfX64/${TARGET}_${TOOLCHAIN}/FV/OVMF.fd"
|
||||
if [ -f "$OVMF_FD" ]; then
|
||||
echo "=== OVMF firmware ready: $OVMF_FD ($(du -h "$OVMF_FD" | cut -f1)) ==="
|
||||
else
|
||||
echo "ERROR: OVMF.fd not found at $OVMF_FD" >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user