mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-23 11:17:21 -08:00
sys-firmware/edk2: Version bump to 202608, respect MAKEOPTS
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
DIST amd64_DBXUpdate_v1.6.3.bin 24053 BLAKE2B 4796ce3218df9c29d88fe5a14975e0b7ac2dc1271dd89ba1e6b7c1f898d196deab698bf93e527aa4c5802a0a4092556c4480220baa349cd98ddf8b500767225a SHA512 0452d2c302f702eeb2d549fd5ac4b3c3623172de9559a881bc92875590f3c5b65e301b880f5f76786e22b1af145b2aa6e58c74fef00a279950f3d6641aef484e
|
||||
DIST amd64_DBXUpdate_v1.6.4.bin 24053 BLAKE2B 4796ce3218df9c29d88fe5a14975e0b7ac2dc1271dd89ba1e6b7c1f898d196deab698bf93e527aa4c5802a0a4092556c4480220baa349cd98ddf8b500767225a SHA512 0452d2c302f702eeb2d549fd5ac4b3c3623172de9559a881bc92875590f3c5b65e301b880f5f76786e22b1af145b2aa6e58c74fef00a279950f3d6641aef484e
|
||||
DIST amd64_DBXUpdate_v1.6.5.bin 24629 BLAKE2B 1dfa948e332cb3a75e101f6fac85090c6d89ca61515f6ee462b9b1dfa660a65a791b33cdeaf4f29a1bb36a13f9282dc3256039ec64cd863ecdabad3fabace773 SHA512 8cf211928e8ee61287ab1367c55c8f22b0729a40190597a2896c0d1afceca717a040525e7e842b6814753afae519301471a79cabfbd12619516dc4c1f6a36b67
|
||||
DIST arm64_DBXUpdate_v1.6.3.bin 4613 BLAKE2B 1a60e4e54416886111451e51bf9bdcc08f5da696050cc47cf941b1e040f7e872b1cf05e653366e31395e68bcafc689b30419e7c6133821434251341edf6f3d3c SHA512 2af6d22d139ff58cb2d0dc0883257b6131f1bd9cc04b4c062c21f1d0560508f8f4ea062e6946fd37c8ab47259772884e29c32a93844d5d6beadcf9e778e4ee51
|
||||
DIST arm64_DBXUpdate_v1.6.4.bin 4613 BLAKE2B 1a60e4e54416886111451e51bf9bdcc08f5da696050cc47cf941b1e040f7e872b1cf05e653366e31395e68bcafc689b30419e7c6133821434251341edf6f3d3c SHA512 2af6d22d139ff58cb2d0dc0883257b6131f1bd9cc04b4c062c21f1d0560508f8f4ea062e6946fd37c8ab47259772884e29c32a93844d5d6beadcf9e778e4ee51
|
||||
DIST arm64_DBXUpdate_v1.6.5.bin 4613 BLAKE2B 1a60e4e54416886111451e51bf9bdcc08f5da696050cc47cf941b1e040f7e872b1cf05e653366e31395e68bcafc689b30419e7c6133821434251341edf6f3d3c SHA512 2af6d22d139ff58cb2d0dc0883257b6131f1bd9cc04b4c062c21f1d0560508f8f4ea062e6946fd37c8ab47259772884e29c32a93844d5d6beadcf9e778e4ee51
|
||||
DIST brotli-e230f474b87134e8c6c85b630084c612057f253e.tar.gz 646535 BLAKE2B cac5c68aa0c0ed1b47a1d97c86edc444ab21cdf66e51b66b5ce9f39af67640d3e0ac076c7b3e23be0a7c2c7e3436ea25e9972a2c577d0822a578e1720cd109e4 SHA512 007068eae049e80f91ffac3be12159f7278ce2237f969055dc1bc07b87e44eaa4f5dab70940710bf2e673134cb9ad9c0fd3f46c9f93d16905fb4ddc3e0f88c3e
|
||||
DIST edk2-202511.tar.gz 18471528 BLAKE2B c3d484061c1360bb2f3f08114875699ecc1cb03c90949c6cbfa140865c83fef5dabe3df4e37d12a8d71f2484c18ae0fbae6c28b56c0404ce6fa8112b5961ef8d SHA512 0a9d70b9fa72457eac0937cbca1f02ed101ffc50dd67be6ca0f4d290b0ade32d9000637060242a5980890e29818186c7bc77b8ff940541759089519302ab1c20
|
||||
DIST edk2-202605.tar.gz 19124502 BLAKE2B b0c4a295da31d9f6a363549620a784ec9ac45100355c5382101d083bf51eb433538f36c05d510b4cfa6ab0ff4cf0e68c80a57e278f3fedab399e272dd13cae75 SHA512 8efa22812e5cee78f2934a68bf6515528885c9133d1b1b138193eefa664e77232ee6af6219538db6e5f82bc81f6b2d7ca53be82657ed4ea415fb17676d250746
|
||||
DIST edk2-202608.tar.gz 19498751 BLAKE2B 9604ece7b60b54da5f41d817f05d532afe27dd9ff3e7e3bfaa50959d30d239f5042a749344978c3665ac419a863a21247f56ce5dc8ce369ae0b3f23b74a6eb69 SHA512 1f59215623dc9686102c18738c5cbb20d859708d49c2ea3be74cb692f414b74285671742cd9cf79706b6dccc72258e01645a2ec3ac84a9bb53f036284f165dd2
|
||||
DIST libspdm-1be116c7b7713fa9003e1bd53b53a34758549eb9.tar.gz 2050057 BLAKE2B a792993811fd9781342164e6619659d70c8bbe5d82a2938ca75532bdfd4948925fd9c773b23117b3f31c051b5dc1870c59d984c1f3e9f12fdbdbf2028dae6dde SHA512 860a8b39df7db8a82134dd28e71507e4a7da411c410b419470abc89e898d6be2ffd9326dd7c43fd801de9c7028a2920863a76e616582e4f73fa5048463c3f763
|
||||
DIST libspdm-98ef964e1e9a0c39c7efb67143d3a13a819432e0.tar.gz 2017163 BLAKE2B 312528eb0af2cffb4d3557354ada87302b471a4c1cc73bad74a60162cdbb057be392fd57f18bef99a437ccb879583c69afb2596bf120656787b4b6530005316d SHA512 366155f146f47f7fe81c2b7863c3dff6339dd017b3d8ebe2e843ee04fedb6911193248cea2d048547a4389b4727c1576d5b6c1f26bbe83362299b52d72527f52
|
||||
DIST libspdm-f55cf6d48ec69b4ac60a63903e9c6a2cb0fd155d.tar.gz 2102470 BLAKE2B d2b8f3b5ea4d13bce0e8bb971f61e23e8adc38bf40c2effa78754486ba4b6c8ede2e43bb32b7220fd5153802617293d865daecda40922e28596cb4afbe2fdbdc SHA512 9d9809be06773065f0cccf42b559c40881c113341f4e5e7f4a0051fa692a721b76fb7b1d912b3c8839158d1142fb00740d6f91d02f940fdcf50a2fc0e80625cd
|
||||
DIST mbedtls-0bebf8b8c7f07abe3571ded48a11aa907a1ffb20.tar.gz 5720744 BLAKE2B 5b434cd922ca16f4a7afae155c5ce8db1e18607e719db9f9a25b60dd2557e93b5596f32eaa201e4706bc25b2dd5e575067687094d5e0cecb54f1f18c7091f4b0 SHA512 9e25ca4e3fd497c41821aa904219c5a49bc7a6b765be6aa4b19626fb70ee75ba60bb4e02806a7a840c8c3f5954631fa6b6aeeff0592647083795ad02971fe73e
|
||||
DIST mbedtls-8c89224991adff88d53cd380f42a2baa36f91454.tar.gz 4587796 BLAKE2B c28df5c52ac3ed5ef6a2b9eba29f3894d3f5f11083869e8b137cd66d4f72b2a0971c91636ce4626869bd06eeb5e661d90160021f92564b9449fb13001b8e379f SHA512 a421c03c740867210f9e30457bc951928cafec3622e1e304f8c18ce5c5e27c5c8e6c7715180ecb74c6a997e4b91ee160e52b357e1bb65ff76ce8414a87ec4889
|
||||
DIST mipi-sys-t-370b5944c046bab043dd8b133727b2135af7747a.tar.gz 378522 BLAKE2B d3f1033e78ad814ebb991e66d8c1437aa3583e91481af9785b97b6021c7c45fb9dcb8d2d58d0a0fe84fbd9f108d24a27234df298eb8a2ba2340e5c9c85c89c40 SHA512 de6888577ceab7ab6915d792f3c48248cfa53357ccd310fc7f7eae4d25a932de8c7c23e5b898c9ebf61cf86cb538277273f2eb131a628b3bf0d46c9a3b9b6686
|
||||
DIST openssl-3.5.1.tar.gz 53158817 BLAKE2B 172db56ac41cee78bcb5d2223c33d78baf3326d8d466115f39be414384d265ad4541e00096d3f53435f9f89119882ae587b20b1ac05dc2ace46a0d43d7cc6996 SHA512 0fa152ae59ab5ea066319de039dfb1d24cbb247172d7512feb5dd920db3740f219d76b0195ea562f84fe5eae36c23772302eddfbb3509df13761452b4dafb9d3
|
||||
DIST openssl-3.5.7.tar.gz 53153930 BLAKE2B e19d7e40e9aaed0e4b4a405866ac56f37a03dc5c57cf1a2452ca547a5a9cab7771254d6ab8ce7df36b20d8145ba435aa5158c80be97d3887b3ef51db3cdd7428 SHA512 de5351d2d532e1a3908a738f7d8aae448d32bc60bdb24808c556a24bc37a3f53daedf12b5d432eeb8c235e16939d842f908332ede8a447ca103ad1c493c820d7
|
||||
DIST openssl-3.5.8.tar.gz 53213818 BLAKE2B dc96fd5959f9719f1a36fe25a955cad414b0552f92e34ec3c41ec2a722282e71a47aa513267ee0aff60599b51ca63f4344b3327e4c158679699bf524d5f3af8a SHA512 62a1dbed0fad75245b332e41b85a1f7c2379189525e7628a7cf68947d115e90a47f179e3f87d27641e5b2d357c357292179fc0e64eccecdebc81c083f7a8ebe4
|
||||
DIST pylibfdt-cfff805481bdea27f900c32698171286542b8d3c.tar.gz 49659 BLAKE2B 05e954fc2d72618b3f56c08bdfcd64479259902ee2613d034b66ebe50e33b02b243bed1191d8dcdcea9fcb2553f84a737ae12514d30c48e776efc858a4879894 SHA512 c2f4cbda24bc4a2140135de2db19fd7ad0b6eff2a748862b4166bf0e65f3e324e2855ea4331dafa2c82f44b4d01309c8ac50159cbcc076a968a1169c8709a523
|
||||
|
||||
@@ -0,0 +1,383 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_REQ_USE="sqlite"
|
||||
PYTHON_COMPAT=( python3_{12..14} )
|
||||
|
||||
inherit edo multiprocessing prefix python-any-r1 readme.gentoo-r1 secureboot toolchain-funcs
|
||||
|
||||
DESCRIPTION="TianoCore EDK II UEFI firmware for virtual machines"
|
||||
HOMEPAGE="https://github.com/tianocore/edk2"
|
||||
|
||||
BUNDLED_BROTLI_SUBMODULE_SHA="e230f474b87134e8c6c85b630084c612057f253e"
|
||||
BUNDLED_LIBFDT_SUBMODULE_SHA="cfff805481bdea27f900c32698171286542b8d3c"
|
||||
BUNDLED_LIBSPDM_SUBMODULE_SHA="f55cf6d48ec69b4ac60a63903e9c6a2cb0fd155d"
|
||||
BUNDLED_MBEDTLS_SUBMODULE_SHA="0bebf8b8c7f07abe3571ded48a11aa907a1ffb20"
|
||||
BUNDLED_MIPI_SYS_T_SUBMODULE_SHA="370b5944c046bab043dd8b133727b2135af7747a"
|
||||
BUNDLED_OPENSSL_SUBMODULE_P="openssl-3.5.8"
|
||||
|
||||
SBO_VER="1.6.5" # https://github.com/microsoft/secureboot_objects/releases
|
||||
DBX_URI="https://github.com/microsoft/secureboot_objects/raw/refs/tags/v${SBO_VER}/PostSignedObjects/DBX/@ARCH@/DBXUpdate.bin -> @ARCH@_DBXUpdate_v${SBO_VER}.bin"
|
||||
|
||||
SRC_URI="
|
||||
https://github.com/tianocore/${PN}/archive/${PN}-stable${PV}.tar.gz
|
||||
-> ${P}.tar.gz
|
||||
https://github.com/google/brotli/archive/${BUNDLED_BROTLI_SUBMODULE_SHA}.tar.gz
|
||||
-> brotli-${BUNDLED_BROTLI_SUBMODULE_SHA}.tar.gz
|
||||
https://github.com/DMTF/libspdm/archive/${BUNDLED_LIBSPDM_SUBMODULE_SHA}.tar.gz
|
||||
-> libspdm-${BUNDLED_LIBSPDM_SUBMODULE_SHA}.tar.gz
|
||||
https://github.com/Mbed-TLS/mbedtls/archive/${BUNDLED_MBEDTLS_SUBMODULE_SHA}.tar.gz
|
||||
-> mbedtls-${BUNDLED_MBEDTLS_SUBMODULE_SHA}.tar.gz
|
||||
https://github.com/MIPI-Alliance/public-mipi-sys-t/archive/${BUNDLED_MIPI_SYS_T_SUBMODULE_SHA}.tar.gz
|
||||
-> mipi-sys-t-${BUNDLED_MIPI_SYS_T_SUBMODULE_SHA}.tar.gz
|
||||
https://github.com/openssl/openssl/releases/download/${BUNDLED_OPENSSL_SUBMODULE_P}/${BUNDLED_OPENSSL_SUBMODULE_P}.tar.gz
|
||||
|
||||
amd64? ( ${DBX_URI//@ARCH@/amd64} )
|
||||
arm64? ( ${DBX_URI//@ARCH@/arm64} )
|
||||
|
||||
!amd64? (
|
||||
https://github.com/devicetree-org/pylibfdt/archive/${BUNDLED_LIBFDT_SUBMODULE_SHA}.tar.gz
|
||||
-> pylibfdt-${BUNDLED_LIBFDT_SUBMODULE_SHA}.tar.gz
|
||||
)
|
||||
"
|
||||
|
||||
S="${WORKDIR}/${PN}-${PN}-stable${PV}"
|
||||
LICENSE="BSD-2-with-patent MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="-* ~amd64 ~arm64 ~loong ~riscv"
|
||||
|
||||
BDEPEND="
|
||||
${PYTHON_DEPS}
|
||||
app-emulation/qemu
|
||||
app-emulation/virt-firmware
|
||||
>=sys-power/iasl-20160729
|
||||
amd64? ( >=dev-lang/nasm-2.0.7 )
|
||||
"
|
||||
|
||||
RDEPEND="
|
||||
!sys-firmware/edk2-bin
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-202608-fix-gic-hvf.patch"
|
||||
"${FILESDIR}/${PN}-202608-werror.patch"
|
||||
"${FILESDIR}/${PN}-202505-UninstallMemAttrProtocol.patch"
|
||||
)
|
||||
|
||||
DISABLE_AUTOFORMATTING="true"
|
||||
DIR="/usr/share/${PN}"
|
||||
|
||||
pkg_setup() {
|
||||
python-any-r1_pkg_setup
|
||||
secureboot_pkg_setup
|
||||
|
||||
local QEMU_ARCH ARCH_DIRS UNIT0 UNIT1 FMT
|
||||
|
||||
case "${ARCH}" in
|
||||
amd64)
|
||||
TARGET_ARCH="X64"
|
||||
QEMU_ARCH="x86_64"
|
||||
ARCH_DIRS="${DIR}/OvmfX64"
|
||||
UNIT0="OVMF_CODE.fd"
|
||||
UNIT1="OVMF_VARS.fd"
|
||||
FMT="raw"
|
||||
;;
|
||||
arm64)
|
||||
TARGET_ARCH="AARCH64"
|
||||
QEMU_ARCH="aarch64"
|
||||
ARCH_DIRS="${DIR}/ArmVirtQemu-AARCH64"
|
||||
UNIT0="QEMU_EFI.qcow2"
|
||||
UNIT1="QEMU_VARS.qcow2"
|
||||
FMT="qcow2"
|
||||
;;
|
||||
loong)
|
||||
TARGET_ARCH="LOONGARCH64"
|
||||
QEMU_ARCH="loongarch64"
|
||||
ARCH_DIRS="${DIR}/LoongArchVirtQemu"
|
||||
UNIT0="QEMU_EFI.qcow2"
|
||||
UNIT1="QEMU_VARS.qcow2"
|
||||
FMT="qcow2"
|
||||
;;
|
||||
riscv)
|
||||
TARGET_ARCH="RISCV64"
|
||||
QEMU_ARCH="riscv64"
|
||||
ARCH_DIRS="${DIR}/RiscVVirtQemu"
|
||||
UNIT0="RISCV_VIRT_CODE.qcow2"
|
||||
UNIT1="RISCV_VIRT_VARS.qcow2"
|
||||
FMT="qcow2"
|
||||
;;
|
||||
esac
|
||||
|
||||
DOC_CONTENTS="This package includes the TianoCore EDK II UEFI firmware for ${QEMU_ARCH}
|
||||
virtual machines. The firmware is located under ${ARCH_DIRS}.
|
||||
|
||||
In order to use the firmware, you can run QEMU like so:
|
||||
|
||||
$ qemu-system-${QEMU_ARCH} \\
|
||||
-drive file=${EPREFIX}${ARCH_DIRS%% *}/${UNIT0},if=pflash,format=${FMT},unit=0,readonly=on \\
|
||||
-drive file=/path/to/the/copy/of/${UNIT1},if=pflash,format=${FMT},unit=1 \\
|
||||
..."
|
||||
|
||||
case "${ARCH}" in
|
||||
amd64) DOC_CONTENTS+="
|
||||
|
||||
The firmware does not support CSM due to the lack of a free
|
||||
implementation. If you need a firmware with CSM support, you have to
|
||||
download one for yourself. Firmware blobs are commonly labelled:
|
||||
|
||||
OVMF_CODE-with-csm.fd
|
||||
OVMF_VARS-with-csm.fd"
|
||||
;;
|
||||
arm64) DOC_CONTENTS+="
|
||||
|
||||
WARNING! QEMU_EFI.secboot_INSECURE.qcow2 does have Secure Boot
|
||||
enabled, but it must not be used in production. The lack of an SMM
|
||||
implementation for arm64 in this firmware means that the EFI
|
||||
variable store is unprotected, making the firmware unsafe."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
link_mod() {
|
||||
rmdir "$2" && ln -sfT "$1" "$2" || die "linking ${2##*/} failed"
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
# Bundled submodules
|
||||
link_mod "${WORKDIR}/brotli-${BUNDLED_BROTLI_SUBMODULE_SHA}" \
|
||||
BaseTools/Source/C/BrotliCompress/brotli
|
||||
link_mod "${WORKDIR}/brotli-${BUNDLED_BROTLI_SUBMODULE_SHA}" \
|
||||
MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
|
||||
link_mod "${WORKDIR}/libspdm-${BUNDLED_LIBSPDM_SUBMODULE_SHA}" \
|
||||
SecurityPkg/DeviceSecurity/SpdmLib/libspdm
|
||||
link_mod "${WORKDIR}/mbedtls-${BUNDLED_MBEDTLS_SUBMODULE_SHA}" \
|
||||
CryptoPkg/Library/MbedTlsLib/mbedtls
|
||||
link_mod "${WORKDIR}/public-mipi-sys-t-${BUNDLED_MIPI_SYS_T_SUBMODULE_SHA}" \
|
||||
MdePkg/Library/MipiSysTLib/mipisyst
|
||||
link_mod "${WORKDIR}/${BUNDLED_OPENSSL_SUBMODULE_P}" \
|
||||
CryptoPkg/Library/OpensslLib/openssl
|
||||
|
||||
[[ -e ${DISTDIR}/pylibfdt-${BUNDLED_LIBFDT_SUBMODULE_SHA}.tar.gz ]] &&
|
||||
link_mod "${WORKDIR}/pylibfdt-${BUNDLED_LIBFDT_SUBMODULE_SHA}" \
|
||||
MdePkg/Library/BaseFdtLib/libfdt
|
||||
|
||||
default
|
||||
|
||||
# Fix descriptor paths for prefix.
|
||||
hprefixify "${FILESDIR}"/descriptors/*.json
|
||||
}
|
||||
|
||||
my_build() {
|
||||
edo build \
|
||||
-n "$(get_makeopts_jobs)" \
|
||||
-t "${TOOLCHAIN}" \
|
||||
-b "${BUILD_TARGET}" \
|
||||
-a "${TARGET_ARCH}" \
|
||||
-D NETWORK_HTTP_BOOT_ENABLE \
|
||||
-D NETWORK_IP6_ENABLE \
|
||||
-D NETWORK_TLS_ENABLE \
|
||||
-D TPM1_ENABLE \
|
||||
-D TPM2_ENABLE \
|
||||
-D TPM2_CONFIG_ENABLE \
|
||||
"${BUILD_ARGS[@]}" \
|
||||
"${@}"
|
||||
}
|
||||
|
||||
sb_build() {
|
||||
# DO NOT enable the shell with Secure Boot as it can be used as a bypass!
|
||||
my_build \
|
||||
-D BUILD_SHELL=FALSE \
|
||||
-D SECURE_BOOT_ENABLE \
|
||||
--pcd PcdDxeNxMemoryProtectionPolicy=0xC000000000007FD5 \
|
||||
--pcd PcdImageProtectionPolicy=0x03 \
|
||||
--pcd PcdNullPointerDetectionPropertyMask=0x03 \
|
||||
--pcd PcdSetNxForStack=TRUE \
|
||||
--pcd PcdUninstallMemAttrProtocol=FALSE \
|
||||
"${@}"
|
||||
}
|
||||
|
||||
# Add the MS and Red Hat Secure Boot certificates and update the revocation list
|
||||
# in the given raw variable images.
|
||||
mk_fw_vars_raw() {
|
||||
local input args=() dbx="${DISTDIR}/${ARCH}_DBXUpdate_v${SBO_VER}.bin"
|
||||
[[ -e ${dbx} ]] && args+=( --set-dbx "${dbx}" )
|
||||
|
||||
for input; do
|
||||
edo virt-fw-vars --secure-boot --enroll-redhat "${args[@]}" \
|
||||
--inplace "${input}"
|
||||
done
|
||||
}
|
||||
|
||||
# Write the MS and Red Hat Secure Boot certificates and the revocation list to a
|
||||
# JSON file for QEMU.
|
||||
mk_fw_vars_json() {
|
||||
local args=() dbx="${DISTDIR}/${ARCH}_DBXUpdate_v${SBO_VER}.bin"
|
||||
[[ -e ${dbx} ]] && args+=( --set-dbx "${dbx}" )
|
||||
|
||||
edo virt-fw-vars --secure-boot --enroll-redhat "${args[@]}" \
|
||||
--output-json "${S}/${ARCH}.qemuvars.json"
|
||||
}
|
||||
|
||||
# Convert the given images from raw to QCOW2 and resize them to the amount given
|
||||
# as the first argument. Specify 0 to not resize.
|
||||
raw_to_qcow2() {
|
||||
local SIZE=$1 RAW
|
||||
shift
|
||||
|
||||
for RAW in "${@}"; do
|
||||
edo qemu-img convert -f raw -O qcow2 -o cluster_size=4096 -S 4096 "${RAW}" "${RAW%.fd}.qcow2"
|
||||
[[ ${SIZE} != 0 ]] && edo qemu-img resize -f qcow2 "${RAW%.fd}.qcow2" "${SIZE}"
|
||||
rm "${RAW}" || die
|
||||
done
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
TOOLCHAIN="GCC"
|
||||
BUILD_TARGET="RELEASE"
|
||||
BUILD_DIR="${BUILD_TARGET}_${TOOLCHAIN}"
|
||||
BUILD_ARGS=()
|
||||
|
||||
tc-export_build_env
|
||||
emake -C BaseTools \
|
||||
CC="$(tc-getBUILD_CC)" \
|
||||
CXX="$(tc-getBUILD_CXX)" \
|
||||
EXTRA_OPTFLAGS="${BUILD_CFLAGS}" \
|
||||
EXTRA_LDFLAGS="${BUILD_LDFLAGS}"
|
||||
|
||||
export \
|
||||
"${TOOLCHAIN}_${TARGET_ARCH}_PREFIX=${CHOST}-" \
|
||||
"${TOOLCHAIN}_BIN=${CHOST}-"
|
||||
|
||||
. ./edksetup.sh
|
||||
|
||||
case "${ARCH}" in
|
||||
amd64)
|
||||
local SIZE
|
||||
for SIZE in _2M _4M; do
|
||||
sb_build -p OvmfPkg/OvmfPkgX64.dsc \
|
||||
-D FD_SIZE${SIZE}B \
|
||||
-D SMM_REQUIRE
|
||||
|
||||
mv -T Build/OvmfX64{,${SIZE}.secboot} || die
|
||||
|
||||
# shim.efi has broken MemAttr code
|
||||
my_build -p OvmfPkg/OvmfPkgX64.dsc \
|
||||
-D FD_SIZE${SIZE}B \
|
||||
--pcd PcdDxeNxMemoryProtectionPolicy=0 \
|
||||
--pcd PcdUninstallMemAttrProtocol=TRUE
|
||||
|
||||
mv -T Build/OvmfX64{,${SIZE}} || die
|
||||
|
||||
mk_fw_vars_raw Build/OvmfX64${SIZE}.secboot/"${BUILD_DIR}"/FV/OVMF_VARS.fd
|
||||
done
|
||||
|
||||
sb_build -p OvmfPkg/OvmfPkgX64.dsc \
|
||||
-D FD_SIZE_4MB \
|
||||
-D QEMU_PV_VARS
|
||||
|
||||
mv -T Build/OvmfX64{,.qemuvars} || die
|
||||
|
||||
# Fedora only converts newer images to QCOW2. 2MB images are raw.
|
||||
raw_to_qcow2 0 Build/OvmfX64_4M*/"${BUILD_DIR}"/FV/OVMF_{CODE,VARS}.fd
|
||||
mk_fw_vars_json
|
||||
;;
|
||||
arm64)
|
||||
sb_build -p ArmVirtPkg/ArmVirtQemu.dsc
|
||||
mv -T Build/ArmVirtQemu-AArch64{,.secboot_INSECURE} || die
|
||||
|
||||
sb_build -p ArmVirtPkg/ArmVirtQemu.dsc \
|
||||
-D QEMU_PV_VARS
|
||||
|
||||
mv -T Build/ArmVirtQemu-AArch64{,.qemuvars} || die
|
||||
|
||||
# shim.efi has broken MemAttr code
|
||||
my_build -p ArmVirtPkg/ArmVirtQemu.dsc \
|
||||
--pcd PcdDxeNxMemoryProtectionPolicy=0xC000000000007FD1 \
|
||||
--pcd PcdUninstallMemAttrProtocol=TRUE
|
||||
|
||||
mk_fw_vars_raw Build/ArmVirtQemu-AArch64.secboot_INSECURE/"${BUILD_DIR}"/FV/QEMU_VARS.fd
|
||||
raw_to_qcow2 64m Build/ArmVirtQemu-AArch64{,.secboot_INSECURE}/"${BUILD_DIR}"/FV/QEMU_{EFI,VARS}.fd
|
||||
mk_fw_vars_json
|
||||
;;
|
||||
loong)
|
||||
my_build -p OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
|
||||
raw_to_qcow2 0 Build/LoongArchVirtQemu/"${BUILD_DIR}"/FV/QEMU_{EFI,VARS}.fd
|
||||
;;
|
||||
riscv)
|
||||
my_build -p OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc
|
||||
raw_to_qcow2 32m Build/RiscVVirtQemu/"${BUILD_DIR}"/FV/RISCV_VIRT_{CODE,VARS}.fd
|
||||
;;
|
||||
esac
|
||||
|
||||
# The standalone shell is safe so always build it.
|
||||
my_build -p ShellPkg/ShellPkg.dsc
|
||||
}
|
||||
|
||||
src_install() {
|
||||
local SIZE TYPE FMT
|
||||
|
||||
case "${ARCH}" in
|
||||
amd64)
|
||||
insinto ${DIR}/OvmfX64
|
||||
|
||||
for SIZE in _2M _4M; do
|
||||
for TYPE in "" .secboot; do
|
||||
[[ ${SIZE} = _4M ]] && FMT=qcow2 || FMT=fd
|
||||
newins Build/OvmfX64${SIZE}${TYPE}/"${BUILD_DIR}"/FV/OVMF_CODE.${FMT} OVMF_CODE${SIZE#_2M}${TYPE}.${FMT}
|
||||
newins Build/OvmfX64${SIZE}${TYPE}/"${BUILD_DIR}"/FV/OVMF_VARS.${FMT} OVMF_VARS${SIZE#_2M}${TYPE}.${FMT}
|
||||
done
|
||||
done
|
||||
|
||||
newins Build/OvmfX64.qemuvars/"${BUILD_DIR}"/FV/OVMF_CODE.fd OVMF_CODE.qemuvars.fd
|
||||
newins amd64.qemuvars.json OVMF_VARS.qemuvars.json
|
||||
|
||||
# Compatibility with older package versions.
|
||||
dosym ${PN}/OvmfX64 /usr/share/edk2-ovmf
|
||||
;;
|
||||
arm64)
|
||||
insinto ${DIR}/ArmVirtQemu-AARCH64
|
||||
|
||||
for TYPE in "" .secboot_INSECURE; do
|
||||
newins Build/ArmVirtQemu-AArch64${TYPE}/"${BUILD_DIR}"/FV/QEMU_EFI.qcow2 QEMU_EFI${TYPE}.qcow2
|
||||
newins Build/ArmVirtQemu-AArch64${TYPE}/"${BUILD_DIR}"/FV/QEMU_VARS.qcow2 QEMU_VARS${TYPE}.qcow2
|
||||
done
|
||||
|
||||
newins Build/ArmVirtQemu-AArch64.qemuvars/"${BUILD_DIR}"/FV/QEMU_EFI.fd QEMU_EFI.qemuvars.fd
|
||||
newins arm64.qemuvars.json QEMU_VARS.qemuvars.json
|
||||
;;
|
||||
loong)
|
||||
insinto ${DIR}/LoongArchVirtQemu
|
||||
doins Build/LoongArchVirtQemu/"${BUILD_DIR}"/FV/QEMU_{EFI,VARS}.qcow2
|
||||
;;
|
||||
riscv)
|
||||
insinto ${DIR}/RiscVVirtQemu
|
||||
doins Build/RiscVVirtQemu/"${BUILD_DIR}"/FV/RISCV_VIRT_{CODE,VARS}.qcow2
|
||||
;;
|
||||
esac
|
||||
|
||||
newins Build/Shell/"${BUILD_DIR}/${TARGET_ARCH}"/Shell_EA4BB293-2D7F-4456-A681-1F22F42CD0BC.efi Shell.efi
|
||||
|
||||
insinto /usr/share/qemu/firmware
|
||||
doins "${FILESDIR}"/descriptors/*"${TARGET_ARCH,,}"*.json
|
||||
|
||||
secureboot_auto_sign --in-place
|
||||
readme.gentoo_create_doc
|
||||
}
|
||||
|
||||
pkg_preinst() {
|
||||
local OLD=${EROOT}/usr/share/edk2-ovmf NEW=${EROOT}/${DIR}/OvmfX64
|
||||
if [[ -d ${OLD} && ! -L ${OLD} ]]; then
|
||||
{
|
||||
rm -vf "${OLD}"/{OVMF_{CODE,CODE.secboot,VARS}.fd,EnrollDefaultKeys.efi,Shell.efi,UefiShell.img} &&
|
||||
mkdir -p "${NEW}" &&
|
||||
find "${OLD}" -mindepth 1 -maxdepth 1 -execdir mv --update=none-fail -vt "${NEW}"/ {} + &&
|
||||
rmdir "${OLD}"
|
||||
} || die "unable to replace old directory with compatibility symlink"
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
readme.gentoo_print_elog
|
||||
}
|
||||
@@ -0,0 +1,488 @@
|
||||
From 22c6dbcbf42c16ab63752de5ae64b0cded558d48 Mon Sep 17 00:00:00 2001
|
||||
From: Ard Biesheuvel <ardb@kernel.org>
|
||||
Date: Tue, 1 Sep 2026 18:20:54 +0200
|
||||
Subject: [PATCH 1/4] ArmVirtPkg: Create platform DXE driver to detect the GIC
|
||||
version
|
||||
|
||||
Take the code from ArmVirtGicArchLib, which is injected into the unified
|
||||
GIC driver by NULL library class resolution to set the associated PCDs
|
||||
as the driver loads, and implement a DXE driver that performs the same
|
||||
DT based detection.
|
||||
|
||||
However, in this case, the driver installs a NULL protocol under a GUID
|
||||
that indicates the presence of either a V2 or a V3 (or later) GIC, in a
|
||||
way that allows the DXE driver dispatcher to take this into account.
|
||||
|
||||
This will allow the unified GIC driver to be replaced with the split V2
|
||||
and V3 versions, which is all we care to support going forward.
|
||||
|
||||
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
|
||||
|
||||
diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec
|
||||
index fd9a31a916d4..e91c70c95e95 100644
|
||||
--- a/ArmVirtPkg/ArmVirtPkg.dec
|
||||
+++ b/ArmVirtPkg/ArmVirtPkg.dec
|
||||
@@ -40,6 +40,9 @@
|
||||
gArmCcaIpaWidthGuid = { 0xbdb66787, 0xfc8a, 0x412e, { 0xa0, 0x9b, 0x84, 0x96, 0x61, 0x81, 0x72, 0xc0 } }
|
||||
gArmCcaIsRealmGuid = { 0x45e4546d, 0x26ea, 0x449d, { 0xa4, 0xa6, 0xcb, 0x5a, 0x54, 0xe3, 0x03, 0x7c } }
|
||||
|
||||
+ gArmVirtPlatformHasGicV2 = { 0x5f69e3c5, 0x9cd4, 0x47cf, { 0xa5, 0x31, 0x56, 0x15, 0xcb, 0x80, 0xf5, 0x8b } }
|
||||
+ gArmVirtPlatformHasGicV3 = { 0xa74128a8, 0xb243, 0x4157, { 0x9c, 0xa4, 0x47, 0x63, 0x29, 0x3a, 0x68, 0x45 } }
|
||||
+
|
||||
[PcdsFeatureFlag]
|
||||
#
|
||||
# Feature Flag PCD that defines whether TPM2 support is enabled
|
||||
diff --git a/ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.c b/ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.c
|
||||
new file mode 100644
|
||||
index 000000000000..81d9d2ff8797
|
||||
--- /dev/null
|
||||
+++ b/ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.c
|
||||
@@ -0,0 +1,201 @@
|
||||
+/** @file
|
||||
+ NULL library class implementation to discover the GIC for DT based virt platforms
|
||||
+
|
||||
+ Copyright (c) 2015 - 2016, Linaro Ltd. All rights reserved.<BR>
|
||||
+ Copyright (c) 2026, Arm Ltd. All rights reserved.<BR>
|
||||
+ Copyright (c) 2026, Google LLC. All rights reserved.<BR>
|
||||
+
|
||||
+ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
+
|
||||
+**/
|
||||
+
|
||||
+#include <PiDxe.h>
|
||||
+
|
||||
+#include <Library/ArmGicLib.h>
|
||||
+#include <Library/BaseLib.h>
|
||||
+#include <Library/DebugLib.h>
|
||||
+#include <Library/MapMmioLib.h>
|
||||
+#include <Library/PcdLib.h>
|
||||
+#include <Library/UefiBootServicesTableLib.h>
|
||||
+
|
||||
+#include <Protocol/FdtClient.h>
|
||||
+
|
||||
+EFI_STATUS
|
||||
+EFIAPI
|
||||
+ArmVirtGicPlatformDxeInitialize (
|
||||
+ IN EFI_HANDLE ImageHandle,
|
||||
+ IN EFI_SYSTEM_TABLE *SystemTable
|
||||
+ )
|
||||
+{
|
||||
+ FDT_CLIENT_PROTOCOL *FdtClient;
|
||||
+ CONST UINT64 *Reg;
|
||||
+ UINT32 RegSize;
|
||||
+ UINTN AddressCells, SizeCells;
|
||||
+ UINTN GicRevision;
|
||||
+ EFI_STATUS Status;
|
||||
+ UINT64 DistBase, CpuBase, RedistBase;
|
||||
+ UINT64 DistSize, CpuSize, RedistSize;
|
||||
+ RETURN_STATUS PcdStatus;
|
||||
+ EFI_HANDLE Handle;
|
||||
+ CONST EFI_GUID *DepexGuid;
|
||||
+
|
||||
+ Status = gBS->LocateProtocol (
|
||||
+ &gFdtClientProtocolGuid,
|
||||
+ NULL,
|
||||
+ (VOID **)&FdtClient
|
||||
+ );
|
||||
+ ASSERT_EFI_ERROR (Status);
|
||||
+
|
||||
+ GicRevision = 2;
|
||||
+ Status = FdtClient->FindCompatibleNodeReg (
|
||||
+ FdtClient,
|
||||
+ "arm,cortex-a15-gic",
|
||||
+ (CONST VOID **)&Reg,
|
||||
+ &AddressCells,
|
||||
+ &SizeCells,
|
||||
+ &RegSize
|
||||
+ );
|
||||
+ if (Status == EFI_NOT_FOUND) {
|
||||
+ GicRevision = 3;
|
||||
+ Status = FdtClient->FindCompatibleNodeReg (
|
||||
+ FdtClient,
|
||||
+ "arm,gic-v3",
|
||||
+ (CONST VOID **)&Reg,
|
||||
+ &AddressCells,
|
||||
+ &SizeCells,
|
||||
+ &RegSize
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ if (EFI_ERROR (Status)) {
|
||||
+ return Status;
|
||||
+ }
|
||||
+
|
||||
+ switch (GicRevision) {
|
||||
+ case 3:
|
||||
+ //
|
||||
+ // The GIC v3 DT binding describes a series of at least 3 physical (base
|
||||
+ // addresses, size) pairs: the distributor interface (GICD), at least one
|
||||
+ // redistributor region (GICR) containing dedicated redistributor
|
||||
+ // interfaces for all individual CPUs, and the CPU interface (GICC).
|
||||
+ // Under virtualization, we assume that the first redistributor region
|
||||
+ // listed covers the boot CPU. Also, our GICv3 driver only supports the
|
||||
+ // system register CPU interface, so we can safely ignore the MMIO version
|
||||
+ // which is listed after the sequence of redistributor interfaces.
|
||||
+ // This means we are only interested in the first two memory regions
|
||||
+ // supplied, and ignore everything else.
|
||||
+ //
|
||||
+ ASSERT (RegSize >= 32);
|
||||
+
|
||||
+ // RegProp[0..1] == { GICD base, GICD size }
|
||||
+ DistBase = SwapBytes64 (Reg[0]);
|
||||
+ ASSERT (DistBase < MAX_UINTN);
|
||||
+ DistSize = SwapBytes64 (Reg[1]);
|
||||
+ ASSERT (DistSize < MAX_UINTN);
|
||||
+
|
||||
+ // RegProp[2..3] == { GICR base, GICR size }
|
||||
+ RedistBase = SwapBytes64 (Reg[2]);
|
||||
+ ASSERT (RedistBase < MAX_UINTN);
|
||||
+ RedistSize = SwapBytes64 (Reg[3]);
|
||||
+ ASSERT (RedistSize < MAX_UINTN);
|
||||
+
|
||||
+ PcdStatus = PcdSet64S (PcdGicDistributorBase, DistBase);
|
||||
+ ASSERT_RETURN_ERROR (PcdStatus);
|
||||
+ PcdStatus = PcdSet64S (PcdGicRedistributorsBase, RedistBase);
|
||||
+ ASSERT_RETURN_ERROR (PcdStatus);
|
||||
+
|
||||
+ DEBUG ((
|
||||
+ DEBUG_INFO,
|
||||
+ "Found GIC v3 Distributor @ 0x%Lx, Len 0x%Lx\n",
|
||||
+ DistBase,
|
||||
+ DistSize
|
||||
+ ));
|
||||
+
|
||||
+ DEBUG ((
|
||||
+ DEBUG_INFO,
|
||||
+ "Found GIC v3 Redistributor @ 0x%Lx, Len 0x%Lx\n",
|
||||
+ RedistBase,
|
||||
+ RedistSize
|
||||
+ ));
|
||||
+
|
||||
+ Status = MapMmioMemory (
|
||||
+ DistBase,
|
||||
+ DistSize,
|
||||
+ (EFI_MEMORY_UC | EFI_MEMORY_XP)
|
||||
+ );
|
||||
+ if (EFI_ERROR (Status)) {
|
||||
+ ASSERT_EFI_ERROR (Status);
|
||||
+ return Status;
|
||||
+ }
|
||||
+
|
||||
+ Status = MapMmioMemory (
|
||||
+ RedistBase,
|
||||
+ RedistSize,
|
||||
+ (EFI_MEMORY_UC | EFI_MEMORY_XP)
|
||||
+ );
|
||||
+ if (EFI_ERROR (Status)) {
|
||||
+ ASSERT_EFI_ERROR (Status);
|
||||
+ return Status;
|
||||
+ }
|
||||
+
|
||||
+ DepexGuid = &gArmVirtPlatformHasGicV3;
|
||||
+ break;
|
||||
+
|
||||
+ case 2:
|
||||
+ //
|
||||
+ // When the GICv2 is emulated with virtualization=on, it adds a virtual
|
||||
+ // set of control registers. This means the register property can be
|
||||
+ // either 32 or 64 bytes in size.
|
||||
+ //
|
||||
+ ASSERT ((RegSize == 32) || (RegSize == 64));
|
||||
+
|
||||
+ DistBase = SwapBytes64 (Reg[0]);
|
||||
+ DistSize = SwapBytes64 (Reg[1]);
|
||||
+ CpuBase = SwapBytes64 (Reg[2]);
|
||||
+ CpuSize = SwapBytes64 (Reg[3]);
|
||||
+ ASSERT (DistBase < MAX_UINTN);
|
||||
+ ASSERT (CpuBase < MAX_UINTN);
|
||||
+ ASSERT (DistSize < MAX_UINTN);
|
||||
+ ASSERT (CpuSize < MAX_UINTN);
|
||||
+
|
||||
+ PcdStatus = PcdSet64S (PcdGicDistributorBase, DistBase);
|
||||
+ ASSERT_RETURN_ERROR (PcdStatus);
|
||||
+ PcdStatus = PcdSet64S (PcdGicInterruptInterfaceBase, CpuBase);
|
||||
+ ASSERT_RETURN_ERROR (PcdStatus);
|
||||
+
|
||||
+ DEBUG ((DEBUG_INFO, "Found GICv2 @ 0x%Lx/0x%Lx\n", DistBase, CpuBase));
|
||||
+
|
||||
+ Status = MapMmioMemory (
|
||||
+ DistBase,
|
||||
+ DistSize,
|
||||
+ (EFI_MEMORY_UC | EFI_MEMORY_XP)
|
||||
+ );
|
||||
+ if (EFI_ERROR (Status)) {
|
||||
+ ASSERT_EFI_ERROR (Status);
|
||||
+ return Status;
|
||||
+ }
|
||||
+
|
||||
+ Status = MapMmioMemory (
|
||||
+ CpuBase,
|
||||
+ CpuSize,
|
||||
+ (EFI_MEMORY_UC | EFI_MEMORY_XP)
|
||||
+ );
|
||||
+ if (EFI_ERROR (Status)) {
|
||||
+ ASSERT_EFI_ERROR (Status);
|
||||
+ return Status;
|
||||
+ }
|
||||
+
|
||||
+ DepexGuid = &gArmVirtPlatformHasGicV2;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ DEBUG ((DEBUG_ERROR, "%a: No GIC revision specified!\n", __func__));
|
||||
+ return EFI_NOT_FOUND;
|
||||
+ }
|
||||
+
|
||||
+ Handle = NULL;
|
||||
+ Status = gBS->InstallMultipleProtocolInterfaces (&Handle, DepexGuid, NULL, NULL);
|
||||
+ ASSERT_EFI_ERROR (Status);
|
||||
+
|
||||
+ return EFI_REQUEST_UNLOAD_IMAGE;
|
||||
+}
|
||||
diff --git a/ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.inf b/ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.inf
|
||||
new file mode 100644
|
||||
index 000000000000..2321d2cf353c
|
||||
--- /dev/null
|
||||
+++ b/ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.inf
|
||||
@@ -0,0 +1,52 @@
|
||||
+#/** @file
|
||||
+#
|
||||
+# Component description file for ArmVirtGicPlatformDxe module
|
||||
+#
|
||||
+# Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
|
||||
+# Copyright (c) 2026, Arm Ltd. All rights reserved.<BR>
|
||||
+# Copyright (c) 2026, Google LLC. All rights reserved.<BR>
|
||||
+#
|
||||
+# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
+#
|
||||
+#**/
|
||||
+
|
||||
+[Defines]
|
||||
+ INF_VERSION = 1.30
|
||||
+ BASE_NAME = ArmVirtGicPlatformDxe
|
||||
+ FILE_GUID = b8de02d5-3164-448f-879c-62f695d6cca8
|
||||
+ MODULE_TYPE = DXE_DRIVER
|
||||
+ VERSION_STRING = 1.0
|
||||
+ ENTRY_POINT = ArmVirtGicPlatformDxeInitialize
|
||||
+
|
||||
+[Sources]
|
||||
+ ArmVirtGicPlatformDxe.c
|
||||
+
|
||||
+[LibraryClasses]
|
||||
+ BaseLib
|
||||
+ DebugLib
|
||||
+ PcdLib
|
||||
+ MapMmioLib
|
||||
+ UefiBootServicesTableLib
|
||||
+ UefiDriverEntryPoint
|
||||
+
|
||||
+[Packages]
|
||||
+ ArmPkg/ArmPkg.dec
|
||||
+ ArmVirtPkg/ArmVirtPkg.dec
|
||||
+ EmbeddedPkg/EmbeddedPkg.dec
|
||||
+ MdePkg/MdePkg.dec
|
||||
+ OvmfPkg/OvmfPkg.dec
|
||||
+
|
||||
+[Protocols]
|
||||
+ gFdtClientProtocolGuid ## CONSUMES
|
||||
+
|
||||
+[Pcd]
|
||||
+ gArmTokenSpaceGuid.PcdGicDistributorBase
|
||||
+ gArmTokenSpaceGuid.PcdGicRedistributorsBase
|
||||
+ gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
|
||||
+
|
||||
+[Guids]
|
||||
+ gArmVirtPlatformHasGicV2
|
||||
+ gArmVirtPlatformHasGicV3
|
||||
+
|
||||
+[Depex]
|
||||
+ gFdtClientProtocolGuid
|
||||
|
||||
From 81e0b6361b401264c359e9eacf93e953e3c10bd0 Mon Sep 17 00:00:00 2001
|
||||
From: Ard Biesheuvel <ardb@kernel.org>
|
||||
Date: Tue, 1 Sep 2026 18:41:02 +0200
|
||||
Subject: [PATCH 2/4] ArmVirtPkg: Implement stub DEPEX libraries for GIC v2/v3
|
||||
presence
|
||||
|
||||
Allow the unified ArmGicDxe driver to be replaced with either the v2 or
|
||||
the v3 one, depending on what the platform actually implements.
|
||||
|
||||
This involves injecting a DEPEX on the ArmVirtPkg specific GUID that
|
||||
conveys whether the GIC is a revision 2 or a newer one.
|
||||
|
||||
This DEPEX injection is done by adding a NULL library class resolution
|
||||
to each driver when incorporating it into the platform build. So add a
|
||||
library for GICv2 and one for GICv3 or newer.
|
||||
|
||||
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
|
||||
|
||||
diff --git a/ArmVirtPkg/Library/ArmGicDepexLib/ArmGicDepexLib.c b/ArmVirtPkg/Library/ArmGicDepexLib/ArmGicDepexLib.c
|
||||
new file mode 100644
|
||||
index 000000000000..e69de29bb2d1
|
||||
diff --git a/ArmVirtPkg/Library/ArmGicDepexLib/ArmGicV2DepexLib.inf b/ArmVirtPkg/Library/ArmGicDepexLib/ArmGicV2DepexLib.inf
|
||||
new file mode 100644
|
||||
index 000000000000..bd06dcf452af
|
||||
--- /dev/null
|
||||
+++ b/ArmVirtPkg/Library/ArmGicDepexLib/ArmGicV2DepexLib.inf
|
||||
@@ -0,0 +1,27 @@
|
||||
+#/** @file
|
||||
+#
|
||||
+# Component description file for ArmGicDepexLib module
|
||||
+#
|
||||
+# Copyright (c) 2026, Google LLC. All rights reserved.<BR>
|
||||
+#
|
||||
+# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
+#
|
||||
+#**/
|
||||
+
|
||||
+[Defines]
|
||||
+ INF_VERSION = 1.30
|
||||
+ BASE_NAME = ArmGicV2DepexLib
|
||||
+ FILE_GUID = 7daabe90-e7a7-4b8a-8b28-1a4532afb691
|
||||
+ MODULE_TYPE = BASE
|
||||
+ VERSION_STRING = 1.0
|
||||
+ LIBRARY_CLASS = NULL
|
||||
+
|
||||
+[Sources]
|
||||
+ ArmGicDepexLib.c
|
||||
+
|
||||
+[Packages]
|
||||
+ ArmVirtPkg/ArmVirtPkg.dec
|
||||
+ MdePkg/MdePkg.dec
|
||||
+
|
||||
+[Depex]
|
||||
+ gArmVirtPlatformHasGicV2
|
||||
diff --git a/ArmVirtPkg/Library/ArmGicDepexLib/ArmGicV3DepexLib.inf b/ArmVirtPkg/Library/ArmGicDepexLib/ArmGicV3DepexLib.inf
|
||||
new file mode 100644
|
||||
index 000000000000..02ef5193f357
|
||||
--- /dev/null
|
||||
+++ b/ArmVirtPkg/Library/ArmGicDepexLib/ArmGicV3DepexLib.inf
|
||||
@@ -0,0 +1,27 @@
|
||||
+#/** @file
|
||||
+#
|
||||
+# Component description file for ArmGicDepexLib module
|
||||
+#
|
||||
+# Copyright (c) 2026, Google LLC. All rights reserved.<BR>
|
||||
+#
|
||||
+# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
+#
|
||||
+#**/
|
||||
+
|
||||
+[Defines]
|
||||
+ INF_VERSION = 1.30
|
||||
+ BASE_NAME = ArmGicV3DepexLib
|
||||
+ FILE_GUID = 12849212-ea40-4cd4-be97-de7636f05539
|
||||
+ MODULE_TYPE = BASE
|
||||
+ VERSION_STRING = 1.0
|
||||
+ LIBRARY_CLASS = NULL
|
||||
+
|
||||
+[Sources]
|
||||
+ ArmGicDepexLib.c
|
||||
+
|
||||
+[Packages]
|
||||
+ ArmVirtPkg/ArmVirtPkg.dec
|
||||
+ MdePkg/MdePkg.dec
|
||||
+
|
||||
+[Depex]
|
||||
+ gArmVirtPlatformHasGicV3
|
||||
|
||||
From d43a446baa384796b2c9897be5f86aa268e53d32 Mon Sep 17 00:00:00 2001
|
||||
From: Ard Biesheuvel <ardb@kernel.org>
|
||||
Date: Tue, 1 Sep 2026 18:50:49 +0200
|
||||
Subject: [PATCH 3/4] ArmVirtPkg: Switch all platforms to split v2/v3 GIC
|
||||
drivers
|
||||
|
||||
Use the separate v2 and v3 versions of the GIC driver, rather than the
|
||||
unified one, which is a bit odd because a platform never implements
|
||||
both, and GICv2 is obsolete by now.
|
||||
|
||||
The only reason the unified driver is being kept alive is for virtual
|
||||
platforms that could decide to expose either. Let's refactor this a bit
|
||||
so that the version detection is separated from the driver dispatch
|
||||
itself, so that ordinary DEPEX resolution can be used to load either the
|
||||
v2 or the v3 driver.
|
||||
|
||||
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
|
||||
|
||||
diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
|
||||
index fb1edceafcd2..73723fab8922 100644
|
||||
--- a/ArmVirtPkg/ArmVirt.dsc.inc
|
||||
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
|
||||
@@ -517,9 +517,14 @@ DEFINE FD_SIZE_IN_MB = 3
|
||||
|
||||
!include OvmfPkg/Include/Dsc/ShellComponents.dsc.inc
|
||||
|
||||
- ArmPkg/Drivers/ArmGicDxe/ArmGicDxe.inf {
|
||||
+ ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.inf
|
||||
+ ArmPkg/Drivers/ArmGicDxe/ArmGicV2Dxe.inf {
|
||||
<LibraryClasses>
|
||||
- NULL|ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf
|
||||
+ NULL|ArmVirtPkg/Library/ArmGicDepexLib/ArmGicV2DepexLib.inf
|
||||
+ }
|
||||
+ ArmPkg/Drivers/ArmGicDxe/ArmGicV3Dxe.inf {
|
||||
+ <LibraryClasses>
|
||||
+ NULL|ArmVirtPkg/Library/ArmGicDepexLib/ArmGicV3DepexLib.inf
|
||||
}
|
||||
ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
|
||||
<LibraryClasses>
|
||||
diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf b/ArmVirtPkg/ArmVirtCloudHv.fdf
|
||||
index c7d212429a03..8a92843abf71 100644
|
||||
--- a/ArmVirtPkg/ArmVirtCloudHv.fdf
|
||||
+++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
|
||||
@@ -132,7 +132,9 @@ READ_LOCK_STATUS = TRUE
|
||||
INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
||||
INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
|
||||
|
||||
- INF ArmPkg/Drivers/ArmGicDxe/ArmGicDxe.inf
|
||||
+ INF ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.inf
|
||||
+ INF ArmPkg/Drivers/ArmGicDxe/ArmGicV2Dxe.inf
|
||||
+ INF ArmPkg/Drivers/ArmGicDxe/ArmGicV3Dxe.inf
|
||||
INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
|
||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
|
||||
diff --git a/ArmVirtPkg/ArmVirtKvmTool.fdf b/ArmVirtPkg/ArmVirtKvmTool.fdf
|
||||
index ede74c08a8ff..fa22491d7aba 100644
|
||||
--- a/ArmVirtPkg/ArmVirtKvmTool.fdf
|
||||
+++ b/ArmVirtPkg/ArmVirtKvmTool.fdf
|
||||
@@ -134,7 +134,9 @@ READ_LOCK_STATUS = TRUE
|
||||
INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
||||
INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
|
||||
|
||||
- INF ArmPkg/Drivers/ArmGicDxe/ArmGicDxe.inf
|
||||
+ INF ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.inf
|
||||
+ INF ArmPkg/Drivers/ArmGicDxe/ArmGicV2Dxe.inf
|
||||
+ INF ArmPkg/Drivers/ArmGicDxe/ArmGicV3Dxe.inf
|
||||
INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
|
||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
INF OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
|
||||
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
|
||||
index ad158f57f127..f2bef9d1dda7 100644
|
||||
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
|
||||
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
|
||||
@@ -76,7 +76,9 @@ READ_LOCK_STATUS = TRUE
|
||||
INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
||||
INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
|
||||
|
||||
- INF ArmPkg/Drivers/ArmGicDxe/ArmGicDxe.inf
|
||||
+ INF ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.inf
|
||||
+ INF ArmPkg/Drivers/ArmGicDxe/ArmGicV2Dxe.inf
|
||||
+ INF ArmPkg/Drivers/ArmGicDxe/ArmGicV3Dxe.inf
|
||||
INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
|
||||
INF OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf
|
||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf
|
||||
index b7ddc5f9daf3..9d8ff900492e 100644
|
||||
--- a/ArmVirtPkg/ArmVirtXen.fdf
|
||||
+++ b/ArmVirtPkg/ArmVirtXen.fdf
|
||||
@@ -142,7 +142,9 @@ READ_LOCK_STATUS = TRUE
|
||||
INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
||||
INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
|
||||
|
||||
- INF ArmPkg/Drivers/ArmGicDxe/ArmGicDxe.inf
|
||||
+ INF ArmVirtPkg/Library/ArmVirtGicPlatformDxe/ArmVirtGicPlatformDxe.inf
|
||||
+ INF ArmPkg/Drivers/ArmGicDxe/ArmGicV2Dxe.inf
|
||||
+ INF ArmPkg/Drivers/ArmGicDxe/ArmGicV3Dxe.inf
|
||||
INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
|
||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
--- a/BaseTools/Conf/tools_def.template
|
||||
+++ b/BaseTools/Conf/tools_def.template
|
||||
@@ -587,9 +587,9 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink="$(DEBUG_DIR)/$(MODULE_
|
||||
*_*_*_DTC_PATH = DEF(DTC_BIN)
|
||||
|
||||
# Because LOONGARCH64 supports global stack protector guard by default, it does not support the parameter -mstack-protector-guard=global, and this parameter will be supported in GCC17. So set that on every thing except LOONGARCH64.
|
||||
-DEFINE GCC_ALL_CC_COMMON = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -fstack-protector
|
||||
+DEFINE GCC_ALL_CC_COMMON = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Wno-array-bounds -include AutoGen.h -fno-common -fstack-protector
|
||||
DEFINE GCC_IA32_X64_CC_FLAGS = -mstack-protector-guard=global
|
||||
-DEFINE GCC_LOONGARCH64_CC_FLAGS = DEF(GCC_ALL_CC_COMMON) -mabi=lp64d -fno-asynchronous-unwind-tables -Wno-address -fno-short-enums -fsigned-char -ffunction-sections -fdata-sections -march=loongarch64 -mno-memcpy -Werror -Wno-maybe-uninitialized -Wno-stringop-overflow -Wno-pointer-to-int-cast -no-pie -mno-explicit-relocs -mno-relax
|
||||
+DEFINE GCC_LOONGARCH64_CC_FLAGS = DEF(GCC_ALL_CC_COMMON) -mabi=lp64d -fno-asynchronous-unwind-tables -Wno-address -fno-short-enums -fsigned-char -ffunction-sections -fdata-sections -march=loongarch64 -mno-memcpy -Wno-maybe-uninitialized -Wno-stringop-overflow -Wno-pointer-to-int-cast -no-pie -mno-explicit-relocs -mno-relax
|
||||
DEFINE GCC_AARCH64_CC_COMMON = DEF(GCC_ALL_CC_COMMON) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18 -mstack-protector-guard=global
|
||||
DEFINE GCC_AARCH64_CC_XIPCOMMON = -mstrict-align -mgeneral-regs-only
|
||||
DEFINE GCC_RISCV64_CC_XIPFLAGS = -mstrict-align -mgeneral-regs-only
|
||||
--- a/BaseTools/Source/C/Makefiles/header.makefile
|
||||
+++ b/BaseTools/Source/C/Makefiles/header.makefile
|
||||
@@ -158,17 +158,17 @@ BUILD_OPTFLAGS = -O2 $(EXTRA_OPTFLAGS)
|
||||
|
||||
ifeq ($(DARWIN),Darwin)
|
||||
# assume clang or clang compatible flags on OS X
|
||||
-CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \
|
||||
+CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall \
|
||||
-Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g
|
||||
else
|
||||
ifneq ($(CLANG),)
|
||||
CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
|
||||
--fno-delete-null-pointer-checks -Wall -Werror \
|
||||
+-fno-delete-null-pointer-checks -Wall \
|
||||
-Wno-deprecated-declarations -Wno-self-assign \
|
||||
-Wno-unused-result -nostdlib -g
|
||||
else
|
||||
CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
|
||||
--fno-delete-null-pointer-checks -Wall -Werror \
|
||||
+-fno-delete-null-pointer-checks -Wall \
|
||||
-Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \
|
||||
-Wno-unused-result -nostdlib -g
|
||||
endif
|
||||
Reference in New Issue
Block a user