1 # Makefile for building firmware binaries and variable store templates for a
2 # number of virtual platforms in edk2.
4 # Copyright (C) 2019 Red Hat, Inc.
6 # This program and the accompanying materials are licensed and made available
7 # under the terms and conditions of the BSD License that accompanies this
8 # distribution. The full text of the license may be found at
9 # <http://opensource.org/licenses/bsd-license.php>.
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 toolchain = $(shell source ./edk2-funcs.sh && qemu_edk2_get_toolchain $(1))
20 edk2/License-History.txt \
21 edk2/OvmfPkg/License.txt \
22 edk2/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3/COPYING.txt \
23 edk2/CryptoPkg/Library/OpensslLib/openssl/LICENSE
25 # The "edk2-arm-vars.fd" varstore template is suitable for aarch64 as well.
26 # Similarly, the "edk2-i386-vars.fd" varstore template is suitable for x86_64
27 # as well, independently of "secure" too.
39 all: $(foreach flashdev,$(flashdevs),../pc-bios/edk2-$(flashdev).fd.bz2) \
40 ../pc-bios/edk2-licenses.txt
42 ../pc-bios/edk2-%.fd.bz2: ../pc-bios/edk2-%.fd
45 # When the build completes, we need not keep the uncompressed flash device
47 .INTERMEDIATE: $(foreach flashdev,$(flashdevs),../pc-bios/edk2-$(flashdev).fd)
49 # Fetch edk2 submodule's submodules. If it is not in a git tree, assume
50 # we're building from a tarball and that they've already been fetched by
51 # make-release/tarball scripts.
53 if test -d edk2/.git; then \
54 cd edk2 && git submodule update --init --force; \
57 # See notes on the ".NOTPARALLEL" target and the "+" indicator in
58 # "tests/uefi-test-tools/Makefile".
61 ../pc-bios/edk2-aarch64-code.fd: submodules
65 --platform=ArmVirtPkg/ArmVirtQemu.dsc \
66 -D NETWORK_IP6_ENABLE \
67 -D NETWORK_HTTP_BOOT_ENABLE \
68 -D NETWORK_TLS_ENABLE \
71 cp edk2/Build/ArmVirtQemu-AARCH64/DEBUG_$(call toolchain,aarch64)/FV/QEMU_EFI.fd \
73 truncate --size=64M $@
75 ../pc-bios/edk2-arm-code.fd: submodules
79 --platform=ArmVirtPkg/ArmVirtQemu.dsc \
80 -D NETWORK_IP6_ENABLE \
81 -D NETWORK_HTTP_BOOT_ENABLE \
82 -D NETWORK_TLS_ENABLE \
85 cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_EFI.fd \
87 truncate --size=64M $@
89 ../pc-bios/edk2-i386-code.fd: submodules
93 --platform=OvmfPkg/OvmfPkgIa32.dsc \
94 -D NETWORK_IP6_ENABLE \
95 -D NETWORK_HTTP_BOOT_ENABLE \
96 -D NETWORK_TLS_ENABLE \
99 cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@
101 ../pc-bios/edk2-i386-secure-code.fd: submodules
105 --platform=OvmfPkg/OvmfPkgIa32.dsc \
106 -D NETWORK_IP6_ENABLE \
107 -D NETWORK_HTTP_BOOT_ENABLE \
108 -D NETWORK_TLS_ENABLE \
110 -D TPM_CONFIG_ENABLE \
111 -D SECURE_BOOT_ENABLE \
113 cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@
115 ../pc-bios/edk2-x86_64-code.fd: submodules
119 --platform=OvmfPkg/OvmfPkgX64.dsc \
120 -D NETWORK_IP6_ENABLE \
121 -D NETWORK_HTTP_BOOT_ENABLE \
122 -D NETWORK_TLS_ENABLE \
125 cp edk2/Build/OvmfX64/DEBUG_$(call toolchain,x86_64)/FV/OVMF_CODE.fd $@
127 ../pc-bios/edk2-x86_64-secure-code.fd: submodules
132 --platform=OvmfPkg/OvmfPkgIa32X64.dsc \
133 -D NETWORK_IP6_ENABLE \
134 -D NETWORK_HTTP_BOOT_ENABLE \
135 -D NETWORK_TLS_ENABLE \
137 -D TPM_CONFIG_ENABLE \
138 -D SECURE_BOOT_ENABLE \
140 cp edk2/Build/Ovmf3264/DEBUG_$(call toolchain,x86_64)/FV/OVMF_CODE.fd $@
142 ../pc-bios/edk2-arm-vars.fd: ../pc-bios/edk2-arm-code.fd
143 cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_VARS.fd \
145 truncate --size=64M $@
147 ../pc-bios/edk2-i386-vars.fd: ../pc-bios/edk2-i386-code.fd
148 cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_VARS.fd $@
150 # The license file accumulates several individual licenses from under edk2,
151 # prefixing each individual license with a header (generated by "tail") that
152 # states its pathname.
153 ../pc-bios/edk2-licenses.txt: submodules
154 tail -n $(shell cat $(licenses) | wc -l) $(licenses) > $@
160 rm -rf .cache BuildEnv.sh build_rule.txt target.txt \