VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/Makefile.kmk@ 98414

Last change on this file since 98414 was 98414, checked in by vboxsync, 22 months ago

HostDrivers/*.kmk: Automatic scm cleanups. bugref:10348

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 36.0 KB
Line 
1# $Id: Makefile.kmk 98414 2023-02-01 16:23:38Z vboxsync $
2## @file
3# Sub-Makefile for the support library and the drivers/modules/kexts it uses.
4#
5
6#
7# Copyright (C) 2006-2023 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# The contents of this file may alternatively be used under the terms
26# of the Common Development and Distribution License Version 1.0
27# (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28# in the VirtualBox distribution, in which case the provisions of the
29# CDDL are applicable instead of those of the GPL.
30#
31# You may elect to license modified versions of this file under the
32# terms and conditions of either the GPL or the CDDL or both.
33#
34# SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35#
36
37SUB_DEPTH = ../../../..
38include $(KBUILD_PATH)/subheader.kmk
39
40#
41# Globals.
42#
43VBOX_PATH_SUP_SRC := $(PATH_SUB_CURRENT)
44VBOX_PATH_SUPR3_CERTIFICATES := $(PATH_SUB_CURRENT)/Certificates
45VBOX_PATH_RUNTIME_SRC ?= $(PATH_ROOT)/src/VBox/Runtime
46
47
48#
49# Targets
50#
51LIBRARIES += SUPR3 SUPR3Static
52if defined(VBOX_WITH_HARDENING) \
53 && !defined(VBOX_ONLY_VALIDATIONKIT)
54 LIBRARIES += SUPR3HardenedStatic
55endif
56ifndef VBOX_ONLY_BUILD
57 DLLS.win += VBoxSupLib
58endif
59ifdef VBOX_WITH_32_ON_64_MAIN_API
60 LIBRARIES += SUPR3-x86
61endif
62if !defined(VBOX_ONLY_DOCS)
63 if1of ($(VBOX_LDR_FMT), pe lx)
64 LIBRARIES += SUPR0
65 endif
66endif
67if !defined(VBOX_ONLY_BUILD) && defined(VBOX_WITH_RAW_MODE)
68 LIBRARIES += SUPRC
69endif
70if !defined(VBOX_ONLY_DOCS) \
71 && !defined(VBOX_ONLY_EXTPACKS) \
72 && !defined(VBOX_ONLY_VALIDATIONKIT) \
73 && "$(intersects $(KBUILD_TARGET_ARCH),$(VBOX_SUPPORTED_HOST_ARCHS))" != ""
74 ifdef VBOX_WITH_SUPSVC
75 PROGRAMS += VBoxSupSvc
76 endif
77 ifdef VBOX_WITH_VBOXDRV
78 LIBRARIES += SUPR0IdcClient
79 SYSMODS.os2 += VBoxDrv
80 endif
81 INSTALLS.linux += vboxdrv-src
82 INSTALLS.freebsd += vboxdrv-src
83
84 #
85 # Include sub-makefile(s).
86 #
87 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
88
89 #
90 # Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
91 #
92 ifeq ($(KBUILD_TARGET),linux)
93 include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
94 endif
95 ifeq ($(KBUILD_TARGET),freebsd)
96 include $(PATH_SUB_CURRENT)/freebsd/files_vboxdrv
97 endif
98endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
99
100#
101# Authenticode related trust anchors and certificates -> .cpp
102#
103VBOX_SUP_WIN_CERTS_FILE = $(SUPR3_0_OUTDIR)/TrustAnchorsAndCerts.cpp
104VBOX_SUP_WIN_CERTS := \
105 SpcRootMicrosoft0=SpcRoot-MicrosoftAuthenticodeTmRootAuthority-01.taf \
106 SpcRootMicrosoft1=SpcRoot-MicrosoftRootAuthority-00c1008b3c3c8811d13ef663ecdf40.taf \
107 SpcRootMicrosoft2=SpcRoot-MicrosoftRootCertificateAuthority-79ad16a14aa0a5ad4c7358f407132e65.taf \
108 SpcRootMicrosoft3=SpcRoot-MicrosoftRootCertificateAuthority2010-28cc3a25bfba44ac449a9b586b4339aa.taf \
109 SpcRootMicrosoft4=SpcRoot-MicrosoftRootCertificateAuthority2011-3f8bc8b5fc9fb29643b569d66c42e144.taf \
110 SpcRootMicrosoft5=SpcRoot-MicrosoftDigitalMediaAuthority2005-6eff330eb6e7569740680870104baaba.taf \
111 SpcRootMicrosoft6=SpcRoot-MicrosoftDevelopmentRootCertificateAuthority2014-078f0a9d03df119e434e4fec1bf0235a.taf \
112 SpcRootMicrosoft7=SpcRoot-MicrosoftTestingRootCertificateAuthority2010-8a334aa8052dd244a647306a76b8178fa215f344.taf \
113 NtRootMicrosoft8=NtRoot-MicrosoftCodeVerificationRoot-729404101f3e0ca347837fca175a8438.taf \
114 TimeRootMicrosoft0=Timestamp-CopyrightC1997MicrosoftCorp-01.taf \
115 TimeRootOracle0=Timestamp-VBoxLegacyWinCA.taf \
116 TimeRootOracle1=Timestamp-VBoxLegacyWinSha1CA.taf \
117 TrustedCertVBox0=Trusted-OracleCorporationVirtualBox-05308b76ac2e15b29720fb4395f65f38.taf \
118 AppleRoot0=AppleRoot-2bd06947947609fef46b8d2e40a6f7474d7f085e.taf \
119 AppleRoot1=AppleRoot-G2-c499136c1803c27bc0a3a00d7f72807a1c77268d.taf
120# Hack Alert! Because the DigiCert cross signing certificate we use expired 2020-04-15, we add it as a trusted NT kernel
121# signing root instead, so we can bypass the expiry check in IPRT. NtRootMicrosoft8 is the one found in the
122# 6.1.20 extpack, NtRootMicrosoft9 is the one bird uses at home.
123VBOX_SUP_WIN_CERTS += NtRootDigiCert8=NtRoot-CrossSign-DigiCertAssuredIDRootCA-589567a6c1944d68f11ff3d86576092b.taf
124VBOX_SUP_WIN_CERTS += NtRootDigiCert9=NtRoot-CrossSign-DigiCertHighAssuranceEVRootCA-f4a38dbe86386c554d25f1ce2557a4fe.taf
125
126VBOX_SUP_WIN_CERT_NAMES := $(foreach cert,$(VBOX_SUP_WIN_CERTS),$(firstword $(subst =,$(SPACE) ,$(cert))))
127
128# 1=name, 2=filter, 3=buildcert?.
129if "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING)
130 VBOX_SUP_GEN_CERT_MACRO = 'SUPTAENTRY const g_aSUP$(1)TAs[] =' '{' \
131 $(if-expr "$(3)" == "",,' SUPTAENTRY_GEN(g_abSUPBuildCert),') \
132 $(foreach certnm,$(filter $(2),$(VBOX_SUP_WIN_CERT_NAMES)), ' SUPTAENTRY_GEN(g_abSUP$(certnm)),') \
133 '};' 'unsigned const g_cSUP$(1)TAs = RT_ELEMENTS(g_aSUP$(1)TAs);' '' ''
134else
135 VBOX_SUP_GEN_CERT_MACRO = 'SUPTAENTRY const g_aSUP$(1)TAs[] =' '{' \
136 $(foreach certnm,$(filter $(2),$(VBOX_SUP_WIN_CERT_NAMES)), ' SUPTAENTRY_GEN(g_abSUP$(certnm)),') \
137 '};' 'unsigned const g_cSUP$(1)TAs = RT_ELEMENTS(g_aSUP$(1)TAs);' '' ''
138endif
139
140if ("$(KBUILD_TARGET)" == "win" && defined(VBOX_SIGNING_MODE)) \
141 || ("$(KBUILD_TARGET)" == "darwin" && defined(VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION) && defined(VBOX_SIGNING_MODE))
142 BLDPROGS += bldSUPSignedDummy
143 bldSUPSignedDummy_TEMPLATE = VBoxBldProg
144 bldSUPSignedDummy_SOURCES = bldSUPSignedDummy.cpp
145 bldSUPSignedDummy_ORDERDEPS.win = $(VBOX_SIGN_IMAGE_ORDERDEPS)
146 bldSUPSignedDummy_POST_CMDS.win = $(call VBOX_SIGN_IMAGE_FN,$(out),,2)
147 bldSUPSignedDummy_POST_CMDS.darwin = $(call VBOX_SIGN_MACHO_FN,$(out),org.virtualbox.org.bldtool.$(target))
148endif
149
150$$(VBOX_SUP_WIN_CERTS_FILE): $(MAKEFILE_CURRENT) \
151 $(foreach cert,$(VBOX_SUP_WIN_CERTS),$(VBOX_PATH_SUPR3_CERTIFICATES)/$(lastword $(subst =,$(SPACE) ,$(cert)))) \
152 $(VBOX_BIN2C) \
153 $(if-expr defined(bldSUPSignedDummy_SOURCES),$(VBOX_RTSIGNTOOL) $$(bldSUPSignedDummy_1_TARGET),) \
154 | $$(dir $$@)
155 $(QUIET)$(RM) -f -- $@ [email protected]
156 $(QUIET)$(APPEND) -n "$@" \
157 '' \
158 '#include <VBox/sup.h>' \
159 ''
160 $(foreach cert,$(VBOX_SUP_WIN_CERTS), $(NLTAB)$(VBOX_BIN2C) -ascii --append --static --no-size \
161 "SUP$(firstword $(subst =,$(SP) ,$(cert)))" \
162 "$(VBOX_PATH_SUPR3_CERTIFICATES)/$(lastword $(subst =,$(SP) ,$(cert)))" \
163 "$@")
164# The build certificate.
165ifdef bldSUPSignedDummy_SOURCES
166 $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --exe "$(bldSUPSignedDummy_1_TARGET)" --output "[email protected]" --der
167 $(VBOX_BIN2C) -ascii --append SUPBuildCert "[email protected]" $@
168 $(QUIET)$(RM) -f -- [email protected]
169endif
170# Generate certificate lists.
171 $(QUIET)$(APPEND) -n "$@" '' \
172 $(call VBOX_SUP_GEN_CERT_MACRO,All,%,build) \
173 $(call VBOX_SUP_GEN_CERT_MACRO,SpcRoot,SpcRoot%) \
174 $(call VBOX_SUP_GEN_CERT_MACRO,NtKernelRoot,NtRoot%) \
175 $(call VBOX_SUP_GEN_CERT_MACRO,Timestamp,TimeRoot%) \
176 $(call VBOX_SUP_GEN_CERT_MACRO,AppleRoot,AppleRoot%) \
177 $(call VBOX_SUP_GEN_CERT_MACRO,Trusted,TrustedCert%,build)
178
179OTHER_CLEAN += $(VBOX_SUP_WIN_CERTS_FILE)
180
181tst: $(VBOX_SUP_WIN_CERTS_FILE)
182
183
184#
185# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
186#
187SUPR3_TEMPLATE = VBoxR3Dll
188SUPR3_DEFS = \
189 IN_SUP_R3 IN_RT_R3 \
190 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC) \
191 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
192 $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
193 $(if $(VBOX_WITH_DRIVERLESS_NEM_FALLBACK),VBOX_WITH_DRIVERLESS_NEM_FALLBACK,) \
194 VBOX_PERMIT_MORE \
195 VBOX_PERMIT_EVEN_MORE
196SUPR3_INCS := $(PATH_SUB_CURRENT)
197SUPR3_SOURCES = \
198 SUPLib.cpp \
199 SUPLibLdr.cpp \
200 SUPLibSem.cpp \
201 SUPLibAll.cpp \
202 SUPR3HardenedIPRT.cpp \
203 SUPR3HardenedVerify.cpp \
204 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp \
205 $(VBOX_SUP_WIN_CERTS_FILE)
206SUPR3_SOURCES.amd64 = \
207 SUPLibTracerA.asm
208SUPR3_SOURCES.x86 = \
209 SUPLibTracerA.asm
210ifdef VBOX_WITH_HARDENING
211 SUPR3_SOURCES.win = \
212 win/SUPHardenedVerifyImage-win.cpp
213endif
214
215SUPR3-x86_TEMPLATE = VBoxR3Dll-x86
216SUPR3-x86_EXTENDS = SUPR3
217
218
219#
220# Static version of SUPR3. This is more of a stub than anything else in a
221# hardened build, at least on windows.
222#
223SUPR3Static_TEMPLATE := VBoxR3Static
224SUPR3Static_EXTENDS := SUPR3
225SUPR3Static_DEFS = $(SUPR3_DEFS) IN_SUP_R3_STATIC
226SUPR3Static_SOURCES.win = $(filter-out win/SUPHardenedVerifyImage-win.cpp, $(SUPR3_SOURCES.win))
227
228
229#
230# The static part of the hardened support library (ring-3).
231#
232SUPR3HardenedStatic_TEMPLATE = VBoxR3HardenedLib
233SUPR3HardenedStatic_DEFS = IN_SUP_HARDENED_R3
234SUPR3HardenedStatic_DEFS += \
235 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC,) \
236 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
237 $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
238 $(if $(VBOX_WITH_DRIVERLESS_NEM_FALLBACK),VBOX_WITH_DRIVERLESS_NEM_FALLBACK,) \
239 $(if $(VBOX_WITHOUT_DEBUGGER_CHECKS),VBOX_WITHOUT_DEBUGGER_CHECKS,) \
240 $(if $(VBOX_PERMIT_VISUAL_STUDIO_PROFILING),VBOX_PERMIT_VISUAL_STUDIO_PROFILING,) \
241 VBOX_PERMIT_MORE \
242 VBOX_PERMIT_EVEN_MORE
243ifdef VBOX_WITH_VISTA_NO_SP
244 SUPR3HardenedStatic_DEFS.win += VBOX_WITH_VISTA_NO_SP
245endif
246SUPR3HardenedStatic_INCS = .
247SUPR3HardenedStatic_SOURCES = \
248 SUPR3HardenedMain.cpp \
249 SUPR3HardenedVerify.cpp \
250 SUPR3HardenedNoCrt.cpp \
251 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
252SUPR3HardenedStatic_SOURCES.win = \
253 win/SUPR3HardenedMain-win.cpp \
254 win/SUPR3HardenedMainA-win.asm \
255 win/SUPR3HardenedMainImports-win.cpp \
256 win/SUPHardenedVerifyProcess-win.cpp \
257 win/SUPHardenedVerifyImage-win.cpp \
258 $(VBOX_SUP_WIN_CERTS_FILE)
259SUPR3HardenedStatic_SOURCES.x86 += \
260 $(VBOX_PATH_RUNTIME_SRC)/common/asm/ASMMemFirstMismatchingU8.asm
261SUPR3HardenedStatic_SOURCES.amd64 += \
262 $(VBOX_PATH_RUNTIME_SRC)/common/asm/ASMMemFirstMismatchingU8.asm
263
264
265if "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING) && !defined(VBOX_ONLY_VALIDATIONKIT) ## @todo some of this move up.
266 SUPR3HardenedStatic_DEFS += \
267 IN_RT_R3 \
268 IN_RT_STATIC \
269 IN_DIS \
270 IN_DIS_STATIC \
271 DIS_CORE_ONLY \
272 IPRT_NO_CRT \
273 RT_WITH_NOCRT_ALIASES \
274 LOG_DISABLED \
275 IPRT_NO_ERROR_DATA \
276 IPRT_WITHOUT_DIGEST_MD4
277 SUPR3HardenedStatic_DEFS.win += LDR_ONLY_PE __STRALIGN_H_
278
279 SUPR3HardenedStatic_INCS += $(PATH_ROOT)/include/iprt/nocrt $(VBOX_PATH_RUNTIME_SRC)/include
280
281 SUPR3HardenedStatic_SOURCES += \
282 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldr.cpp \
283 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldrEx.cpp \
284 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldrPE.cpp \
285 $(VBOX_PATH_RUNTIME_SRC)/common/alloc/heapsimple.cpp \
286 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-basics.cpp \
287 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-cursor.cpp \
288 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-default-allocator.cpp \
289 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-safer-allocator.cpp \
290 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-dump.cpp \
291 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-encode.cpp \
292 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-bitstring.cpp \
293 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-bitstring-decode.cpp \
294 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-boolean.cpp \
295 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-boolean-decode.cpp \
296 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-core.cpp \
297 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-core-decode.cpp \
298 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-dyntype.cpp \
299 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-dyntype-decode.cpp \
300 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-integer.cpp \
301 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-integer-decode.cpp \
302 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-null.cpp \
303 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-null-decode.cpp \
304 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-objid.cpp \
305 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-objid-decode.cpp \
306 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-octetstring.cpp \
307 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-octetstring-decode.cpp \
308 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-string.cpp \
309 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-string-decode.cpp \
310 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-time.cpp \
311 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-time-decode.cpp \
312 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/digest-core.cpp \
313 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/digest-builtin.cpp \
314 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/key.cpp \
315 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-asn1-decoder.cpp \
316 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-core.cpp \
317 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-init.cpp \
318 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-sanity.cpp \
319 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-verify.cpp \
320 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-builtin.cpp \
321 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-core.cpp \
322 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-rsa.cpp \
323 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-verify.cpp \
324 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-util.cpp \
325 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-asn1-decoder.cpp \
326 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-core.cpp \
327 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-init.cpp \
328 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-sanity.cpp \
329 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-asn1-decoder.cpp \
330 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-core.cpp \
331 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-init.cpp \
332 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-sanity.cpp \
333 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-asn1-decoder.cpp \
334 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-certpaths.cpp \
335 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-core.cpp \
336 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-init.cpp \
337 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-sanity.cpp \
338 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-verify.cpp \
339 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/store.cpp \
340 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/store-inmem.cpp \
341 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-asn1-decoder.cpp \
342 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-core.cpp \
343 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-init.cpp \
344 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-sanity.cpp \
345 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-asn1-decoder.cpp \
346 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-core.cpp \
347 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-init.cpp \
348 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-sanity.cpp \
349 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-md2.cpp \
350 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-md5.cpp \
351 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha1.cpp \
352 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha256.cpp \
353 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha512.cpp \
354 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha3.cpp \
355 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/md2str.cpp \
356 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/md5str.cpp \
357 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha1str.cpp \
358 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha256str.cpp \
359 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha512str.cpp \
360 $(VBOX_PATH_RUNTIME_SRC)/common/err/errinfo.cpp \
361 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathChangeToUnixSlashes.cpp \
362 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathExt.cpp \
363 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16PrintHexBytes.cpp \
364 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16ICmpAscii.cpp \
365 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16NICmpAscii.cpp \
366 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16CatAscii.cpp \
367 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16CopyAscii.cpp \
368 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16End.cpp \
369 $(VBOX_PATH_RUNTIME_SRC)/common/string/strstrip.cpp \
370 \
371 $(VBOX_PATH_RUNTIME_SRC)/common/err/errmsg.cpp \
372 $(VBOX_PATH_RUNTIME_SRC)/common/math/bignum.cpp \
373 $(VBOX_PATH_RUNTIME_SRC)/common/math/bignum-amd64-x86.asm \
374 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
375 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2.cpp \
376 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
377 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
378 $(VBOX_PATH_RUNTIME_SRC)/common/misc/zero.asm \
379 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathAbsEx.cpp \
380 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathFilename.cpp \
381 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathParse.cpp \
382 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathParsedReassemble.cpp \
383 $(VBOX_PATH_RUNTIME_SRC)/common/string/memchr.asm \
384 $(VBOX_PATH_RUNTIME_SRC)/common/string/memcmp.asm \
385 $(VBOX_PATH_RUNTIME_SRC)/common/string/memcpy.asm \
386 $(VBOX_PATH_RUNTIME_SRC)/common/string/memmove.asm \
387 $(VBOX_PATH_RUNTIME_SRC)/common/string/mempcpy.asm \
388 $(VBOX_PATH_RUNTIME_SRC)/common/string/memset.asm \
389 $(VBOX_PATH_RUNTIME_SRC)/common/string/strversion.cpp \
390 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrPrintHexBytes.cpp \
391 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCat.cpp \
392 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCmp.cpp \
393 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCopy.cpp \
394 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrEnd.asm \
395 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrICmpAscii.cpp \
396 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrNCmp.cpp \
397 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrNLen.cpp \
398 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16Copy.cpp \
399 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16NLenEx.cpp \
400 $(VBOX_PATH_RUNTIME_SRC)/common/string/strchr.asm \
401 $(VBOX_PATH_RUNTIME_SRC)/common/string/strcmp.asm \
402 $(VBOX_PATH_RUNTIME_SRC)/common/string/strcpy.asm \
403 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformat.cpp \
404 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrFormat.cpp \
405 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformatrt.cpp \
406 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformattype.cpp \
407 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformatnum.cpp \
408 $(VBOX_PATH_RUNTIME_SRC)/common/string/stringalloc.cpp \
409 $(VBOX_PATH_RUNTIME_SRC)/common/string/strlen.asm \
410 $(VBOX_PATH_RUNTIME_SRC)/common/string/strncmp.asm \
411 $(VBOX_PATH_RUNTIME_SRC)/common/string/strncpy.asm \
412 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf.cpp \
413 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf-ellipsis.cpp \
414 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf2.cpp \
415 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf2-ellipsis.cpp \
416 $(VBOX_PATH_RUNTIME_SRC)/common/string/strtonum.cpp \
417 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-16.cpp \
418 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-8.cpp \
419 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-8-case.cpp \
420 $(VBOX_PATH_RUNTIME_SRC)/common/string/unidata-upper.cpp \
421 $(VBOX_PATH_RUNTIME_SRC)/common/string/unidata-lower.cpp \
422 $(VBOX_PATH_RUNTIME_SRC)/common/time/time.cpp \
423 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp \
424 $(VBOX_PATH_RUNTIME_SRC)/generic/RTPathGetCurrentDrive-generic.cpp \
425 $(VBOX_PATH_RUNTIME_SRC)/generic/RTPathGetCurrentOnDrive-generic.cpp \
426 $(VBOX_PATH_RUNTIME_SRC)/generic/rtStrFormatKernelAddress-generic.cpp \
427 $(VBOX_PATH_RUNTIME_SRC)/generic/memsafer-generic.cpp \
428 $(VBOX_PATH_RUNTIME_SRC)/generic/uuid-generic.cpp \
429 \
430 ../../Disassembler/DisasmCore.cpp \
431 ../../Disassembler/DisasmTables.cpp \
432 ../../Disassembler/DisasmTablesX64.cpp \
433 ../../Disassembler/DisasmMisc.cpp
434
435 SUPR3HardenedStatic_SOURCES.amd64 += \
436 $(VBOX_PATH_RUNTIME_SRC)/common/math/RTUInt128MulByU64.asm \
437 $(VBOX_PATH_RUNTIME_SRC)/win/amd64/ASMGetCS.asm \
438 $(VBOX_PATH_RUNTIME_SRC)/win/amd64/ASMGetSS.asm
439
440 SUPR3HardenedStatic_SOURCES.win += \
441 win/SUPR3HardenedNoCrt-win.cpp \
442 $(VBOX_PATH_RUNTIME_SRC)/nt/RTErrConvertFromNtStatus.cpp \
443 $(VBOX_PATH_RUNTIME_SRC)/nt/RTNtPathFindPossible8dot3Name.cpp \
444 $(VBOX_PATH_RUNTIME_SRC)/nt/RTNtPathExpand8dot3Path.cpp \
445 $(VBOX_PATH_RUNTIME_SRC)/nt/RTNtPathExpand8dot3PathA.cpp \
446 $(VBOX_PATH_RUNTIME_SRC)/r3/nt/pathint-nt.cpp \
447 $(VBOX_PATH_RUNTIME_SRC)/win/RTErrConvertFromWin32.cpp \
448 $(VBOX_PATH_RUNTIME_SRC)/win/errmsgwin.cpp
449
450 # Add necessary compiler specific files from the compiler lib dir.
451 ifeq ($(KBUILD_TARGET),win)
452 include $(KBUILD_PATH)/tools/$(VBOX_VCC_TOOL).kmk
453 SUPR3HardenedStatic_SOURCES.win += \
454 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/chkstk.obj
455
456 # And a few extracted from the static libc to support -guard and cookes.
457 # In 14.2 these files does not import anything from the win32 API and are
458 # mostly tiny bits of code. Needs not initialization that I can spot.
459 ifneq ($(VBOX_VCC_LD_GUARD_CF),)
460 SUPR3HardenedStatic_SOURCES.win += \
461 $(SUPR3HardenedStatic_0_OUTDIR)/loadcfg.obj
462 # These are for the /guard option.
463 SUPR3HardenedStatic_SOURCES.win += \
464 $(SUPR3HardenedStatic_0_OUTDIR)/gs_cookie.obj \
465 $(SUPR3HardenedStatic_0_OUTDIR)/guard_support.obj
466 SUPR3HardenedStatic_SOURCES.win.amd64 += \
467 $(SUPR3HardenedStatic_0_OUTDIR)/guard_dispatch.obj \
468 $(SUPR3HardenedStatic_0_OUTDIR)/guard_xfg_dispatch.obj
469 # These next ones are for supporting the /GS option. We skip gs_report.obj as it
470 # import lots from kernel32 and we're better of reporting the problem ourselves.
471 SUPR3HardenedStatic_SOURCES.win.amd64 += \
472 $(SUPR3HardenedStatic_0_OUTDIR)/amdsecgs.obj \
473 $(SUPR3HardenedStatic_0_OUTDIR)/gshandler.obj
474 SUPR3HardenedStatic_SOURCES.win.x86 += \
475 $(SUPR3HardenedStatic_0_OUTDIR)/secchk.obj \
476 $(SUPR3HardenedStatic_0_OUTDIR)/alloca16.obj
477
478 $$(SUPR3HardenedStatic_0_OUTDIR)/loadcfg.obj \
479 $$(SUPR3HardenedStatic_0_OUTDIR)/gs_cookie.obj \
480 $$(SUPR3HardenedStatic_0_OUTDIR)/guard_support.obj \
481 $$(SUPR3HardenedStatic_0_OUTDIR)/guard_dispatch.obj \
482 $$(SUPR3HardenedStatic_0_OUTDIR)/guard_xfg_dispatch.obj \
483 $$(SUPR3HardenedStatic_0_OUTDIR)/amdsecgs.obj \
484 $$(SUPR3HardenedStatic_0_OUTDIR)/gs_report.obj \
485 $$(SUPR3HardenedStatic_0_OUTDIR)/gshandler.obj \
486 $$(SUPR3HardenedStatic_0_OUTDIR)/secchk.obj \
487 $$(SUPR3HardenedStatic_0_OUTDIR)/alloca16.obj: \
488 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/libcmt.lib | $$(dir $$@)
489 set -x; $(TOOL_$(VBOX_VCC_TOOL)_AR) "/EXTRACT:$$($(TOOL_$(VBOX_VCC_TOOL)_AR) /LIST "$<" | $(SED_EXT) -e '/$(notdir $@)/!d' )" "/OUT:$@" "$<"
490 endif
491 endif
492endif
493
494# macOS specifics.
495ifeq ($(KBUILD_TARGET),darwin)
496 SUPR3HardenedStatic_DEFS += \
497 LOG_DISABLED
498
499 SUPR3HardenedStatic_INCS += $(VBOX_PATH_RUNTIME_SRC)/include
500
501 SUPR3HardenedStatic_SOURCES += \
502 darwin/SUPR3HardenedMain-darwin.cpp \
503 \
504 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
505 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2.cpp \
506 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
507 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
508 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp
509endif
510
511# Things specific to the rest of the posix crowd.
512if1of ($(KBUILD_TARGET), linux solaris)
513 SUPR3HardenedStatic_DEFS += \
514 IN_DIS \
515 IN_DIS_STATIC \
516 DIS_CORE_ONLY \
517 LOG_DISABLED
518 SUPR3HardenedStatic_DEFS.linux += \
519 SUP_HARDENED_WITH_DLMOPEN
520 SUPR3HardenedStatic_DEFS.solaris += \
521 SUP_HARDENED_WITH_DLMOPEN
522 SUPR3HardenedStatic_DEFS.asan += SUP_HARDENED_WITHOUT_DLOPEN_PATCHING
523
524 SUPR3HardenedStatic_INCS += $(VBOX_PATH_RUNTIME_SRC)/include
525
526 SUPR3HardenedStatic_SOURCES += \
527 posix/SUPR3HardenedMain-posix.cpp \
528 posix/SUPR3HardenedMainA-posix.asm \
529 \
530 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
531 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2.cpp \
532 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
533 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
534 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp \
535 \
536 ../../Disassembler/DisasmCore.cpp \
537 ../../Disassembler/DisasmTables.cpp \
538 ../../Disassembler/DisasmTablesX64.cpp \
539 ../../Disassembler/DisasmMisc.cpp
540endif
541
542SUPR3HardenedMain.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
543
544
545#
546# VBoxSupLib - Windows DLL for catching thread creation and termination.
547#
548VBoxSupLib_TEMPLATE = VBoxR3StaticNoCrt
549VBoxSupLib_SDKS.win = VBoxNtDll
550VBoxSupLib_LDFLAGS.win.amd64 = -Entry:DllMainEntrypoint
551VBoxSupLib_LDFLAGS.win.x86 = -Entry:DllMainEntrypoint
552VBoxSupLib_DEFS = \
553 $(if $(VBOX_WITHOUT_DEBUGGER_CHECKS),VBOX_WITHOUT_DEBUGGER_CHECKS,)
554VBoxSupLib_SOURCES = \
555 $(KBUILD_TARGET)/VBoxSupLib-$(KBUILD_TARGET).cpp
556VBoxSupLib_SOURCES.win.amd64 = \
557 $(VBOX_PATH_RUNTIME_SRC)/common/compiler/vcc/stack-probe-vcc.asm
558VBoxSupLib_SOURCES.win.x86 = \
559 $(VBOX_PATH_RUNTIME_SRC)/common/compiler/vcc/stack-probe-vcc.asm
560VBoxSupLib_SOURCES.win = \
561 win/VBoxSupLib.rc
562ifndef VBOX_WITH_NOCRT_STATIC
563 ifdef VBOX_WITH_HARDENING # for /guard:cf stuff
564 VBoxSupLib_LIBS.win.x86 = \
565 $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticNoCrt_TOOL.win.x86)_LIB)/libcmt.lib
566 VBoxSupLib_LIBS.win.amd64 = \
567 $(PATH_TOOL_$(TEMPLATE_VBoxR3StaticNoCrt_TOOL.win.amd64)_LIB)/libcmt.lib
568 endif
569endif
570VBoxSupLib_VBOX_IMPORT_CHECKER.win.x86 = xp
571VBoxSupLib_VBOX_IMPORT_CHECKER.win.amd64 = xp64
572
573
574#
575# VBoxSupSvc - The system wide service/daemon.
576#
577VBoxSupSvc_TEMPLATE = VBoxR3Exe
578VBoxSupSvc_SOURCES = \
579 SUPSvc.cpp \
580 SUPSvcGlobal.cpp \
581 $(KBUILD_TARGET)/SUPSvc-$(KBUILD_TARGET).cpp
582if1of ($(KBUILD_TARGET), win)
583 VBoxSupSvc_SOURCES += \
584 SUPSvcGrant.cpp
585endif
586ifn1of ($(KBUILD_TARGET), win)
587 VBoxSupSvc_SOURCES += \
588 SUPSvcMain-posix.cpp
589endif
590VBoxSupSvc_LIBS = \
591 $(LIB_RUNTIME)
592
593
594#
595# SUPR0 - The Ring-0 Import library.
596#
597SUPR0_TEMPLATE = VBoxR0
598if1of ($(VBOX_LDR_FMT), pe lx)
599 SUPR0_SOURCES = $(SUPR0_0_OUTDIR)/SUPR0.def
600 SUPR0_CLEAN = $(SUPR0_0_OUTDIR)/SUPR0.def
601 $$(SUPR0_0_OUTDIR)/SUPR0.def: \
602 $(PATH_SUB_CURRENT)/SUPDrv.cpp \
603 $(PATH_SUB_CURRENT)/SUPR0-def-$(VBOX_LDR_FMT).sed \
604 | $$(dir $$@)
605 $(SED) \
606 -f $(dir $<)/SUPR0-def-$(VBOX_LDR_FMT).sed \
607 --output $@ \
608 $<
609 # Experiment: Let's see how blunt the ones messing our NULL_THUNK_DATA entries on W10 are.
610 ifeq ($(KBUILD_TARGET),win)
611 ifdef KLIBTWEAKER_EXT
612 SUPR0_POST_CMDS = $(KLIBTWEAKER_EXT) --clear-timestamps --fill-null_thunk_data $(out)
613 endif
614 endif
615endif
616
617
618#
619# SUPRC - The raw-mode context library.
620#
621SUPRC_TEMPLATE := VBoxRc
622SUPRC_DEFS := IN_SUP_RC IN_RT_RC IN_VMM_RC
623SUPRC_SOURCES := SUPLibAll.cpp
624
625
626#
627# SUPR0IdcClient - The Ring-0 IDC client driver library.
628#
629SUPR0IdcClient_TEMPLATE = VBoxR0DrvLib
630SUPR0IdcClient_DEFS = IN_RT_R0 IN_SUP_R0 IN_SUP_STATIC
631SUPR0IdcClient_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
632SUPR0IdcClient_SOURCES.$(KBUILD_TARGET) = \
633 $(KBUILD_TARGET)/SUPR0IdcClient-$(KBUILD_TARGET).c
634SUPR0IdcClient_SOURCES = \
635 SUPR0IdcClient.c \
636 SUPR0IdcClientComponent.c \
637 SUPR0IdcClientStubs.c
638
639
640
641if !defined(VBOX_ONLY_DOCS) \
642 && !defined(VBOX_ONLY_EXTPACKS) \
643 && !defined(VBOX_ONLY_VALIDATIONKIT)
644
645 ifeq ($(KBUILD_TARGET),os2)
646
647 #
648 # VBoxDrv.sys - The OS/2 driver.
649 #
650 VBoxDrv_TEMPLATE = VBoxR0Drv
651 VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
652 VBoxDrv_INCS := $(PATH_SUB_CURRENT)
653 #VBoxDrv_LDFLAGS = -s -t -v
654 VBoxDrv_SOURCES = \
655 os2/SUPDrvA-os2.asm \
656 os2/SUPDrv-os2.def
657 VBoxDrv_LIBS = \
658 $(VBoxDrvLib_1_TARGET) \
659 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
660 $(VBOX_GCC_LIBGCC) \
661 end
662
663 # temp hack to ensure that SUPDrvA-os2.asm is first in the link.
664 LIBRARIES += VBoxDrvLib
665 VBoxDrvLib_TEMPLATE = VBoxR0Drv
666 VBoxDrvLib_INSTTYPE = none
667 VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0
668 VBoxDrvLib_INCS := \
669 . \
670 $(PATH_ROOT)/src/VBox/Runtime/include
671 VBoxDrvLib_SOURCES = \
672 os2/SUPDrv-os2.cpp \
673 SUPDrv.cpp \
674 SUPDrvGip.cpp \
675 SUPDrvSem.cpp \
676 SUPLibAll.cpp
677
678 endif # os2
679
680
681 #
682 # New VBoxDrv target. TODO: Convert all the above to use this!
683 #
684 if1of ($(KBUILD_TARGET), darwin freebsd solaris win)
685 ifdef VBOX_WITH_VBOXDRV
686 SYSMODS += VBoxDrv
687 endif
688 VBoxDrv_TEMPLATE = VBoxR0Drv
689 VBoxDrv_NAME.freebsd = vboxdrv
690 VBoxDrv_NAME.solaris = vboxdrv
691 VBoxDrv_NAME.win = VBoxSup
692 ifdef VBOX_SIGNING_MODE
693 VBoxDrv_INSTTYPE.win = none
694 VBoxDrv_DEBUG_INSTTYPE.win = both
695 endif
696 VBoxDrv_INST.darwin = $(INST_VBOXDRV)Contents/MacOS/
697 VBoxDrv_DEBUG_INST.darwin = $(patsubst %/,%,$(INST_VBOXDRV))
698 VBoxDrv_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
699
700 VBoxDrv_DEFS := IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
701 ifdef VBOX_WITH_DTRACE_R0DRV
702 VBoxDrv_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R0DRV
703 endif
704 ifdef VBOX_WITHOUT_DEBUGGER_CHECKS
705 VBoxDrv_DEFS += VBOX_WITHOUT_DEBUGGER_CHECKS
706 endif
707 ifdef VBOX_PERMIT_VISUAL_STUDIO_PROFILING
708 VBoxDrv_DEFS += VBOX_PERMIT_VISUAL_STUDIO_PROFILING
709 endif
710 VBoxDrv_DEFS += VBOX_PERMIT_MORE VBOX_PERMIT_EVEN_MORE
711 #VBoxDrv_DEFS.debug += DEBUG_DARWIN_GIP
712 VBoxDrv_DEFS.darwin := VBOX_WITH_HOST_VMX
713 ifdef VBOX_WITH_RAW_MODE
714 VBoxDrv_DEFS.darwin += VBOX_WITH_RAW_MODE
715 endif
716 if defined(VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION) && defined(VBOX_SIGNING_MODE)
717 VBoxDrv_DEFS.darwin += VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION
718 ifeq ($(VBOX_SIGNING_MODE),test)
719 VBoxDrv_DEFS.darwin += VBOX_WITH_DARWIN_R0_TEST_SIGN
720 endif
721 endif
722 ifdef VBOX_WITH_NETFLT
723 VBoxDrv_DEFS.solaris += VBOX_WITH_NETFLT
724 endif
725 ifdef VBOX_WITH_NATIVE_SOLARIS_LOADING
726 VBoxDrv_DEFS.solaris += VBOX_WITH_NATIVE_SOLARIS_LOADING
727 endif
728 ifdef VBOX_WITHOUT_NATIVE_R0_LOADER
729 VBoxDrv_DEFS.win += VBOX_WITHOUT_NATIVE_R0_LOADER
730 endif
731 ifdef VBOX_WITH_VISTA_NO_SP
732 VBoxDrv_DEFS.win += VBOX_WITH_VISTA_NO_SP
733 endif
734 ifdef VBOX_WITH_HARDENING
735 VBoxDrv_ASDEFS += VBOX_WITH_HARDENING
736 endif
737 ifdef VBOX_WITH_RAM_IN_KERNEL
738 VBoxDrv_DEFS += VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV IPRT_WITHOUT_EFLAGS_AC_PRESERVING
739 else if ($(VBOX_VERSION_BUILD) % 2) == 1
740 VBoxDrv_DEFS += VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV IPRT_WITH_EFLAGS_AC_PRESERVING
741 endif
742
743 VBoxDrv_INCS = . $(VBoxDrv_0_OUTDIR)
744 VBoxDrv_INCS.darwin = ./darwin
745
746 VBoxDrv_LIBS = $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
747 VBoxDrv_LIBS.win = \
748 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
749 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
750 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib
751 ifn1of ($(VBOX_WINDDK), WINDDK80 WINDDK71)
752 VBoxDrv_LIBS.win.x86 = \
753 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/BufferOverflowK.lib
754 endif
755
756 #VBoxDrv_LDFLAGS.darwin = -Wl,-sectcreate,__TEXT,__info_plist,$(VBoxDrv.kext_0_OUTDIR)/Info.plist
757 #VBoxDrv_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
758 VBoxDrv_LDFLAGS.solaris += -N misc/ctf
759 ifdef VBOX_WITH_NATIVE_DTRACE
760 VBoxDrv_LDFLAGS.solaris += -N drv/dtrace
761 endif
762 VBoxDrv_LDFLAGS.win.x86 = -Entry:DriverEntry@8
763 VBoxDrv_LDFLAGS.win.amd64 = -Entry:DriverEntry
764
765 VBoxDrv_SOURCES.darwin = \
766 darwin/SUPDrv-darwin.cpp
767 ifdef VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION
768 VBoxDrv_SOURCES.darwin += \
769 $(VBOX_SUP_WIN_CERTS_FILE)
770 endif
771 VBoxDrv_SOURCES.solaris = \
772 solaris/SUPDrv-solaris.c
773 VBoxDrv_SOURCES.win = \
774 win/SUPDrv-win.cpp \
775 win/SUPDrvA-win.asm \
776 win/VBoxDrv.rc
777 ifdef VBOX_WITH_HARDENING
778 VBoxDrv_SOURCES.win += \
779 win/SUPHardenedVerifyImage-win.cpp \
780 win/SUPHardenedVerifyProcess-win.cpp \
781 $(VBOX_SUP_WIN_CERTS_FILE)
782 endif
783 VBoxDrv_SOURCES = \
784 SUPDrv.d \
785 SUPDrv.cpp \
786 SUPDrvGip.cpp \
787 SUPDrvSem.cpp \
788 SUPDrvTracer.cpp \
789 SUPLibAll.cpp
790 ifdef VBOX_WITH_NATIVE_DTRACE
791 VBoxDrv_SOURCES += \
792 SUPDrv-dtrace.cpp
793 SUPDrv-dtrace.cpp_DEFS.darwin += VBOX_PATH_MACOSX_DTRACE_H=\"$(VBOX_PATH_MACOSX_SDK)/usr/include/sys/dtrace.h\"
794 endif
795 ifn1of ($(KBUILD_TARGET), linux freebsd)
796 VBoxDrv_SOURCES += \
797 SUPDrvTracerA.asm
798 endif
799
800 linux/SUPDrv-linux.c_DEPS = $(VBOX_SVN_REV_HEADER)
801
802 endif
803
804
805
806 if defined(VBOX_WITH_VBOXDRV) && "$(KBUILD_TARGET)" == "darwin"
807 # Files necessary to make a darwin kernel extension bundle.
808 INSTALLS.darwin += VBoxDrv.kext
809 VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
810 VBoxDrv.kext_SOURCES = $(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist
811 VBoxDrv.kext_CLEAN = $(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist
812 VBoxDrv.kext_BLDDIRS = $(VBoxDrv.kext_0_OUTDIR)/Contents/
813
814 $$(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist: \
815 $(PATH_SUB_CURRENT)/darwin/Info.plist \
816 $(VBOX_VERSION_MK) | $$(dir $$@)
817 $(call MSG_GENERATE,VBoxDrv,$@,$<)
818 $(QUIET)$(RM) -f $@
819 $(QUIET)$(SED) \
820 -e 's+@VBOX_VERSION_STRING@+$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_STRING),4.2.51)+g' \
821 -e 's+@VBOX_VERSION_MAJOR@+$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_MAJOR),4)+g' \
822 -e 's+@VBOX_VERSION_MINOR@+$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_MINOR),2)+g' \
823 -e 's+@VBOX_VERSION_BUILD@+$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_BUILD),51)+g' \
824 -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
825 -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
826 -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
827 --output $@ \
828 $<
829
830 $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxDrv)
831 endif
832
833
834 if1of ($(KBUILD_TARGET), darwin solaris)
835 ifdef VBOX_WITH_VBOXDRV
836 # Common manual loader script.
837 INSTALLS += SUPDrvScripts
838 SUPDrvScripts_INST = $(INST_DIST)
839 SUPDrvScripts_EXEC_SOURCES = \
840 $(KBUILD_TARGET)/load.sh
841 endif
842 endif
843
844
845 if1of ($(KBUILD_TARGET), linux freebsd)
846 if1of ($(KBUILD_TARGET_ARCH), $(VBOX_SUPPORTED_HOST_ARCHS))
847 #
848 # Targets for installing the linux sources.
849 #
850 vboxdrv-src_INST = bin/src/vboxdrv/
851 vboxdrv-src_SOURCES = \
852 $(subst $(DQUOTE),,$(FILES_VBOXDRV_NOBIN)) \
853 $(vboxdrv-src_0_OUTDIR)/Makefile
854 vboxdrv-src_EXEC_SOURCES = \
855 $(subst $(DQUOTE),,$(FILES_VBOXDRV_BIN))
856 vboxdrv-src_CLEAN = \
857 $(vboxdrv-src_0_OUTDIR)/Makefile \
858 $(PATH_TARGET)/vboxdrv-src-1.dep
859
860 # Scripts needed for building the kernel modules
861 includedep $(PATH_TARGET)/vboxdrv-src-1.dep
862 $$(vboxdrv-src_0_OUTDIR)/Makefile: \
863 $(PATH_SUB_CURRENT)/$(KBUILD_TARGET)/Makefile \
864 $$(if $$(eq $$(Support/$(KBUILD_TARGET)/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
865 $$(if $$(eq $$(Support/$(KBUILD_TARGET)/Makefile_VBOX_RAM_IN_KERNEL),$$(VBOX_WITH_RAM_IN_KERNEL)),,FORCE) \
866 | $$(dir $$@)
867 $(call MSG_TOOL,Creating,,$@)
868 $(QUIET)$(SED) -e "" \
869 $(if-expr !defined(VBOX_WITH_HARDENING),-e "s;VBOX_WITH_HARDENING;;g",) \
870 --output $@ $<
871 %$(QUIET2)$(APPEND) -t -n '$(PATH_TARGET)/vboxdrv-src-1.dep' \
872 'Support/$(KBUILD_TARGET)/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)' \
873 'Support/$(KBUILD_TARGET)/Makefile_VBOX_RAM_IN_KERNEL=$(VBOX_WITH_RAM_IN_KERNEL)'
874
875 #
876 # Build test for the linux host kernel modules.
877 #
878 $(evalcall2 VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN,vboxdrv-src,,save_symvers)
879
880 ifdef VBOX_WITH_KMOD_WRAPPED_R0_MODS
881 #
882 # Common wrapper module files.
883 #
884 INSTALLS.linux += vboxwrappermod-common-src
885 vboxwrappermod-common-src_INST = bin/src/common/
886 vboxwrappermod-common-src_SOURCES = \
887 linux/SUPWrapperMod-linux.c=>SUPWrapperMod-linux.c \
888 linux/Makefile-wrapper.gmk=>Makefile-wrapper.gmk \
889 $(PATH_ROOT)/src/VBox/Installer/linux/Makefile-header.gmk=>Makefile-header.gmk \
890 $(PATH_ROOT)/src/VBox/Installer/linux/Makefile-footer.gmk=>Makefile-footer.gmk
891 endif
892
893 endif # supported host arch
894 endif # linux freebsd
895
896
897 ifeq ($(KBUILD_TARGET),win)
898 INSTALLS.win += VBoxSup-inf
899 VBoxSup-inf_TEMPLATE = VBoxR0DrvInfCat
900 VBoxSup-inf_SOURCES = \
901 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.inf
902 VBoxSup-inf_CLEAN = $(VBoxSup-inf_SOURCES)
903 VBoxSup-inf_BLDDIRS = $(PATH_TARGET)/VBoxSupCat.dir
904
905 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.inf: $(PATH_SUB_CURRENT)/win/VBoxSup.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
906 $(call MSG_GENERATE,VBoxSup-inf,$@,$<)
907 $(call VBOX_EDIT_INF_FN,$<,$@)
908
909 ifdef VBOX_SIGNING_MODE
910 VBoxSup-inf_SOURCES += \
911 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.sys \
912 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat \
913 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat=>VBoxSup-PreW10.cat
914
915 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.sys: $$(VBoxDrv_1_TARGET) | $$(dir $$@)
916 $(INSTALL) -m 644 -- "$<" "$(@D)"
917
918 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat: \
919 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.inf \
920 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.sys
921 $(call MSG_TOOL,Inf2Cat,VBoxSup-inf,$@,$<)
922 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
923 endif # signing
924 endif # win
925
926 #
927 # Linux only.
928 #
929 PROGRAMS.linux += LnxPerfHack
930 LnxPerfHack_TEMPLATE = VBoxR3Tool
931 LnxPerfHack_SOURCES = linux/LnxPerfHack.cpp
932
933
934
935endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
936include $(FILE_KBUILD_SUB_FOOTER)
937
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette