bump version to 1.20190312-1
[pve-edk2-firmware.git] / debian / rules
1 #!/usr/bin/make -f
2 SHELL=/bin/bash
3
4 # this is a simplified version from the upstream package
5
6 # Only used for creating our build tools.
7 DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
8 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
9 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
10
11 # for GCC5 and newer, LTO enabled
12 EDK2_TOOLCHAIN=GCC5
13 AARCH64_TOOLCHAIN=GCC5
14 export $(EDK2_TOOLCHAIN)_AARCH64_PREFIX=aarch64-linux-gnu-
15
16 ifeq ($(DEB_BUILD_ARCH),amd64)
17 EDK2_BUILD_ARCH=X64
18 endif
19 ifeq ($(DEB_BUILD_ARCH),arm64)
20 EDK2_BUILD_ARCH=AARCH64
21 endif
22 ifeq ($(DEB_HOST_ARCH),amd64)
23 EDK2_HOST_ARCH=X64
24 endif
25
26 # Clear variables used internally by the edk2 build system
27 undefine WORKSPACE
28 undefine ECP_SOURCE
29 undefine EDK_SOURCE
30 undefine EFI_SOURCE
31 undefine EDK_TOOLS_PATH
32 undefine CONF_PATH
33
34 %:
35 dh $@
36
37 override_dh_auto_build: build-qemu-efi-aarch64 build-ovmf
38
39 setup-build:
40 cp -a debian/Logo.bmp MdeModulePkg/Logo/Logo.bmp
41 make -C BaseTools ARCH=$(EDK2_BUILD_ARCH)
42 # call this when building too, it modifies the shell environment
43 . ./edksetup.sh
44
45 build-ovmf: EDK2_ARCH_DIR=X64
46 build-ovmf: EDK2_HOST_ARCH=X64
47 build-ovmf: setup-build
48 set -e; . ./edksetup.sh; \
49 OvmfPkg/build.sh \
50 -b RELEASE \
51 -a $(EDK2_HOST_ARCH) \
52 -t $(EDK2_TOOLCHAIN) \
53 -DSECURE_BOOT_ENABLE=FALSE \
54 -DFD_SIZE_2MB \
55 -n $$(getconf _NPROCESSORS_ONLN)
56
57 build-qemu-efi: setup-build
58 echo FOO "$${$(EDK2_TOOLCHAIN)_AARCH64_PREFIX}"
59 mkdir -p ShellBinPkg/UefiShell/$(EDK2_ARCH_DIR) FatBinPkg/EnhancedFatDxe/$(EDK2_ARCH_DIR)
60 set -e; . ./edksetup.sh; \
61 build -a $(EDK2_HOST_ARCH) -p ShellPkg/ShellPkg.dsc \
62 -b RELEASE -t $(EDK2_TOOLCHAIN); \
63 cp -a Build/Shell/RELEASE_$(EDK2_TOOLCHAIN)/$(EDK2_HOST_ARCH)/Shell.efi \
64 ShellBinPkg/UefiShell/$(EDK2_ARCH_DIR)/Shell.efi; \
65 build -a $(EDK2_HOST_ARCH) -p FatPkg/FatPkg.dsc \
66 -m FatPkg/EnhancedFatDxe/Fat.inf \
67 -t $(EDK2_TOOLCHAIN) -b RELEASE; \
68 cp -a Build/Fat/RELEASE_$(EDK2_TOOLCHAIN)/$(EDK2_HOST_ARCH)/Fat.efi \
69 FatBinPkg/EnhancedFatDxe/$(EDK2_ARCH_DIR)/Fat.efi; \
70 build -a $(EDK2_HOST_ARCH) \
71 -t $(EDK2_TOOLCHAIN) \
72 -p ArmVirtPkg/ArmVirtQemu.dsc \
73 -DHTTP_BOOT_ENABLE=TRUE \
74 -DSECURE_BOOT_ENABLE=FALSE \
75 -DINTEL_BDS \
76 -b RELEASE
77 dd if=/dev/zero of=Build/ArmVirtQemu-$(EDK2_HOST_ARCH)/RELEASE_$(EDK2_TOOLCHAIN)/FV/$(FW_NAME)_CODE.fd bs=1M seek=64 count=0
78 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
79 dd if=/dev/zero of=Build/ArmVirtQemu-$(EDK2_HOST_ARCH)/RELEASE_$(EDK2_TOOLCHAIN)/FV/$(FW_NAME)_VARS.fd bs=1M seek=64 count=0
80
81 build-qemu-efi-aarch64:
82 $(MAKE) -f debian/rules build-qemu-efi EDK2_ARCH_DIR=AArch64 EDK2_HOST_ARCH=AARCH64 FW_NAME=AAVMF
83
84 override_dh_auto_clean:
85 set -e; \
86 if [ -d BaseTools/Source/C/bin ]; then \
87 . ./edksetup.sh; build clean; \
88 make -C BaseTools clean; \
89 fi
90 rm -rf Conf/.cache Build .pc-post
91
92 .PHONY: setup-build build-ovmf