summaryrefslogtreecommitdiffstats
path: root/roms/Makefile.edk2
blob: fdae0b511f5970dbce8e4a0078da1d8af78b3c31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Makefile for building firmware binaries and variable store templates for a
# number of virtual platforms in edk2.
#
# Copyright (C) 2019 Red Hat, Inc.
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License that accompanies this
# distribution. The full text of the license may be found at
# <http://opensource.org/licenses/bsd-license.php>.
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

SHELL = /bin/bash

toolchain = $(shell source ./edk2-funcs.sh && qemu_edk2_get_toolchain $(1))

licenses := \
	edk2/License.txt \
	edk2/License-History.txt \
	edk2/OvmfPkg/License.txt \
	edk2/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3/COPYING.txt \
	edk2/CryptoPkg/Library/OpensslLib/openssl/LICENSE

# The "edk2-arm-vars.fd" varstore template is suitable for aarch64 as well.
# Similarly, the "edk2-i386-vars.fd" varstore template is suitable for x86_64
# as well, independently of "secure" too.
flashdevs := \
	aarch64-code \
	arm-code \
	i386-code \
	i386-secure-code \
	x86_64-code \
	x86_64-secure-code \
	\
	arm-vars \
	i386-vars

all: $(foreach flashdev,$(flashdevs),../pc-bios/edk2-$(flashdev).fd.bz2) \
	../pc-bios/edk2-licenses.txt

../pc-bios/edk2-%.fd.bz2: ../pc-bios/edk2-%.fd
	bzip2 -9 -c $< > $@

# When the build completes, we need not keep the uncompressed flash device
# files.
.INTERMEDIATE: $(foreach flashdev,$(flashdevs),../pc-bios/edk2-$(flashdev).fd)

# Fetch edk2 submodule's submodules. If it is not in a git tree, assume
# we're building from a tarball and that they've already been fetched by
# make-release/tarball scripts.
submodules:
	if test -d edk2/.git; then \
		cd edk2 && git submodule update --init --force -- \
			ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 \
			BaseTools/Source/C/BrotliCompress/brotli \
			CryptoPkg/Library/OpensslLib/openssl \
			MdeModulePkg/Library/BrotliCustomDecompressLib/brotli \
		; \
	fi

# See notes on the ".NOTPARALLEL" target and the "+" indicator in
# "tests/uefi-test-tools/Makefile".
.NOTPARALLEL:

../pc-bios/edk2-aarch64-code.fd: submodules
	+./edk2-build.sh \
		aarch64 \
		--arch=AARCH64 \
		--platform=ArmVirtPkg/ArmVirtQemu.dsc \
		-D NETWORK_IP6_ENABLE \
		-D NETWORK_HTTP_BOOT_ENABLE \
		-D NETWORK_TLS_ENABLE \
		-D TPM2_ENABLE \
		-D TPM2_CONFIG_ENABLE
	cp edk2/Build/ArmVirtQemu-AARCH64/DEBUG_$(call toolchain,aarch64)/FV/QEMU_EFI.fd \
		$@
	truncate --size=64M $@

../pc-bios/edk2-arm-code.fd: submodules
	+./edk2-build.sh \
		arm \
		--arch=ARM \
		--platform=ArmVirtPkg/ArmVirtQemu.dsc \
		-D NETWORK_IP6_ENABLE \
		-D NETWORK_HTTP_BOOT_ENABLE \
		-D NETWORK_TLS_ENABLE \
		-D TPM2_ENABLE \
		-D TPM2_CONFIG_ENABLE
	cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_EFI.fd \
		$@
	truncate --size=64M $@

../pc-bios/edk2-i386-code.fd: submodules
	+./edk2-build.sh \
		i386 \
		--arch=IA32 \
		--platform=OvmfPkg/OvmfPkgIa32.dsc \
		-D NETWORK_IP6_ENABLE \
		-D NETWORK_HTTP_BOOT_ENABLE \
		-D NETWORK_TLS_ENABLE \
		-D TPM_ENABLE \
		-D TPM_CONFIG_ENABLE
	cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@

../pc-bios/edk2-i386-secure-code.fd: submodules
	+./edk2-build.sh \
		i386 \
		--arch=IA32 \
		--platform=OvmfPkg/OvmfPkgIa32.dsc \
		-D NETWORK_IP6_ENABLE \
		-D NETWORK_HTTP_BOOT_ENABLE \
		-D NETWORK_TLS_ENABLE \
		-D TPM_ENABLE \
		-D TPM_CONFIG_ENABLE \
		-D SECURE_BOOT_ENABLE \
		-D SMM_REQUIRE
	cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_CODE.fd $@

../pc-bios/edk2-x86_64-code.fd: submodules
	+./edk2-build.sh \
		x86_64 \
		--arch=X64 \
		--platform=OvmfPkg/OvmfPkgX64.dsc \
		-D NETWORK_IP6_ENABLE \
		-D NETWORK_HTTP_BOOT_ENABLE \
		-D NETWORK_TLS_ENABLE \
		-D TPM_ENABLE \
		-D TPM_CONFIG_ENABLE
	cp edk2/Build/OvmfX64/DEBUG_$(call toolchain,x86_64)/FV/OVMF_CODE.fd $@

../pc-bios/edk2-x86_64-secure-code.fd: submodules
	+./edk2-build.sh \
		x86_64 \
		--arch=IA32 \
		--arch=X64 \
		--platform=OvmfPkg/OvmfPkgIa32X64.dsc \
		-D NETWORK_IP6_ENABLE \
		-D NETWORK_HTTP_BOOT_ENABLE \
		-D NETWORK_TLS_ENABLE \
		-D TPM_ENABLE \
		-D TPM_CONFIG_ENABLE \
		-D SECURE_BOOT_ENABLE \
		-D SMM_REQUIRE
	cp edk2/Build/Ovmf3264/DEBUG_$(call toolchain,x86_64)/FV/OVMF_CODE.fd $@

../pc-bios/edk2-arm-vars.fd: ../pc-bios/edk2-arm-code.fd
	cp edk2/Build/ArmVirtQemu-ARM/DEBUG_$(call toolchain,arm)/FV/QEMU_VARS.fd \
		$@
	truncate --size=64M $@

../pc-bios/edk2-i386-vars.fd: ../pc-bios/edk2-i386-code.fd
	cp edk2/Build/OvmfIa32/DEBUG_$(call toolchain,i386)/FV/OVMF_VARS.fd $@

# The license file accumulates several individual licenses from under edk2,
# prefixing each individual license with a header (generated by "tail") that
# states its pathname.
../pc-bios/edk2-licenses.txt: submodules
	tail -n $(shell cat $(licenses) | wc -l) $(licenses) > $@
	dos2unix $@

clean:
	rm -rf edk2/Build
	cd edk2/Conf && \
		rm -rf .cache BuildEnv.sh build_rule.txt target.txt \
			tools_def.txt