1 | # $Id: Makefile.kmk 105049 2024-06-27 09:11:08Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Toplevel sub-makefile for the EFI firmwares.
|
---|
4 | #
|
---|
5 | # Note! kBuild is only used for the build tools, the rest is handled by the
|
---|
6 | # very custom EFI build system.
|
---|
7 | #
|
---|
8 |
|
---|
9 | #
|
---|
10 | # Copyright (C) 2013-2023 Oracle and/or its affiliates.
|
---|
11 | #
|
---|
12 | # This file is part of VirtualBox base platform packages, as
|
---|
13 | # available from https://www.virtualbox.org.
|
---|
14 | #
|
---|
15 | # This program is free software; you can redistribute it and/or
|
---|
16 | # modify it under the terms of the GNU General Public License
|
---|
17 | # as published by the Free Software Foundation, in version 3 of the
|
---|
18 | # License.
|
---|
19 | #
|
---|
20 | # This program is distributed in the hope that it will be useful, but
|
---|
21 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
23 | # General Public License for more details.
|
---|
24 | #
|
---|
25 | # You should have received a copy of the GNU General Public License
|
---|
26 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
27 | #
|
---|
28 | # The contents of this file may alternatively be used under the terms
|
---|
29 | # of the Common Development and Distribution License Version 1.0
|
---|
30 | # (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
31 | # in the VirtualBox distribution, in which case the provisions of the
|
---|
32 | # CDDL are applicable instead of those of the GPL.
|
---|
33 | #
|
---|
34 | # You may elect to license modified versions of this file under the
|
---|
35 | # terms and conditions of either the GPL or the CDDL or both.
|
---|
36 | #
|
---|
37 | # SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
38 | #
|
---|
39 |
|
---|
40 | SUB_DEPTH = ../../../../..
|
---|
41 | include $(KBUILD_PATH)/subheader.kmk
|
---|
42 |
|
---|
43 | #
|
---|
44 | # Make sure our Config.kmk is included.
|
---|
45 | #
|
---|
46 | ifndef VBOX_EFI_FIRMWARE_CONFIG_KMK_INCLUDED
|
---|
47 | include $(PATH_SUB_CURRENT)/Config.kmk
|
---|
48 | endif
|
---|
49 |
|
---|
50 |
|
---|
51 | #
|
---|
52 | # Include sub-makefiles.
|
---|
53 | #
|
---|
54 | VBOX_EFI_BLDPROGS := $(BLDPROGS)
|
---|
55 | include $(PATH_SUB_CURRENT)/BaseTools/Makefile.kmk
|
---|
56 | VBOX_EFI_BLDPROGS := $(filter-out $(VBOX_EFI_BLDPROGS),$(BLDPROGS)) VBoxEfiBldPythonWrappers
|
---|
57 |
|
---|
58 | #
|
---|
59 | # Binary wrappers for python scripts.
|
---|
60 | #
|
---|
61 | VBOX_EFI_PYTHON_WRAPPERS = \
|
---|
62 | AmlToC \
|
---|
63 | BPDG \
|
---|
64 | build \
|
---|
65 | Ecc \
|
---|
66 | GenFds \
|
---|
67 | GenPatchPcdTable \
|
---|
68 | PatchPcdValue \
|
---|
69 | Split \
|
---|
70 | Trim \
|
---|
71 | TargetTool \
|
---|
72 | UPT
|
---|
73 |
|
---|
74 | INSTALLS += VBoxEfiBldPythonWrappers
|
---|
75 | VBoxEfiBldPythonWrappers_TEMPLATE = VBoxEfiBldProg
|
---|
76 | if1of ($(KBUILD_HOST), win os2)
|
---|
77 | VBoxEfiBldPythonWrappers_EXEC_SOURCES = \
|
---|
78 | $(foreach PyWrap,$(VBOX_EFI_PYTHON_WRAPPERS),$(VBoxEfiBldPythonWrappers_0_OUTDIR)/$(PyWrap).cmd)
|
---|
79 | else
|
---|
80 | VBoxEfiBldPythonWrappers_EXEC_SOURCES = \
|
---|
81 | $(addprefix $(VBoxEfiBldPythonWrappers_0_OUTDIR)/,$(VBOX_EFI_PYTHON_WRAPPERS))
|
---|
82 | endif
|
---|
83 | VBoxEfiBldPythonWrappers_CLEAN = $(VBoxEfiBldPythonWrappers_EXEC_SOURCES)
|
---|
84 |
|
---|
85 | if1of ($(KBUILD_HOST), win os2)
|
---|
86 | define VBoxEfiBldPythonWrappersRuleTemplate
|
---|
87 | $$$$(VBoxEfiBldPythonWrappers_0_OUTDIR)/$(PyWrap).cmd: | $$$$(dir $$$$@)
|
---|
88 | $$(APPEND) -tn "$$@" \
|
---|
89 | '@SET PYTHONPATH=$$(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/Python' \
|
---|
90 | '@"$$(VBOX_BLD_PYTHON)" "$$(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/Python/$(PyWrap)/$(PyWrap).py" %*'
|
---|
91 | endef
|
---|
92 | else
|
---|
93 | define VBoxEfiBldPythonWrappersRuleTemplate
|
---|
94 | $$$$(VBoxEfiBldPythonWrappers_0_OUTDIR)/$(PyWrap): | $$$$(dir $$$$@)
|
---|
95 | $$(APPEND) -tn "$$@" \
|
---|
96 | '#!$(ASH)' \
|
---|
97 | 'export PYTHONPATH="$$(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/Python"' \
|
---|
98 | 'exec "$$(VBOX_BLD_PYTHON)" "$$(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/Python/$(PyWrap)/$(PyWrap).py" "$$(DOLLAR)@"'
|
---|
99 | $$(CHMOD) a+x "$$@"
|
---|
100 | endef
|
---|
101 | endif
|
---|
102 | $(foreach PyWrap,$(VBOX_EFI_PYTHON_WRAPPERS),$(eval $(VBoxEfiBldPythonWrappersRuleTemplate)))
|
---|
103 |
|
---|
104 | #
|
---|
105 | # Rules for building and installing the VBox EFI firmware images.
|
---|
106 | #
|
---|
107 | INSTALLS += VBoxEfiFirmware
|
---|
108 | VBoxEfiFirmware_INST = $(INST_BIN)
|
---|
109 | VBoxEfiFirmware_MODE = 0644
|
---|
110 | VBoxEfiFirmware_SOURCES = \
|
---|
111 | $(VBoxEfiFirmware_0_OUTDIR)/x86/$(VBOX_EFI_OUTPUT_SUBDIR)/FV/OVMF.fd=>VBoxEFI32.fd \
|
---|
112 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/$(VBOX_EFI_OUTPUT_SUBDIR)/FV/OVMF.fd=>VBoxEFI64.fd
|
---|
113 | VBoxEfiFirmware_BLDDIRS = \
|
---|
114 | $(VBoxEfiFirmware_0_OUTDIR)/x86/ \
|
---|
115 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/ \
|
---|
116 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/ \
|
---|
117 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/
|
---|
118 | VBoxEfiFirmware_CLEAN = \
|
---|
119 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/target.txt \
|
---|
120 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/build_rule.txt \
|
---|
121 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/tools_def.txt \
|
---|
122 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/target.txt \
|
---|
123 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/build_rule.txt \
|
---|
124 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/tools_def.txt
|
---|
125 |
|
---|
126 | ifdef VBOX_WITH_VIRT_ARMV8
|
---|
127 | VBoxEfiFirmware_SOURCES += \
|
---|
128 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/$(VBOX_EFI_OUTPUT_SUBDIR)/FV/QEMU_EFI.fd=>VBoxEFIAArch32.fd \
|
---|
129 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/$(VBOX_EFI_OUTPUT_SUBDIR)/FV/QEMU_EFI.fd=>VBoxEFIAArch64.fd
|
---|
130 | VBoxEfiFirmware_BLDDIRS += \
|
---|
131 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/ \
|
---|
132 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/ \
|
---|
133 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/ \
|
---|
134 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/
|
---|
135 | VBoxEfiFirmware_CLEAN += \
|
---|
136 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/target.txt \
|
---|
137 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/build_rule.txt \
|
---|
138 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/tools_def.txt \
|
---|
139 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/target.txt \
|
---|
140 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/build_rule.txt \
|
---|
141 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/tools_def.txt
|
---|
142 | endif
|
---|
143 |
|
---|
144 | # Install the debug info.
|
---|
145 | INSTALLS += VBoxEfiFirmwareDbg32
|
---|
146 | VBoxEfiFirmwareDbg32_INST = $(INST_VBOXDBG_SYMS)x86/
|
---|
147 | VBoxEfiFirmwareDbg32_MODE = 0644
|
---|
148 | if1of ($(KBUILD_HOST), win)
|
---|
149 | VBoxEfiFirmwareDbg32_SOURCES = \
|
---|
150 | $(foreach mod,$(VBOX_EFI_MODULES_X86),$(VBoxEfiFirmware_0_OUTDIR)/x86/$(VBOX_EFI_OUTPUT_SUBDIR)/IA32/$(mod).pdb)
|
---|
151 | else
|
---|
152 | VBoxEfiFirmwareDbg32_SOURCES = \
|
---|
153 | $(foreach mod,$(VBOX_EFI_MODULES_FLAT_X86),$(VBoxEfiFirmware_0_OUTDIR)/x86/$(VBOX_EFI_OUTPUT_SUBDIR)/IA32/$(mod).debug)
|
---|
154 | endif
|
---|
155 |
|
---|
156 | INSTALLS += VBoxEfiFirmwareDbg64
|
---|
157 | VBoxEfiFirmwareDbg64_INST = $(INST_VBOXDBG_SYMS)amd64/
|
---|
158 | VBoxEfiFirmwareDbg64_MODE = 0644
|
---|
159 | if1of ($(KBUILD_HOST), win)
|
---|
160 | VBoxEfiFirmwareDbg64_SOURCES = \
|
---|
161 | $(foreach mod,$(VBOX_EFI_MODULES_X86),$(VBoxEfiFirmware_0_OUTDIR)/amd64/$(VBOX_EFI_OUTPUT_SUBDIR)/X64/$(mod).pdb)
|
---|
162 | else
|
---|
163 | VBoxEfiFirmwareDbg64_SOURCES = \
|
---|
164 | $(foreach mod,$(VBOX_EFI_MODULES_FLAT_X86),$(VBoxEfiFirmware_0_OUTDIR)/amd64/$(VBOX_EFI_OUTPUT_SUBDIR)/X64/$(mod).debug)
|
---|
165 | endif
|
---|
166 |
|
---|
167 | ifdef VBOX_WITH_VIRT_ARMV8
|
---|
168 | INSTALLS += VBoxEfiFirmwareDbgAarch32
|
---|
169 | VBoxEfiFirmwareDbgAarch32_INST = $(INST_VBOXDBG_SYMS)aarch32/
|
---|
170 | VBoxEfiFirmwareDbgAarch32_MODE = 0644
|
---|
171 | if1of ($(KBUILD_HOST), win)
|
---|
172 | VBoxEfiFirmwareDbgAarch32_SOURCES = \
|
---|
173 | $(foreach mod,$(VBOX_EFI_MODULES_ARM),$(VBoxEfiFirmware_0_OUTDIR)/aarch32/$(VBOX_EFI_OUTPUT_SUBDIR)/ARM/$(mod).pdb)
|
---|
174 | else
|
---|
175 | VBoxEfiFirmwareDbgAarch32_SOURCES = \
|
---|
176 | $(foreach mod,$(VBOX_EFI_MODULES_FLAT_ARM),$(VBoxEfiFirmware_0_OUTDIR)/aarch32/$(VBOX_EFI_OUTPUT_SUBDIR)/ARM/$(mod).debug)
|
---|
177 | endif
|
---|
178 |
|
---|
179 | INSTALLS += VBoxEfiFirmwareDbgAarch64
|
---|
180 | VBoxEfiFirmwareDbgAarch64_INST = $(INST_VBOXDBG_SYMS)aarch64/
|
---|
181 | VBoxEfiFirmwareDbgAarch64_MODE = 0644
|
---|
182 | if1of ($(KBUILD_HOST), win)
|
---|
183 | VBoxEfiFirmwareDbgAarch64_SOURCES = \
|
---|
184 | $(foreach mod,$(VBOX_EFI_MODULES_ARM),$(VBoxEfiFirmware_0_OUTDIR)/aarch64/$(VBOX_EFI_OUTPUT_SUBDIR)/AARCH64/$(mod).pdb)
|
---|
185 | else
|
---|
186 | VBoxEfiFirmwareDbgAarch64_SOURCES = \
|
---|
187 | $(foreach mod,$(VBOX_EFI_MODULES_FLAT_ARM),$(VBoxEfiFirmware_0_OUTDIR)/aarch64/$(VBOX_EFI_OUTPUT_SUBDIR)/AARCH64/$(mod).debug)
|
---|
188 | endif
|
---|
189 | endif
|
---|
190 |
|
---|
191 |
|
---|
192 | #
|
---|
193 | # Install a custom clean up rule for dealing with the EFI build system output.
|
---|
194 | #
|
---|
195 | PASS_CLEAN_trgs += VBoxEfiFirmwareCleanup
|
---|
196 | VBoxEfiFirmwareCleanup:
|
---|
197 | $(if $(VBoxEfiFirmware_0_OUTDIR),,exit 1)
|
---|
198 | $(RM) -Rf -- "$(VBoxEfiFirmware_0_OUTDIR)/amd64/" "$(VBoxEfiFirmware_0_OUTDIR)/x86/"
|
---|
199 | $(if $(VBOX_WITH_VIRT_ARMV8),$(RM) -Rf -- "$(VBoxEfiFirmware_0_OUTDIR)/aarch64/" "$(VBoxEfiFirmware_0_OUTDIR)/aarch32/",)
|
---|
200 | .PHONY: VBoxEfiFirmwareCleanup
|
---|
201 |
|
---|
202 |
|
---|
203 | #
|
---|
204 | # The zipfile.
|
---|
205 | #
|
---|
206 | include $(KBUILD_PATH)/tools/ZIP.kmk
|
---|
207 | ifndef TOOL_ZIP_PACK
|
---|
208 | TOOL_ZIP_PACK = zip
|
---|
209 | endif
|
---|
210 | VBoxEfiFirmware.zip: $(PATH_STAGE)/VBoxEfiFirmware.zip
|
---|
211 | $(PATH_STAGE)/VBoxEfiFirmware.zip:
|
---|
212 | $(REDIRECT) -C "$(PATH_STAGE_BIN)" -- $(TOOL_ZIP_PACK) $(TOOL_ZIP_PACKFLAGS) -9X $@ \
|
---|
213 | VBoxEFI32.fd \
|
---|
214 | VBoxEFI64.fd
|
---|
215 | $(REDIRECT) -C "$(PATH_STAGE)/$(INST_VBOXDBG_SYMS)" -- $(TOOL_ZIP_PACK) $(TOOL_ZIP_PACKFLAGS) -9X $@ \
|
---|
216 | $(foreach mod,$(VBOX_EFI_MODULES_FLAT_X86),amd64/$(mod)$(VBOX_EFI_DBG_SUFF)) \
|
---|
217 | $(foreach mod,$(VBOX_EFI_MODULES_FLAT_X86),x86/$(mod)$(VBOX_EFI_DBG_SUFF))
|
---|
218 |
|
---|
219 | ifdef VBOX_WITH_VIRT_ARMV8
|
---|
220 | VBoxEfiFirmware-armv8.zip: $(PATH_STAGE)/VBoxEfiFirmware-armv8.zip
|
---|
221 | $(PATH_STAGE)/VBoxEfiFirmware-armv8.zip:
|
---|
222 | $(REDIRECT) -C "$(PATH_STAGE_BIN)" -- $(TOOL_ZIP_PACK) $(TOOL_ZIP_PACKFLAGS) -9X $@ \
|
---|
223 | VBoxEFIAArch32.fd \
|
---|
224 | VBoxEFIAArch64.fd
|
---|
225 | $(REDIRECT) -C "$(PATH_STAGE)/$(INST_VBOXDBG_SYMS)" -- $(TOOL_ZIP_PACK) $(TOOL_ZIP_PACKFLAGS) -9X $@ \
|
---|
226 | $(foreach mod,$(VBOX_EFI_MODULES_FLAT_ARM),aarch64/$(mod)$(VBOX_EFI_DBG_SUFF)) \
|
---|
227 | $(foreach mod,$(VBOX_EFI_MODULES_FLAT_ARM),aarch32/$(mod)$(VBOX_EFI_DBG_SUFF))
|
---|
228 | endif
|
---|
229 |
|
---|
230 | #
|
---|
231 | # Include the footer early so that we can use VBoxEfiFirmware_0_OUTDIR below.
|
---|
232 | #
|
---|
233 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
234 |
|
---|
235 | #
|
---|
236 | # Incomplete list of dependencies relative.
|
---|
237 | #
|
---|
238 | VBOX_EFI_DEPENDENCIES = \
|
---|
239 | $(VBOX_PATH_EFI_FIRMWARE)/../DevEFI.h \
|
---|
240 | $(VBOX_PATH_EFI_FIRMWARE)/VBoxPkg/Library/VBoxDebugAgentLib/VBoxDebugAgentLib.c \
|
---|
241 | $(VBOX_PATH_EFI_FIRMWARE)/VBoxPkg/Library/VBoxDebugAgentLib/VBoxDebugAgentLib.inf \
|
---|
242 | $(VBOX_PATH_EFI_FIRMWARE)/VBoxPkg/VBoxPkg.dec \
|
---|
243 | \
|
---|
244 | $(VBOX_PATH_EFI_FIRMWARE)/OvmfPkg/OvmfPkg.dec
|
---|
245 |
|
---|
246 | #
|
---|
247 | # The common build.py invocation part.
|
---|
248 | # Note! windir isn't set in cygwin on tinderwin2a. SystemRoot is.
|
---|
249 | # Note! MAKEFLAGS must be zapped on Windows so nmake don't get confused.
|
---|
250 | #
|
---|
251 | if1of ($(KBUILD_HOST), win)
|
---|
252 | VBOX_EFI_REDIRECT_E_EQUAL := $(EQUAL)
|
---|
253 | VBOX_EFI_BUILD_CMD = $(REDIRECT) \
|
---|
254 | -E 'PATH=$(VBOX_PATH_STAGE_EFI_BLDPROGS)$(VBOX_SEP)$(PATH);' \
|
---|
255 | -E 'INCLUDE=$(PATH_ROOT)/include$(VBOX_SEP)$(PATH_OUT)$(VBOX_SEP)$(VBOX_PATH_EFI_FIRMWARE)/..$(VBOX_SEP)$(PATH_TOOL_$(VBOX_VCC_TOOL)_INC)$(INCLUDE);' \
|
---|
256 | -E 'COMSPEC=$(firstword $(windir) $(SystemRoot) C:\windows)\system32\cmd.exe' \
|
---|
257 | -E 'MAKEFLAGS='
|
---|
258 | else
|
---|
259 | VBOX_EFI_REDIRECT_E_EQUAL :=
|
---|
260 | VBOX_EFI_BUILD_CMD = $(REDIRECT) \
|
---|
261 | -E "PATH=$(VBOX_PATH_STAGE_EFI_BLDPROGS)$(VBOX_SEP)$(PATH)" \
|
---|
262 | -E "C_INCLUDE_PATH=$(PATH_ROOT)/include$(VBOX_SEP)$(PATH_OUT)$(VBOX_SEP)$(VBOX_PATH_EFI_FIRMWARE)/..$(VBOX_SEP)$(C_INCLUDE_PATH)" \
|
---|
263 | -E "CPLUS_INCLUDE_PATH=$(PATH_ROOT)/include$(VBOX_SEP)$(PATH_OUT)$(VBOX_SEP)$(VBOX_PATH_EFI_FIRMWARE)/..$(VBOX_SEP)$(CPLUS_INCLUDE_PATH)"
|
---|
264 | endif
|
---|
265 | VBOX_EFI_BUILD_CMD += \
|
---|
266 | -E 'PYTHONPATH=$(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/Python' \
|
---|
267 | -E 'PYTHONDONTWRITEBYTECODE=1' \
|
---|
268 | -E 'IASL_BIN=$(VBOX_IASLCMD)' \
|
---|
269 | -E 'NASM_BIN=$(VBOX_NASMCMD)' \
|
---|
270 | -E 'CONF_PATH=$(abspath $(@D)/../../Conf)' \
|
---|
271 | -E 'WORKSPACE=$(VBOX_PATH_EFI_FIRMWARE)' \
|
---|
272 | -E 'EDK_TOOLS_PATH=$(VBOX_PATH_EFI_FIRMWARE)/BaseTools' \
|
---|
273 | -E 'EFI_SOURCE$(VBOX_EFI_REDIRECT_E_EQUAL)' \
|
---|
274 | -E 'ECP_SOURCE$(VBOX_EFI_REDIRECT_E_EQUAL)' \
|
---|
275 | -E 'EDK_SOURCE$(VBOX_EFI_REDIRECT_E_EQUAL)' \
|
---|
276 | -E 'X64_PETOOLS_PREFIX$(VBOX_EFI_REDIRECT_E_EQUAL)' \
|
---|
277 | -E 'ARCH$(VBOX_EFI_REDIRECT_E_EQUAL)' \
|
---|
278 | -E 'IPF_PETOOLS_PREFIX=__no_ipf__' \
|
---|
279 | -E $(if-expr "$(KBUILD_VERBOSE)" != "",'EFI_QUIET=','EFI_QUIET=@') \
|
---|
280 | -C '$(VBOX_PATH_EFI_FIRMWARE)' \
|
---|
281 | -- $(VBOX_BLD_PYTHON) "$(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Source/Python/build/build.py" \
|
---|
282 | -D VBOX=1 \
|
---|
283 | -D VBOX_WITH_OVMF=1 \
|
---|
284 | $(if $(VBOX_WITH_EFI_SECURE_BOOT),-D "SECURE_BOOT_ENABLE=1") \
|
---|
285 | $(if $(VBOX_WITH_EFI_TPM),-D "TPM_ENABLE=1" -D "TPM1_ENABLE" -D "TPM2_ENABLE") \
|
---|
286 | $(if $(VBOX_WITH_EFI_TPM),-D "TPM_CONFIG_ENABLE=1") \
|
---|
287 | -D BUILD_NEW_SHELL=1 \
|
---|
288 | -D VBOX_REV=$(VBOX_SVN_REV) \
|
---|
289 | -D "VBOX_OUTPUT_BASE_DIR=$(VBoxEfiFirmware_0_OUTDIR)" \
|
---|
290 | -D "VBOX_PATH_ROOT=$(PATH_ROOT)" \
|
---|
291 | -D "FD_SIZE_4MB=1" \
|
---|
292 | -D "FD_SIZE_IN_MB=3" \
|
---|
293 | $(if $(VBOX_OSE),-D "VBOX_OSE=1") \
|
---|
294 | $(if-expr "$(KBUILD_VERBOSE)" != "",$(if-expr "$(KBUILD_VERBOSE)" >= 3,-v,),--silent --quiet) \
|
---|
295 | --no-cache \
|
---|
296 | --buildtarget $(VBOX_EFI_BUILD_TARGET) \
|
---|
297 | --tagname $(VBOX_EFI_TOOL_CHAIN)
|
---|
298 |
|
---|
299 | #
|
---|
300 | # Derive the number of parallel jobs (on windows) from KMK_OPTS_JOBS.
|
---|
301 | #
|
---|
302 | VBOX_EFI_MAX_THREADS := 1
|
---|
303 | if defined(KMK_OPTS_JOBS) && "$(KBUILD_HOST)" == "win"
|
---|
304 | VBOX_EFI_MAX_THREADS := $(if-expr $(KMK_OPTS_JOBS) > 0,$(expr $(KMK_OPTS_JOBS) / 2),$(NUMBER_OF_PROCESSORS))
|
---|
305 | endif
|
---|
306 |
|
---|
307 | #
|
---|
308 | # Tools configurations.
|
---|
309 | #
|
---|
310 | ifeq ($(KBUILD_HOST),win)
|
---|
311 | ifndef TOOL_$(VBOX_VCC_TOOL_STEM)X86
|
---|
312 | include $(KBUILD_PATH)/tools/$(VBOX_VCC_TOOL_STEM)X86.kmk
|
---|
313 | endif
|
---|
314 | ifndef TOOL_$(VBOX_VCC_TOOL_STEM)AMD64
|
---|
315 | include $(KBUILD_PATH)/tools/$(VBOX_VCC_TOOL_STEM)AMD64.kmk
|
---|
316 | endif
|
---|
317 | ifndef SDK_WINSDK10
|
---|
318 | include $(KBUILD_PATH)/sdk/WINSDK10.kmk
|
---|
319 | endif
|
---|
320 | endif
|
---|
321 |
|
---|
322 | ifdef VBOX_WITH_VIRT_ARMV8
|
---|
323 | if1of ($(KBUILD_HOST), darwin linux)
|
---|
324 | ifndef TOOL_VBoxXGccArm64Elf
|
---|
325 | include $(KBUILD_TOOL_PATHS)/VBoxXGccArm64Elf.kmk
|
---|
326 | endif
|
---|
327 | ifndef TOOL_VBoxXGccArmNoneEabi
|
---|
328 | include $(KBUILD_TOOL_PATHS)/VBoxXGccArmNoneEabi.kmk
|
---|
329 | endif
|
---|
330 | endif
|
---|
331 | endif
|
---|
332 |
|
---|
333 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/tools_def.txt \
|
---|
334 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/tools_def.txt \
|
---|
335 | $(if $(VBOX_WITH_VIRT_ARMV8),$(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/tools_def.txt) \
|
---|
336 | $(if $(VBOX_WITH_VIRT_ARMV8),$(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/tools_def.txt): \
|
---|
337 | $(VBOX_PATH_EFI_FIRMWARE)/vbox-tools_def.txt \
|
---|
338 | $(MAKEFILE) | $$(dir $$@)
|
---|
339 | $(RM) -f -- "$@"
|
---|
340 | $(SED) \
|
---|
341 | -e 's,@VBOX_IASLCMD@,$(VBOX_IASLCMD),' \
|
---|
342 | -e 's,@VBOX_YASMCMD@,$(VBOX_YASMCMD),' \
|
---|
343 | -e 's,@VBOX_NASMCMD@,$(VBOX_NASMCMD),' \
|
---|
344 | -e 's,@KMK@,$(MAKE),' \
|
---|
345 | \
|
---|
346 | -e 's,@VBOX_PATH_PREFIX_GCC32@,$(PATH_TOOL_$(VBOX_GCC_TOOL)),' \
|
---|
347 | -e 's,@VBOX_PATH_PREFIX_GCC64@,$(PATH_TOOL_$(VBOX_GCC_TOOL)),' \
|
---|
348 | -e 's,@VBOX_PATH_PREFIX_GCC_AARCH64@,$(PATH_TOOL_VBoxXGccArm64Elf)/$(TOOL_VBoxXGccArm64Elf_PREFIX),' \
|
---|
349 | -e 's,@VBOX_PATH_PREFIX_GCC_ARM@,$(PATH_TOOL_VBoxXGccArmNoneEabi)/$(TOOL_VBoxXGccArmNoneEabi_PREFIX),' \
|
---|
350 | \
|
---|
351 | -e 's,@PATH_VS2010@,$(PATH_TOOL_$(VBOX_VCC_TOOL)),' \
|
---|
352 | -e 's,@PATH_VS2010_AMD64_BIN@,$(PATH_TOOL_$(VBOX_VCC_TOOL))/bin/$(subst x86,x86_amd64,$(KBUILD_HOST_ARCH)),' \
|
---|
353 | \
|
---|
354 | -e 's,@PATH_VS2017_BIN_HOST@,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_BIN),' \
|
---|
355 | -e 's,@PATH_VS2017_AMD64_BIN@,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_BIN),' \
|
---|
356 | -e 's,@PATH_VS2017_X86_BIN@,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_BIN),' \
|
---|
357 | \
|
---|
358 | -e 's,@PATH_SDK_WINSDK10_BIN@,$(PATH_SDK_WINSDK10_BIN),' \
|
---|
359 | \
|
---|
360 | --output $@ $<
|
---|
361 |
|
---|
362 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/build_rule.txt \
|
---|
363 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/build_rule.txt \
|
---|
364 | $(if $(VBOX_WITH_VIRT_ARMV8),$(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/build_rule.txt) \
|
---|
365 | $(if $(VBOX_WITH_VIRT_ARMV8),$(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/build_rule.txt): \
|
---|
366 | $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Conf/build_rule.template \
|
---|
367 | $(MAKEFILE) | $$(dir $$@)
|
---|
368 | $(RM) -f -- "$@"
|
---|
369 | $(CP) -f -- "$<" "$@"
|
---|
370 |
|
---|
371 |
|
---|
372 | #
|
---|
373 | # VBoxEFI32
|
---|
374 | #
|
---|
375 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/target.txt: $(MAKEFILE) | $$(dir $$@) $(VBOX_EFI_BLDPROGS)
|
---|
376 | $(APPEND) -tn "$@" \
|
---|
377 | "# Automatically generated, do not edit" \
|
---|
378 | "" \
|
---|
379 | "# These variables cannot be overriden by the build.py command line." \
|
---|
380 | "TOOL_CHAIN_CONF = $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/tools_def.txt" \
|
---|
381 | "BUILD_RULE_CONF = $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Conf/build_rule.template" \
|
---|
382 | "" \
|
---|
383 | "# These variables are overridden and this is just for show." \
|
---|
384 | "ACTIVE_PLATFORM = OvmfPkg/OvmfPkgIa32.dsc" \
|
---|
385 | "TARGET = $(VBOX_EFI_BUILD_TARGET)" \
|
---|
386 | "TARGET_ARCH = IA32" \
|
---|
387 | "TOOL_CHAIN_TAG = $(VBOX_EFI_TOOL_CHAIN)" \
|
---|
388 | "MAX_CONCURRENT_THREAD_NUMBER = $(VBOX_EFI_MAX_THREADS)"
|
---|
389 |
|
---|
390 | $(VBoxEfiFirmware_0_OUTDIR)/x86/$(VBOX_EFI_OUTPUT_SUBDIR)/FV/OVMF.fd \
|
---|
391 | + $(VBoxEfiFirmwareDbg32_SOURCES): \
|
---|
392 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/target.txt \
|
---|
393 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/tools_def.txt \
|
---|
394 | $(VBoxEfiFirmware_0_OUTDIR)/x86/Conf/build_rule.txt \
|
---|
395 | $$(VBoxEfiResetVector-x86_1_TARGET) \
|
---|
396 | $(VBOX_EFI_DEPENDENCIES) \
|
---|
397 | $(VBOX_PATH_EFI_FIRMWARE)/OvmfPkg/OvmfPkgIa32.dsc \
|
---|
398 | $(VBOX_PATH_EFI_FIRMWARE)/OvmfPkg/OvmfPkgIa32.fdf
|
---|
399 | + $(VBOX_EFI_BUILD_CMD) \
|
---|
400 | --arch IA32 \
|
---|
401 | --platform OvmfPkg/OvmfPkgIa32.dsc
|
---|
402 |
|
---|
403 | #
|
---|
404 | # VBoxEFI64
|
---|
405 | #
|
---|
406 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/target.txt: $(MAKEFILE) | $$(dir $$@) $(VBOX_EFI_BLDPROGS)
|
---|
407 | $(APPEND) -tn "$@" \
|
---|
408 | "# Automatically generated, do not edit" \
|
---|
409 | "" \
|
---|
410 | "# These variables cannot be overriden by the build.py command line." \
|
---|
411 | "TOOL_CHAIN_CONF = $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/tools_def.txt" \
|
---|
412 | "BUILD_RULE_CONF = $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Conf/build_rule.template" \
|
---|
413 | "" \
|
---|
414 | "# These variables are overridden and this is just for show." \
|
---|
415 | "ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc" \
|
---|
416 | "TARGET = $(VBOX_EFI_BUILD_TARGET)" \
|
---|
417 | "TARGET_ARCH = X64" \
|
---|
418 | "TOOL_CHAIN_TAG = $(VBOX_EFI_TOOL_CHAIN)" \
|
---|
419 | "MAX_CONCURRENT_THREAD_NUMBER = $(VBOX_EFI_MAX_THREADS)"
|
---|
420 |
|
---|
421 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/$(VBOX_EFI_OUTPUT_SUBDIR)/FV/OVMF.fd \
|
---|
422 | + $(VBoxEfiFirmwareDbg64_SOURCES): \
|
---|
423 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/target.txt \
|
---|
424 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/tools_def.txt \
|
---|
425 | $(VBoxEfiFirmware_0_OUTDIR)/amd64/Conf/build_rule.txt \
|
---|
426 | $$(VBoxEfiResetVector-amd64_1_TARGET) \
|
---|
427 | $(VBOX_EFI_DEPENDENCIES) \
|
---|
428 | $(VBOX_PATH_EFI_FIRMWARE)/OvmfPkg/OvmfPkgX64.dsc \
|
---|
429 | $(VBOX_PATH_EFI_FIRMWARE)/OvmfPkg/OvmfPkgX64.fdf
|
---|
430 | + $(VBOX_EFI_BUILD_CMD) \
|
---|
431 | --arch X64 \
|
---|
432 | --platform OvmfPkg/OvmfPkgX64.dsc
|
---|
433 |
|
---|
434 | ifdef VBOX_WITH_VIRT_ARMV8
|
---|
435 | #
|
---|
436 | # VBoxEFIAArch32
|
---|
437 | #
|
---|
438 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/target.txt: $(MAKEFILE) | $$(dir $$@) $(VBOX_EFI_BLDPROGS)
|
---|
439 | $(APPEND) -tn "$@" \
|
---|
440 | "# Automatically generated, do not edit" \
|
---|
441 | "" \
|
---|
442 | "# These variables cannot be overriden by the build.py command line." \
|
---|
443 | "TOOL_CHAIN_CONF = $(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/tools_def.txt" \
|
---|
444 | "BUILD_RULE_CONF = $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Conf/build_rule.template" \
|
---|
445 | "" \
|
---|
446 | "# These variables are overridden and this is just for show." \
|
---|
447 | "ACTIVE_PLATFORM = ArmVirtPkg/ArmVirtQemu.dsc" \
|
---|
448 | "TARGET = $(VBOX_EFI_BUILD_TARGET)" \
|
---|
449 | "TARGET_ARCH = ARM" \
|
---|
450 | "TOOL_CHAIN_TAG = $(VBOX_EFI_TOOL_CHAIN)" \
|
---|
451 | "MAX_CONCURRENT_THREAD_NUMBER = $(VBOX_EFI_MAX_THREADS)"
|
---|
452 |
|
---|
453 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/$(VBOX_EFI_OUTPUT_SUBDIR)/FV/QEMU_EFI.fd \
|
---|
454 | + $(VBoxEfiFirmwareDbgAarch32_SOURCES): \
|
---|
455 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/target.txt \
|
---|
456 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/tools_def.txt \
|
---|
457 | $(VBoxEfiFirmware_0_OUTDIR)/aarch32/Conf/build_rule.txt \
|
---|
458 | $(VBOX_EFI_DEPENDENCIES) \
|
---|
459 | $(VBOX_PATH_EFI_FIRMWARE)/ArmVirtPkg/ArmVirtQemu.dsc \
|
---|
460 | $(VBOX_PATH_EFI_FIRMWARE)/ArmVirtPkg/ArmVirtQemu.fdf
|
---|
461 | + $(VBOX_EFI_BUILD_CMD) \
|
---|
462 | --arch ARM \
|
---|
463 | --platform ArmVirtPkg/ArmVirtQemu.dsc
|
---|
464 |
|
---|
465 | #
|
---|
466 | # VBoxEFIAArch64
|
---|
467 | #
|
---|
468 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/target.txt: $(MAKEFILE) | $$(dir $$@) $(VBOX_EFI_BLDPROGS)
|
---|
469 | $(APPEND) -tn "$@" \
|
---|
470 | "# Automatically generated, do not edit" \
|
---|
471 | "" \
|
---|
472 | "# These variables cannot be overriden by the build.py command line." \
|
---|
473 | "TOOL_CHAIN_CONF = $(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/tools_def.txt" \
|
---|
474 | "BUILD_RULE_CONF = $(VBOX_PATH_EFI_FIRMWARE)/BaseTools/Conf/build_rule.template" \
|
---|
475 | "" \
|
---|
476 | "# These variables are overridden and this is just for show." \
|
---|
477 | "ACTIVE_PLATFORM = ArmVirtPkg/ArmVirtQemu.dsc" \
|
---|
478 | "TARGET = $(VBOX_EFI_BUILD_TARGET)" \
|
---|
479 | "TARGET_ARCH = AARCH64" \
|
---|
480 | "TOOL_CHAIN_TAG = $(VBOX_EFI_TOOL_CHAIN)" \
|
---|
481 | "MAX_CONCURRENT_THREAD_NUMBER = $(VBOX_EFI_MAX_THREADS)"
|
---|
482 |
|
---|
483 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/$(VBOX_EFI_OUTPUT_SUBDIR)/FV/QEMU_EFI.fd \
|
---|
484 | + $(VBoxEfiFirmwareDbgAarch64_SOURCES): \
|
---|
485 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/target.txt \
|
---|
486 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/tools_def.txt \
|
---|
487 | $(VBoxEfiFirmware_0_OUTDIR)/aarch64/Conf/build_rule.txt \
|
---|
488 | $(VBOX_EFI_DEPENDENCIES) \
|
---|
489 | $(VBOX_PATH_EFI_FIRMWARE)/ArmVirtPkg/ArmVirtQemu.dsc \
|
---|
490 | $(VBOX_PATH_EFI_FIRMWARE)/ArmVirtPkg/ArmVirtQemu.fdf
|
---|
491 | + $(VBOX_EFI_BUILD_CMD) \
|
---|
492 | --arch AARCH64 \
|
---|
493 | --platform ArmVirtPkg/ArmVirtQemu.dsc
|
---|
494 | endif
|
---|
495 |
|
---|
496 |
|
---|
497 | #
|
---|
498 | # Some aliases.
|
---|
499 | #
|
---|
500 | build-efi-x86: $$(filter %VBoxEFI32.fd,$$(VBoxEfiFirmware_2_STAGE_TARGETS))
|
---|
501 | build-efi-amd64: $$(filter %VBoxEFI64.fd,$$(VBoxEfiFirmware_2_STAGE_TARGETS))
|
---|
502 |
|
---|
503 | ifdef VBOX_WITH_VIRT_ARMV8
|
---|
504 | build-efi-aarch32: $$(filter %VBoxEFIAArch32.fd,$$(VBoxEfiFirmware_2_STAGE_TARGETS))
|
---|
505 | build-efi-aarch64: $$(filter %VBoxEFIAArch64.fd,$$(VBoxEfiFirmware_2_STAGE_TARGETS))
|
---|
506 | endif
|
---|
507 |
|
---|