packaging: Build edk2 for arm64

The edk2 is required for memory hot plug on qemu for arm64.
This adds the edk2 to static tarball for arm64.

Signed-off-by: Seunguk Shin <seunguk.shin@arm.com>
Reviewed-by: Nick Connolly <nick.connolly@arm.com>
This commit is contained in:
Seunguk Shin 2025-02-20 10:26:39 +00:00 committed by Fabiano Fidêncio
parent 10ceeb0930
commit 2de0465cd8
5 changed files with 33 additions and 4 deletions

View File

@ -40,6 +40,7 @@ jobs:
- kernel-dragonball-experimental
- kernel-nvidia-gpu
- nydus
- ovmf
- qemu
- stratovirt
- virtiofsd

View File

@ -878,6 +878,10 @@ install_shimv2() {
install_ovmf() {
ovmf_type="${1:-x86_64}"
tarball_name="${2:-edk2-x86_64.tar.gz}"
if [ "${ARCH}" == "aarch64" ]; then
ovmf_type="arm64"
tarball_name="edk2-arm64.tar.gz"
fi
local component_name="ovmf"
[ "${ovmf_type}" == "sev" ] && component_name="ovmf-sev"

View File

@ -22,6 +22,9 @@ package_output_dir="${package_output_dir:-}"
DESTDIR=${DESTDIR:-${PWD}}
PREFIX="${PREFIX:-/opt/kata}"
architecture="${architecture:-X64}"
if [ "${ovmf_build}" == "arm64" ]; then
architecture="AARCH64"
fi
toolchain="${toolchain:-GCC5}"
build_target="${build_target:-RELEASE}"
@ -65,11 +68,16 @@ info "Done Building"
build_path_target_toolchain="Build/${package_output_dir}/${build_target}_${toolchain}"
build_path_fv="${build_path_target_toolchain}/FV"
stat "${build_path_fv}/OVMF.fd"
if [ "${ovmf_build}" == "tdx" ]; then
build_path_arch="${build_path_target_toolchain}/X64"
stat "${build_path_fv}/OVMF.fd"
stat "${build_path_fv}/OVMF_CODE.fd"
stat "${build_path_fv}/OVMF_VARS.fd"
elif [ "${ovmf_build}" == "arm64" ]; then
stat "${build_path_fv}/QEMU_EFI.fd"
stat "${build_path_fv}/QEMU_VARS.fd"
else
stat "${build_path_fv}/OVMF.fd"
fi
#need to leave tmp dir
@ -81,12 +89,19 @@ install_dir="${DESTDIR}/${PREFIX}/share/ovmf"
mkdir -p "${install_dir}"
if [ "${ovmf_build}" == "sev" ]; then
install $build_root/$ovmf_dir/"${build_path_fv}"/OVMF.fd "${install_dir}/AMDSEV.fd"
else
elif [ "${ovmf_build}" == "tdx" ]; then
install $build_root/$ovmf_dir/"${build_path_fv}"/OVMF.fd "${install_dir}"
fi
if [ "${ovmf_build}" == "tdx" ]; then
install $build_root/$ovmf_dir/"${build_path_fv}"/OVMF_CODE.fd ${install_dir}
install $build_root/$ovmf_dir/"${build_path_fv}"/OVMF_VARS.fd ${install_dir}
elif [ "${ovmf_build}" == "arm64" ]; then
install $build_root/$ovmf_dir/"${build_path_fv}"/QEMU_EFI.fd "${install_dir}/AAVMF_CODE.fd"
install $build_root/$ovmf_dir/"${build_path_fv}"/QEMU_VARS.fd "${install_dir}/AAVMF_VARS.fd"
# QEMU expects 64MiB CODE and VARS files on ARM/AARCH64 architectures
# Truncate the firmware files to the expected size
truncate -s 64M ${install_dir}/AAVMF_CODE.fd
truncate -s 64M ${install_dir}/AAVMF_VARS.fd
else
install $build_root/$ovmf_dir/"${build_path_fv}"/OVMF.fd "${install_dir}"
fi
local_dir=${PWD}

View File

@ -41,6 +41,10 @@ elif [ "${ovmf_build}" == "tdx" ]; then
[ -n "$ovmf_version" ] || ovmf_version=$(get_from_kata_deps ".externals.ovmf.tdx.version")
[ -n "$ovmf_package" ] || ovmf_package=$(get_from_kata_deps ".externals.ovmf.tdx.package")
[ -n "$package_output_dir" ] || package_output_dir=$(get_from_kata_deps ".externals.ovmf.tdx.package_output_dir")
elif [ "${ovmf_build}" == "arm64" ]; then
[ -n "$ovmf_version" ] || ovmf_version=$(get_from_kata_deps ".externals.ovmf.arm64.version")
[ -n "$ovmf_package" ] || ovmf_package=$(get_from_kata_deps ".externals.ovmf.arm64.package")
[ -n "$package_output_dir" ] || package_output_dir=$(get_from_kata_deps ".externals.ovmf.arm64.package_output_dir")
fi
[ -n "$ovmf_version" ] || die "failed to get ovmf version or commit"

View File

@ -360,6 +360,11 @@ externals:
version: "edk2-stable202411"
package: "OvmfPkg/AmdSev/AmdSevX64.dsc"
package_output_dir: "AmdSev"
arm64:
description: "UEFI for arm64 virtual machines."
version: "edk2-stable202411"
package: "ArmVirtPkg/ArmVirtQemu.dsc"
package_output_dir: "ArmVirtQemu-AARCH64"
virtiofsd:
description: "vhost-user virtio-fs device backend written in Rust"