VirtualBox

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

Last change on this file since 91782 was 91781, checked in by vboxsync, 3 years ago

Support/Makefile.kmk: Fixes for bugref:10124

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