roms/Makefile.edk2: prepare for replacing TPM2*_ENABLE macros
[qemu/ar7.git] / roms / Makefile.edk2
blob7c06645c95ca9f9371c1932fa831a6231b478d73
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.
14 SHELL = /bin/bash
16 toolchain = $(shell source ./edk2-funcs.sh && qemu_edk2_get_toolchain $(1))
18 licenses := \
19         edk2/License.txt \
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.
28 flashdevs := \
29         aarch64-code \
30         arm-code \
31         i386-code \
32         i386-secure-code \
33         x86_64-code \
34         x86_64-secure-code \
35         \
36         arm-vars \
37         i386-vars
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
43         bzip2 -9 -c $< > $@
45 # When the build completes, we need not keep the uncompressed flash device
46 # files.
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.
52 submodules:
53         if test -d edk2/.git; then \
54                 cd edk2 && git submodule update --init --force; \
55         fi
57 # See notes on the ".NOTPARALLEL" target and the "+" indicator in
58 # "tests/uefi-test-tools/Makefile".
59 .NOTPARALLEL:
61 ../pc-bios/edk2-aarch64-code.fd: submodules
62         +./edk2-build.sh \
63                 aarch64 \
64                 --arch=AARCH64 \
65                 --platform=ArmVirtPkg/ArmVirtQemu.dsc \
66                 -D NETWORK_IP6_ENABLE \
67                 -D NETWORK_HTTP_BOOT_ENABLE
68         cp edk2/Build/ArmVirtQemu-AARCH64/DEBUG_$(call toolchain,aarch64)/FV/QEMU_EFI.fd \
69                 $@
70         truncate --size=64M $@
72 ../pc-bios/edk2-arm-code.fd: submodules
73         +./edk2-build.sh \
74                 arm \
75                 --arch=ARM \
76                 --platform=ArmVirtPkg/ArmVirtQemu.dsc \
77                 -D NETWORK_IP6_ENABLE \
78                 -D NETWORK_HTTP_BOOT_ENABLE
79         cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_EFI.fd \
80                 $@
81         truncate --size=64M $@
83 ../pc-bios/edk2-i386-code.fd: submodules
84         +./edk2-build.sh \
85                 i386 \
86                 --arch=IA32 \
87                 --platform=OvmfPkg/OvmfPkgIa32.dsc \
88                 -D NETWORK_IP6_ENABLE \
89                 -D NETWORK_HTTP_BOOT_ENABLE \
90                 -D NETWORK_TLS_ENABLE \
91                 -D TPM_ENABLE \
92                 -D TPM_CONFIG_ENABLE \
93                 -D TPM2_ENABLE \
94                 -D TPM2_CONFIG_ENABLE
95         cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@
97 ../pc-bios/edk2-i386-secure-code.fd: submodules
98         +./edk2-build.sh \
99                 i386 \
100                 --arch=IA32 \
101                 --platform=OvmfPkg/OvmfPkgIa32.dsc \
102                 -D NETWORK_IP6_ENABLE \
103                 -D NETWORK_HTTP_BOOT_ENABLE \
104                 -D NETWORK_TLS_ENABLE \
105                 -D TPM_ENABLE \
106                 -D TPM_CONFIG_ENABLE \
107                 -D TPM2_ENABLE \
108                 -D TPM2_CONFIG_ENABLE \
109                 -D SECURE_BOOT_ENABLE \
110                 -D SMM_REQUIRE
111         cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@
113 ../pc-bios/edk2-x86_64-code.fd: submodules
114         +./edk2-build.sh \
115                 x86_64 \
116                 --arch=X64 \
117                 --platform=OvmfPkg/OvmfPkgX64.dsc \
118                 -D NETWORK_IP6_ENABLE \
119                 -D NETWORK_HTTP_BOOT_ENABLE \
120                 -D NETWORK_TLS_ENABLE \
121                 -D TPM_ENABLE \
122                 -D TPM_CONFIG_ENABLE \
123                 -D TPM2_ENABLE \
124                 -D TPM2_CONFIG_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
128         +./edk2-build.sh \
129                 x86_64 \
130                 --arch=IA32 \
131                 --arch=X64 \
132                 --platform=OvmfPkg/OvmfPkgIa32X64.dsc \
133                 -D NETWORK_IP6_ENABLE \
134                 -D NETWORK_HTTP_BOOT_ENABLE \
135                 -D NETWORK_TLS_ENABLE \
136                 -D TPM_ENABLE \
137                 -D TPM_CONFIG_ENABLE \
138                 -D TPM2_ENABLE \
139                 -D TPM2_CONFIG_ENABLE \
140                 -D SECURE_BOOT_ENABLE \
141                 -D SMM_REQUIRE
142         cp edk2/Build/Ovmf3264/DEBUG_$(call toolchain,x86_64)/FV/OVMF_CODE.fd $@
144 ../pc-bios/edk2-arm-vars.fd: ../pc-bios/edk2-arm-code.fd
145         cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_VARS.fd \
146                 $@
147         truncate --size=64M $@
149 ../pc-bios/edk2-i386-vars.fd: ../pc-bios/edk2-i386-code.fd
150         cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_VARS.fd $@
152 # The license file accumulates several individual licenses from under edk2,
153 # prefixing each individual license with a header (generated by "tail") that
154 # states its pathname.
155 ../pc-bios/edk2-licenses.txt: submodules
156         tail -n $(shell cat $(licenses) | wc -l) $(licenses) > $@
157         dos2unix $@
159 clean:
160         rm -rf edk2/Build
161         cd edk2/Conf && \
162                 rm -rf .cache BuildEnv.sh build_rule.txt target.txt \
163                         tools_def.txt