Skip to content

Commit

Permalink
Generate capsules after building
Browse files Browse the repository at this point in the history
UEFI capsules require versions be represented as a u32, so our current
versioning scheme is not usable. Hard-code the versions to 1 for now.

fwupd can represent this u32 in multiple ways depending on the
`VersionFormat` specified in the MetaInfo or a quirk.

Ref: https://github.com/fwupd/fwupd/blob/1.8.12/plugins/uefi-capsule/README.md#version-format
Signed-off-by: Tim Crawford <[email protected]>
  • Loading branch information
crawfxrd committed Nov 2, 2023
1 parent d3580f2 commit c099ec0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ REV="$(git describe --always --dirty --abbrev=7)"
VERSION="${DATE}_${REV}"
echo "Building '${VERSION}' for '${MODEL}'"

# Path to edk2's Python script to generate UEFI capsules
GENERATE_CAPSULE="./edk2/BaseTools/BinWrappers/PosixLike/GenerateCapsule"

# Clean build directory
mkdir -p build
BUILD="$(realpath "build/${MODEL}")"
Expand Down Expand Up @@ -69,6 +72,9 @@ then
done < "${MODEL_DIR}/edk2.config"
fi

# Source edk2 config for FMP values
. "$MODEL_DIR/edk2.config"

# Rebuild UefiPayloadPkg using edk2
PACKAGES_PATH="${MODEL_DIR}:$(realpath apps)" \
./scripts/_build/edk2.sh \
Expand All @@ -83,13 +89,33 @@ KERNELVERSION="${VERSION}" \
"${MODEL_DIR}/coreboot.config" \
"${COREBOOT}"

if [ "$MODEL" != "qemu" ]; then
# Generate system firmware capsule
SYSTEM_FMP_VERSION=1
$GENERATE_CAPSULE -e \
--guid "$SYSTEM_FMP_UUID" \
--fw-version "$SYSTEM_FMP_VERSION" \
--lsv 0 \
-o "$BUILD/firmware.cap" \
"$BUILD/firmware.rom"
fi

# Rebuild EC firmware for System76 EC models
if [ ! -e "${MODEL_DIR}/ec.rom" ] && [ -e "${MODEL_DIR}/ec.config" ]
then
env VERSION="${VERSION}" \
./scripts/_build/ec.sh \
"${MODEL_DIR}/ec.config" \
"${BUILD}/ec.rom"

# Generate EC firmware capsule
EC_FMP_VERSION=1
$GENERATE_CAPSULE -e \
--guid "$EC_FMP_UUID" \
--fw-version "$EC_FMP_VERSION" \
--lsv 0 \
-o "$BUILD/ec.cap" \
"$BUILD/ec.rom"
fi

if [ "${MODEL}" != "qemu" ]
Expand Down

0 comments on commit c099ec0

Please sign in to comment.