[pve-devel] [PATCH edk2-firmware] build and include AAVMF

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Oct 22 20:30:43 CEST 2018


To allow use in emulated and native AARCH64 VMs

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 debian/control                   |  7 +++---
 debian/pve-edk2-firmware.install |  1 +
 debian/rules                     | 40 +++++++++++++++++++++++++++++---
 3 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/debian/control b/debian/control
index 31b4100..d3feb4e 100644
--- a/debian/control
+++ b/debian/control
@@ -14,7 +14,8 @@ Package: pve-edk2-firmware
 Architecture: all
 Depends: ${misc:Depends},
 Description: edk2 based firmware modules for virtual machines
- Contains OVMF. Open Virtual Machine Firmware (OVMF) is a build of EDK II for
- virtual machines. It includes full support for UEFI, including Secure Boot,
- allowing use of UEFI in place of a traditional BIOS in your VM.
+ Contains OVMF and AAVMF. Open Virtual Machine Firmware (OVMF) is a build of
+ EDK II for virtual machines. It includes full support for UEFI, including
+ Secure Boot, allowing use of UEFI in place of a traditional BIOS in your VM.
+ AAVMF offers the same for AARCH64 (ARM64) based VMs.
  Proxmox VE specific release with disabled secure boot.
diff --git a/debian/pve-edk2-firmware.install b/debian/pve-edk2-firmware.install
index 1c99312..681cc2a 100644
--- a/debian/pve-edk2-firmware.install
+++ b/debian/pve-edk2-firmware.install
@@ -1,2 +1,3 @@
 Build/OvmfX64/RELEASE_*GCC*/FV/OVMF_CODE.fd	/usr/share/pve-edk2-firmware
 Build/OvmfX64/RELEASE_*GCC*/FV/OVMF_VARS.fd	/usr/share/pve-edk2-firmware
+Build/ArmVirtQemu-AARCH64/RELEASE_*GCC*/FV/AAVMF_*.fd /usr/share/pve-edk2-firmware
diff --git a/debian/rules b/debian/rules
index da3cc01..a582c71 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,18 +3,25 @@ SHELL=/bin/bash
 
 # this is a simplified version from the upstream package
 
+# Only used for creating our build tools.
 DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 
-EDK2_TOOLCHAIN = GCC5 # for GCC5 and newer, LTO enabled
+# for GCC5 and newer, LTO enabled
+EDK2_TOOLCHAIN=GCC5
+AARCH64_TOOLCHAIN=GCC5
 export $(EDK2_TOOLCHAIN)_AARCH64_PREFIX=aarch64-linux-gnu-
 
 ifeq ($(DEB_BUILD_ARCH),amd64)
 	EDK2_BUILD_ARCH=X64
-	EDK2_HOST_ARCH=X64
 endif
 ifeq ($(DEB_BUILD_ARCH),arm64)
 	EDK2_BUILD_ARCH=AARCH64
 endif
+ifeq ($(DEB_HOST_ARCH),amd64)
+	EDK2_HOST_ARCH=X64
+endif
 
 # Clear variables used internally by the edk2 build system
 undefine WORKSPACE
@@ -27,7 +34,7 @@ undefine CONF_PATH
 %:
 	dh $@
 
-override_dh_auto_build: build-ovmf
+override_dh_auto_build: build-qemu-efi-aarch64 build-ovmf
 
 setup-build:
 	cp -a debian/Logo.bmp MdeModulePkg/Logo/Logo.bmp
@@ -47,6 +54,33 @@ build-ovmf: setup-build
 		    -DFD_SIZE_2MB \
 		    -n $$(getconf _NPROCESSORS_ONLN)
 
+build-qemu-efi: setup-build
+	echo FOO "$${$(EDK2_TOOLCHAIN)_AARCH64_PREFIX}"
+	mkdir -p ShellBinPkg/UefiShell/$(EDK2_ARCH_DIR) FatBinPkg/EnhancedFatDxe/$(EDK2_ARCH_DIR)
+	set -e; . ./edksetup.sh; \
+		build -a $(EDK2_HOST_ARCH) -p ShellPkg/ShellPkg.dsc \
+			-b RELEASE -t $(EDK2_TOOLCHAIN); \
+		cp -a Build/Shell/RELEASE_$(EDK2_TOOLCHAIN)/$(EDK2_HOST_ARCH)/Shell.efi \
+			ShellBinPkg/UefiShell/$(EDK2_ARCH_DIR)/Shell.efi; \
+		build -a $(EDK2_HOST_ARCH) -p FatPkg/FatPkg.dsc \
+			-m FatPkg/EnhancedFatDxe/Fat.inf \
+			-t $(EDK2_TOOLCHAIN) -b RELEASE; \
+		cp -a Build/Fat/RELEASE_$(EDK2_TOOLCHAIN)/$(EDK2_HOST_ARCH)/Fat.efi \
+			FatBinPkg/EnhancedFatDxe/$(EDK2_ARCH_DIR)/Fat.efi; \
+		build -a $(EDK2_HOST_ARCH) \
+			-t $(EDK2_TOOLCHAIN) \
+			-p ArmVirtPkg/ArmVirtQemu.dsc \
+			-DHTTP_BOOT_ENABLE=TRUE \
+			-DSECURE_BOOT_ENABLE=FALSE \
+			-DINTEL_BDS \
+			-b RELEASE
+	dd if=/dev/zero of=Build/ArmVirtQemu-$(EDK2_HOST_ARCH)/RELEASE_$(EDK2_TOOLCHAIN)/FV/$(FW_NAME)_CODE.fd bs=1M seek=64 count=0
+	dd if=Build/ArmVirtQemu-$(EDK2_HOST_ARCH)/RELEASE_$(EDK2_TOOLCHAIN)/FV/QEMU_EFI.fd of=Build/ArmVirtQemu-$(EDK2_HOST_ARCH)/RELEASE_$(EDK2_TOOLCHAIN)/FV/$(FW_NAME)_CODE.fd conv=notrunc
+	dd if=/dev/zero of=Build/ArmVirtQemu-$(EDK2_HOST_ARCH)/RELEASE_$(EDK2_TOOLCHAIN)/FV/$(FW_NAME)_VARS.fd bs=1M seek=64 count=0
+
+build-qemu-efi-aarch64:
+	$(MAKE) -f debian/rules build-qemu-efi EDK2_ARCH_DIR=AArch64 EDK2_HOST_ARCH=AARCH64 FW_NAME=AAVMF
+
 override_dh_auto_clean:
 	set -e; \
 	if [ -d BaseTools/Source/C/bin ]; then \
-- 
2.19.1





More information about the pve-devel mailing list