Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-07-19' into staging
[qemu/ar7.git] / roms / Makefile.edk2
blobc2f2ff59d5b1d8b3fa394ed42c8dd58017b0ddf7
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 submodules:
50         cd edk2 && git submodule update --init --force
52 # See notes on the ".NOTPARALLEL" target and the "+" indicator in
53 # "tests/uefi-test-tools/Makefile".
54 .NOTPARALLEL:
56 ../pc-bios/edk2-aarch64-code.fd: submodules
57         +./edk2-build.sh \
58                 aarch64 \
59                 --arch=AARCH64 \
60                 --platform=ArmVirtPkg/ArmVirtQemu.dsc \
61                 -D NETWORK_IP6_ENABLE \
62                 -D NETWORK_HTTP_BOOT_ENABLE
63         cp edk2/Build/ArmVirtQemu-AARCH64/DEBUG_$(call toolchain,aarch64)/FV/QEMU_EFI.fd \
64                 $@
65         truncate --size=64M $@
67 ../pc-bios/edk2-arm-code.fd: submodules
68         +./edk2-build.sh \
69                 arm \
70                 --arch=ARM \
71                 --platform=ArmVirtPkg/ArmVirtQemu.dsc \
72                 -D NETWORK_IP6_ENABLE \
73                 -D NETWORK_HTTP_BOOT_ENABLE
74         cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_EFI.fd \
75                 $@
76         truncate --size=64M $@
78 ../pc-bios/edk2-i386-code.fd: submodules
79         +./edk2-build.sh \
80                 i386 \
81                 --arch=IA32 \
82                 --platform=OvmfPkg/OvmfPkgIa32.dsc \
83                 -D NETWORK_IP6_ENABLE \
84                 -D NETWORK_HTTP_BOOT_ENABLE \
85                 -D NETWORK_TLS_ENABLE \
86                 -D TPM2_ENABLE \
87                 -D TPM2_CONFIG_ENABLE
88         cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@
90 ../pc-bios/edk2-i386-secure-code.fd: submodules
91         +./edk2-build.sh \
92                 i386 \
93                 --arch=IA32 \
94                 --platform=OvmfPkg/OvmfPkgIa32.dsc \
95                 -D NETWORK_IP6_ENABLE \
96                 -D NETWORK_HTTP_BOOT_ENABLE \
97                 -D NETWORK_TLS_ENABLE \
98                 -D TPM2_ENABLE \
99                 -D TPM2_CONFIG_ENABLE \
100                 -D SECURE_BOOT_ENABLE \
101                 -D SMM_REQUIRE
102         cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@
104 ../pc-bios/edk2-x86_64-code.fd: submodules
105         +./edk2-build.sh \
106                 x86_64 \
107                 --arch=X64 \
108                 --platform=OvmfPkg/OvmfPkgX64.dsc \
109                 -D NETWORK_IP6_ENABLE \
110                 -D NETWORK_HTTP_BOOT_ENABLE \
111                 -D NETWORK_TLS_ENABLE \
112                 -D TPM2_ENABLE \
113                 -D TPM2_CONFIG_ENABLE
114         cp edk2/Build/OvmfX64/DEBUG_$(call toolchain,x86_64)/FV/OVMF_CODE.fd $@
116 ../pc-bios/edk2-x86_64-secure-code.fd: submodules
117         +./edk2-build.sh \
118                 x86_64 \
119                 --arch=IA32 \
120                 --arch=X64 \
121                 --platform=OvmfPkg/OvmfPkgIa32X64.dsc \
122                 -D NETWORK_IP6_ENABLE \
123                 -D NETWORK_HTTP_BOOT_ENABLE \
124                 -D NETWORK_TLS_ENABLE \
125                 -D TPM2_ENABLE \
126                 -D TPM2_CONFIG_ENABLE \
127                 -D SECURE_BOOT_ENABLE \
128                 -D SMM_REQUIRE
129         cp edk2/Build/Ovmf3264/DEBUG_$(call toolchain,x86_64)/FV/OVMF_CODE.fd $@
131 ../pc-bios/edk2-arm-vars.fd: ../pc-bios/edk2-arm-code.fd
132         cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_VARS.fd \
133                 $@
134         truncate --size=64M $@
136 ../pc-bios/edk2-i386-vars.fd: ../pc-bios/edk2-i386-code.fd
137         cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_VARS.fd $@
139 # The license file accumulates several individual licenses from under edk2,
140 # prefixing each individual license with a header (generated by "tail") that
141 # states its pathname.
142 ../pc-bios/edk2-licenses.txt: submodules
143         tail -n $(shell cat $(licenses) | wc -l) $(licenses) > $@
144         dos2unix $@
146 clean:
147         rm -rf edk2/Build
148         cd edk2/Conf && \
149                 rm -rf .cache BuildEnv.sh build_rule.txt target.txt \
150                         tools_def.txt