build and include AAVMF
[pve-edk2-firmware.git] / debian / rules
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 \