@@ -1,16 +1,25 @@
-# Install EDK2 Base Tools in native sysroot. Currently the BaseTools are not
-# built, they are just copied to native sysroot. This is sufficient for
-# generating UEFI capsules as it only depends on some python scripts. Other
-# tools need to be built first before adding to sysroot.
+# Install EDK2 Base Tools in native sysroot. The Python BaseTools are copied
+# wholesale, and the C host tools (GenFfs, GenFv) are built so that downstream
+# recipes can generate UEFI FV images and capsules.
+#
+# SRCREV_brotli must be kept in sync with the brotli submodule commit that
+# the pinned edk2 SRCREV declares in its .gitmodules. Update it whenever
+# the edk2 SRCREV is bumped.
+# edk2-stable202602 (b7a715f7): brotli e230f474
SUMMARY = "EDK2 Base Tools"
LICENSE = "BSD-2-Clause-Patent"
# EDK2
-SRC_URI = "git://github.com/tianocore/edk2.git;branch=master;protocol=https"
+SRC_URI = " \
+ git://github.com/tianocore/edk2.git;branch=master;protocol=https \
+ git://github.com/google/brotli.git;protocol=https;nobranch=1;name=brotli;destsuffix=${BPN}-${PV}/BaseTools/Source/C/BrotliCompress/brotli \
+"
LIC_FILES_CHKSUM = "file://License.txt;md5=2b415520383f7964e96700ae12b4570a"
SRCREV = "b7a715f7c03c45c6b4575bf88596bfd79658b8ce"
+SRCREV_brotli = "e230f474b87134e8c6c85b630084c612057f253e"
+SRCREV_FORMAT = "default_brotli"
UPSTREAM_CHECK_GITTAGREGEX = "^edk2-stable(?P<pver>\d+)$"
@@ -18,7 +27,36 @@ inherit native
RDEPENDS:${PN} += "python3-core"
+do_compile() {
+ BASE_C="${S}/BaseTools/Source/C"
+
+ for d in Common BrotliCompress GenFfs GenFv; do
+ oe_runmake -C "${BASE_C}/${d}" clean 2>/dev/null || true
+ done
+ rm -f "${BASE_C}/bin/GenFfs" "${BASE_C}/bin/GenFv"
+
+ oe_runmake -C "${BASE_C}/Common"
+ oe_runmake -C "${BASE_C}/BrotliCompress"
+ oe_runmake -C "${BASE_C}/GenFfs"
+ oe_runmake -C "${BASE_C}/GenFv"
+}
+
do_install () {
mkdir -p ${D}${bindir}/edk2-BaseTools
cp -r ${S}/BaseTools/* ${D}${bindir}/edk2-BaseTools/
+
+ # Install compiled binaries to bindir so downstream recipes can reference
+ # them via ${STAGING_BINDIR_NATIVE}/GenFfs and GenFv.
+ install -d "${D}${bindir}"
+ install -m 0755 "${S}/BaseTools/Source/C/bin/GenFfs" "${D}${bindir}/"
+ install -m 0755 "${S}/BaseTools/Source/C/bin/GenFv" "${D}${bindir}/"
+
+ # Install GenerateCapsule.py and Common/ Python library under a
+ # well-known datadir path.
+ install -d "${D}${datadir}/edk2-basetools"
+ install -m 0644 \
+ "${S}/BaseTools/Source/Python/Capsule/GenerateCapsule.py" \
+ "${D}${datadir}/edk2-basetools/"
+ cp -r "${S}/BaseTools/Source/Python/Common" \
+ "${D}${datadir}/edk2-basetools/"
}
The recipe previously only copied the Python BaseTools into the native sysroot, which was sufficient for capsule signing but not for Firmware Volume (FV) creation. Downstream recipes that build UEFI capsule update images for embedded platforms need GenFfs and GenFv to assemble FV images - a key component of the UEFI Capsule Update format used for system firmware updates. Add the brotli submodule source (build-time dependency of both tools), build the C BaseTools (Common, BrotliCompress, GenFfs, GenFv) and install the binaries into ${bindir} together with GenerateCapsule.py and the Common Python library so that capsule-generating recipes can consume them from the native sysroot. Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io> --- .../uefi/edk2-basetools-native_202602.bb | 48 +++++++++++++++++-- 1 file changed, 43 insertions(+), 5 deletions(-)