build and include AAVMF
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 22 Oct 2018 18:27:37 +0000 (20:27 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 23 Oct 2018 07:36:29 +0000 (09:36 +0200)
To allow use in emulated and native AARCH64 VMs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
debian/control
debian/pve-edk2-firmware.install
debian/rules

index 31b4100..d031dca 100644 (file)
@@ -3,6 +3,7 @@ Section: misc
 Priority: extra
 Maintainer: Proxmox Support Team <support@proxmox.com>
 Build-Depends: debhelper (>= 9),
+               gcc-aarch64-linux-gnu,
                iasl,
                nasm,
                python,
@@ -14,7 +15,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.
index 1c99312..681cc2a 100644 (file)
@@ -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
index da3cc01..a582c71 100755 (executable)
@@ -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 \