VirtualBox

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

Last change on this file since 94501 was 94439, checked in by vboxsync, 3 years ago

Support: Disable dlopen() patching for ASAN builds for now as our patcher can't deal with the encountered instructions yet

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