VirtualBox

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

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

VBoxSupLib: Use SUPR3HardenedStatic for getting /guard stuff objects in hardened builds. Fixed uplicate object in SUPR3HardenedStatic. bugref:8489 bugref:10162

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 35.0 KB
Line 
1# $Id: Makefile.kmk 93323 2022-01-18 15:33:31Z 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
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)
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 -- $@ [email protected]
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 "[email protected]" --der
146 $(VBOX_BIN2C) -ascii --append SUPBuildCert "[email protected]" $@
147 $(QUIET)$(RM) -f -- [email protected]
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 $(if $(VBOX_WITH_DRIVERLESS_NEM_FALLBACK),VBOX_WITH_DRIVERLESS_NEM_FALLBACK,) \
173 VBOX_PERMIT_MORE \
174 VBOX_PERMIT_EVEN_MORE
175SUPR3_INCS := $(PATH_SUB_CURRENT)
176SUPR3_SOURCES = \
177 SUPLib.cpp \
178 SUPLibLdr.cpp \
179 SUPLibSem.cpp \
180 SUPLibAll.cpp \
181 SUPR3HardenedIPRT.cpp \
182 SUPR3HardenedVerify.cpp \
183 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp \
184 $(VBOX_SUP_WIN_CERTS_FILE)
185SUPR3_SOURCES.amd64 = \
186 SUPLibTracerA.asm
187SUPR3_SOURCES.x86 = \
188 SUPLibTracerA.asm
189ifdef VBOX_WITH_HARDENING
190 SUPR3_SOURCES.win = \
191 win/SUPHardenedVerifyImage-win.cpp
192endif
193
194SUPR3-x86_TEMPLATE = VBoxR3Dll-x86
195SUPR3-x86_EXTENDS = SUPR3
196
197
198#
199# Static version of SUPR3. This is more of a stub than anything else in a
200# hardened build, at least on windows.
201#
202SUPR3Static_TEMPLATE = VBOXR3STATIC
203SUPR3Static_EXTENDS = SUPR3
204SUPR3Static_DEFS = $(SUPR3_DEFS) IN_SUP_R3_STATIC
205SUPR3Static_SOURCES.win = $(filter-out win/SUPHardenedVerifyImage-win.cpp, $(SUPR3_SOURCES.win))
206
207
208#
209# The static part of the hardened support library (ring-3).
210#
211SUPR3HardenedStatic_TEMPLATE = VBOXR3HARDENEDLIB
212SUPR3HardenedStatic_DEFS = IN_SUP_HARDENED_R3
213SUPR3HardenedStatic_DEFS += \
214 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC,) \
215 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
216 $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
217 $(if $(VBOX_WITH_DRIVERLESS_NEM_FALLBACK),VBOX_WITH_DRIVERLESS_NEM_FALLBACK,) \
218 $(if $(VBOX_WITHOUT_DEBUGGER_CHECKS),VBOX_WITHOUT_DEBUGGER_CHECKS,) \
219 $(if $(VBOX_PERMIT_VISUAL_STUDIO_PROFILING),VBOX_PERMIT_VISUAL_STUDIO_PROFILING,) \
220 VBOX_PERMIT_MORE \
221 VBOX_PERMIT_EVEN_MORE
222ifdef VBOX_WITH_VISTA_NO_SP
223 SUPR3HardenedStatic_DEFS.win += VBOX_WITH_VISTA_NO_SP
224endif
225SUPR3HardenedStatic_INCS = .
226SUPR3HardenedStatic_SOURCES = \
227 SUPR3HardenedMain.cpp \
228 SUPR3HardenedVerify.cpp \
229 SUPR3HardenedNoCrt.cpp \
230 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
231SUPR3HardenedStatic_SOURCES.win = \
232 win/SUPR3HardenedMain-win.cpp \
233 win/SUPR3HardenedMainA-win.asm \
234 win/SUPR3HardenedMainImports-win.cpp \
235 win/SUPHardenedVerifyProcess-win.cpp \
236 win/SUPHardenedVerifyImage-win.cpp \
237 $(VBOX_SUP_WIN_CERTS_FILE)
238SUPR3HardenedStatic_SOURCES.x86 += \
239 $(VBOX_PATH_RUNTIME_SRC)/common/asm/ASMMemFirstMismatchingU8.asm
240SUPR3HardenedStatic_SOURCES.amd64 += \
241 $(VBOX_PATH_RUNTIME_SRC)/common/asm/ASMMemFirstMismatchingU8.asm
242
243
244if "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING) ## @todo some of this move up.
245 SUPR3HardenedStatic_DEFS += \
246 IN_RT_R3 \
247 IN_RT_STATIC \
248 IN_DIS \
249 IN_DIS_STATIC \
250 DIS_CORE_ONLY \
251 IPRT_NO_CRT \
252 RT_WITH_NOCRT_ALIASES \
253 LOG_DISABLED \
254 IPRT_NO_ERROR_DATA \
255 IPRT_WITHOUT_DIGEST_MD4
256 SUPR3HardenedStatic_DEFS.win += LDR_ONLY_PE __STRALIGN_H_
257
258 SUPR3HardenedStatic_INCS += $(PATH_ROOT)/include/iprt/nocrt $(VBOX_PATH_RUNTIME_SRC)/include
259
260 SUPR3HardenedStatic_SOURCES += \
261 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldr.cpp \
262 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldrEx.cpp \
263 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldrPE.cpp \
264 $(VBOX_PATH_RUNTIME_SRC)/common/alloc/heapsimple.cpp \
265 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-basics.cpp \
266 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-cursor.cpp \
267 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-default-allocator.cpp \
268 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-safer-allocator.cpp \
269 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-dump.cpp \
270 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-encode.cpp \
271 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-bitstring.cpp \
272 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-bitstring-decode.cpp \
273 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-boolean.cpp \
274 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-boolean-decode.cpp \
275 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-core.cpp \
276 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-core-decode.cpp \
277 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-dyntype.cpp \
278 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-dyntype-decode.cpp \
279 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-integer.cpp \
280 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-integer-decode.cpp \
281 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-null.cpp \
282 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-null-decode.cpp \
283 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-objid.cpp \
284 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-objid-decode.cpp \
285 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-octetstring.cpp \
286 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-octetstring-decode.cpp \
287 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-string.cpp \
288 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-string-decode.cpp \
289 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-time.cpp \
290 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-time-decode.cpp \
291 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/digest-core.cpp \
292 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/digest-builtin.cpp \
293 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/key.cpp \
294 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-asn1-decoder.cpp \
295 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-core.cpp \
296 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-init.cpp \
297 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-sanity.cpp \
298 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-verify.cpp \
299 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-builtin.cpp \
300 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-core.cpp \
301 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-rsa.cpp \
302 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-verify.cpp \
303 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-util.cpp \
304 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-asn1-decoder.cpp \
305 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-core.cpp \
306 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-init.cpp \
307 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-sanity.cpp \
308 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-asn1-decoder.cpp \
309 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-core.cpp \
310 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-init.cpp \
311 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-sanity.cpp \
312 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-asn1-decoder.cpp \
313 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-certpaths.cpp \
314 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-core.cpp \
315 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-init.cpp \
316 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-sanity.cpp \
317 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-verify.cpp \
318 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/store.cpp \
319 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/store-inmem.cpp \
320 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-asn1-decoder.cpp \
321 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-core.cpp \
322 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-init.cpp \
323 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-sanity.cpp \
324 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-asn1-decoder.cpp \
325 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-core.cpp \
326 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-init.cpp \
327 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/tsp-sanity.cpp \
328 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-md2.cpp \
329 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-md5.cpp \
330 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha1.cpp \
331 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha256.cpp \
332 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha512.cpp \
333 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha3.cpp \
334 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/md2str.cpp \
335 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/md5str.cpp \
336 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha1str.cpp \
337 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha256str.cpp \
338 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha512str.cpp \
339 $(VBOX_PATH_RUNTIME_SRC)/common/err/errinfo.cpp \
340 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathChangeToUnixSlashes.cpp \
341 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathExt.cpp \
342 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16PrintHexBytes.cpp \
343 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16ICmpAscii.cpp \
344 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16NICmpAscii.cpp \
345 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16CatAscii.cpp \
346 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16CopyAscii.cpp \
347 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16End.cpp \
348 $(VBOX_PATH_RUNTIME_SRC)/common/string/strstrip.cpp \
349 \
350 $(VBOX_PATH_RUNTIME_SRC)/common/err/errmsg.cpp \
351 $(VBOX_PATH_RUNTIME_SRC)/common/math/bignum.cpp \
352 $(VBOX_PATH_RUNTIME_SRC)/common/math/bignum-amd64-x86.asm \
353 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
354 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2.cpp \
355 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
356 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
357 $(VBOX_PATH_RUNTIME_SRC)/common/misc/zero.asm \
358 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathAbsEx.cpp \
359 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathFilename.cpp \
360 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathParse.cpp \
361 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathParsedReassemble.cpp \
362 $(VBOX_PATH_RUNTIME_SRC)/common/string/memchr.asm \
363 $(VBOX_PATH_RUNTIME_SRC)/common/string/memcmp.asm \
364 $(VBOX_PATH_RUNTIME_SRC)/common/string/memcpy.asm \
365 $(VBOX_PATH_RUNTIME_SRC)/common/string/memmove.asm \
366 $(VBOX_PATH_RUNTIME_SRC)/common/string/mempcpy.asm \
367 $(VBOX_PATH_RUNTIME_SRC)/common/string/memset.asm \
368 $(VBOX_PATH_RUNTIME_SRC)/common/string/strversion.cpp \
369 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrPrintHexBytes.cpp \
370 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCat.cpp \
371 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCmp.cpp \
372 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCopy.cpp \
373 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrEnd.asm \
374 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrICmpAscii.cpp \
375 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrNCmp.cpp \
376 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrNLen.cpp \
377 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16Copy.cpp \
378 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16NLenEx.cpp \
379 $(VBOX_PATH_RUNTIME_SRC)/common/string/strchr.asm \
380 $(VBOX_PATH_RUNTIME_SRC)/common/string/strcmp.asm \
381 $(VBOX_PATH_RUNTIME_SRC)/common/string/strcpy.asm \
382 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformat.cpp \
383 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrFormat.cpp \
384 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformatrt.cpp \
385 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformattype.cpp \
386 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformatnum.cpp \
387 $(VBOX_PATH_RUNTIME_SRC)/common/string/stringalloc.cpp \
388 $(VBOX_PATH_RUNTIME_SRC)/common/string/strlen.asm \
389 $(VBOX_PATH_RUNTIME_SRC)/common/string/strncmp.asm \
390 $(VBOX_PATH_RUNTIME_SRC)/common/string/strncpy.asm \
391 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf.cpp \
392 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf-ellipsis.cpp \
393 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf2.cpp \
394 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf2-ellipsis.cpp \
395 $(VBOX_PATH_RUNTIME_SRC)/common/string/strtonum.cpp \
396 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-16.cpp \
397 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-8.cpp \
398 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-8-case.cpp \
399 $(VBOX_PATH_RUNTIME_SRC)/common/string/unidata-upper.cpp \
400 $(VBOX_PATH_RUNTIME_SRC)/common/string/unidata-lower.cpp \
401 $(VBOX_PATH_RUNTIME_SRC)/common/time/time.cpp \
402 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp \
403 $(VBOX_PATH_RUNTIME_SRC)/generic/RTPathGetCurrentDrive-generic.cpp \
404 $(VBOX_PATH_RUNTIME_SRC)/generic/RTPathGetCurrentOnDrive-generic.cpp \
405 $(VBOX_PATH_RUNTIME_SRC)/generic/rtStrFormatKernelAddress-generic.cpp \
406 $(VBOX_PATH_RUNTIME_SRC)/generic/memsafer-generic.cpp \
407 $(VBOX_PATH_RUNTIME_SRC)/generic/uuid-generic.cpp \
408 \
409 ../../Disassembler/DisasmCore.cpp \
410 ../../Disassembler/DisasmTables.cpp \
411 ../../Disassembler/DisasmTablesX64.cpp \
412 ../../Disassembler/DisasmReg.cpp
413
414 SUPR3HardenedStatic_SOURCES.amd64 += \
415 $(VBOX_PATH_RUNTIME_SRC)/common/math/RTUInt128MulByU64.asm \
416 $(VBOX_PATH_RUNTIME_SRC)/win/amd64/ASMGetCS.asm \
417 $(VBOX_PATH_RUNTIME_SRC)/win/amd64/ASMGetSS.asm
418
419 SUPR3HardenedStatic_SOURCES.win += \
420 win/SUPR3HardenedNoCrt-win.cpp \
421 $(VBOX_PATH_RUNTIME_SRC)/nt/RTErrConvertFromNtStatus.cpp \
422 $(VBOX_PATH_RUNTIME_SRC)/nt/RTNtPathFindPossible8dot3Name.cpp \
423 $(VBOX_PATH_RUNTIME_SRC)/nt/RTNtPathExpand8dot3Path.cpp \
424 $(VBOX_PATH_RUNTIME_SRC)/nt/RTNtPathExpand8dot3PathA.cpp \
425 $(VBOX_PATH_RUNTIME_SRC)/r3/nt/pathint-nt.cpp \
426 $(VBOX_PATH_RUNTIME_SRC)/win/RTErrConvertFromWin32.cpp \
427 $(VBOX_PATH_RUNTIME_SRC)/win/errmsgwin.cpp
428
429 # Add necessary compiler specific files from the compiler lib dir.
430 ifeq ($(KBUILD_TARGET),win)
431 include $(KBUILD_PATH)/tools/$(VBOX_VCC_TOOL).kmk
432 SUPR3HardenedStatic_SOURCES.win += \
433 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/chkstk.obj
434
435 # And a few extracted from the static libc to support -guard and cookes.
436 # In 14.2 these files does not import anything from the win32 API and are
437 # mostly tiny bits of code. Needs not initialization that I can spot.
438 ifneq ($(VBOX_VCC_LD_GUARD_CF),)
439 SUPR3HardenedStatic_SOURCES.win += \
440 $(SUPR3HardenedStatic_0_OUTDIR)/loadcfg.obj
441 # These are for the /guard option.
442 SUPR3HardenedStatic_SOURCES.win += \
443 $(SUPR3HardenedStatic_0_OUTDIR)/gs_cookie.obj \
444 $(SUPR3HardenedStatic_0_OUTDIR)/guard_support.obj
445 SUPR3HardenedStatic_SOURCES.win.amd64 += \
446 $(SUPR3HardenedStatic_0_OUTDIR)/guard_dispatch.obj \
447 $(SUPR3HardenedStatic_0_OUTDIR)/guard_xfg_dispatch.obj
448 # These next ones are for supporting the /GS option. We skip gs_report.obj as it
449 # import lots from kernel32 and we're better of reporting the problem ourselves.
450 SUPR3HardenedStatic_SOURCES.win.amd64 += \
451 $(SUPR3HardenedStatic_0_OUTDIR)/amdsecgs.obj \
452 $(SUPR3HardenedStatic_0_OUTDIR)/gshandler.obj
453 SUPR3HardenedStatic_SOURCES.win.x86 += \
454 $(SUPR3HardenedStatic_0_OUTDIR)/secchk.obj \
455 $(SUPR3HardenedStatic_0_OUTDIR)/alloca16.obj
456
457$$(SUPR3HardenedStatic_0_OUTDIR)/loadcfg.obj \
458$$(SUPR3HardenedStatic_0_OUTDIR)/gs_cookie.obj \
459$$(SUPR3HardenedStatic_0_OUTDIR)/guard_support.obj \
460$$(SUPR3HardenedStatic_0_OUTDIR)/guard_dispatch.obj \
461$$(SUPR3HardenedStatic_0_OUTDIR)/guard_xfg_dispatch.obj \
462$$(SUPR3HardenedStatic_0_OUTDIR)/amdsecgs.obj \
463$$(SUPR3HardenedStatic_0_OUTDIR)/gs_report.obj \
464$$(SUPR3HardenedStatic_0_OUTDIR)/gshandler.obj \
465$$(SUPR3HardenedStatic_0_OUTDIR)/secchk.obj \
466$$(SUPR3HardenedStatic_0_OUTDIR)/alloca16.obj \
467 : \
468 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/libcmt.lib | $$(dir $$@)
469 set -x; $(TOOL_$(VBOX_VCC_TOOL)_AR) "/EXTRACT:$$($(TOOL_$(VBOX_VCC_TOOL)_AR) /LIST "$<" | $(SED_EXT) -e '/$(notdir $@)/!d' )" "/OUT:$@" "$<"
470 endif
471 endif
472endif
473
474# macOS specifics.
475ifeq ($(KBUILD_TARGET),darwin)
476 SUPR3HardenedStatic_DEFS += \
477 LOG_DISABLED
478
479 SUPR3HardenedStatic_INCS += $(VBOX_PATH_RUNTIME_SRC)/include
480
481 SUPR3HardenedStatic_SOURCES += \
482 darwin/SUPR3HardenedMain-darwin.cpp \
483 \
484 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
485 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2.cpp \
486 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
487 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
488 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp
489endif
490
491# Things specific to the rest of the posix crowd.
492if1of ($(KBUILD_TARGET), linux solaris)
493 SUPR3HardenedStatic_DEFS += \
494 IN_DIS \
495 IN_DIS_STATIC \
496 DIS_CORE_ONLY \
497 LOG_DISABLED
498 SUPR3HardenedStatic_DEFS.linux += \
499 SUP_HARDENED_WITH_DLMOPEN
500 SUPR3HardenedStatic_DEFS.solaris += \
501 SUP_HARDENED_WITH_DLMOPEN
502
503 SUPR3HardenedStatic_INCS += $(VBOX_PATH_RUNTIME_SRC)/include
504
505 SUPR3HardenedStatic_SOURCES += \
506 posix/SUPR3HardenedMain-posix.cpp \
507 posix/SUPR3HardenedMainA-posix.asm \
508 \
509 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
510 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2.cpp \
511 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
512 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
513 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp \
514 \
515 ../../Disassembler/DisasmCore.cpp \
516 ../../Disassembler/DisasmTables.cpp \
517 ../../Disassembler/DisasmTablesX64.cpp \
518 ../../Disassembler/DisasmReg.cpp
519endif
520
521SUPR3HardenedMain.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
522
523
524#
525# VBoxSupLib - Windows DLL for catching thread creation and termination.
526#
527VBoxSupLib_TEMPLATE = $(if-expr "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING),VBOXR3HARDENEDLIB,VBoxR3StaticNoCrt)
528VBoxSupLib_SDKS.win = VBOX_NTDLL
529VBoxSupLib_LDFLAGS.win.amd64 = -Entry:DllMainEntrypoint
530VBoxSupLib_LDFLAGS.win.x86 = -Entry:DllMainEntrypoint
531VBoxSupLib_DEFS = \
532 $(if $(VBOX_WITHOUT_DEBUGGER_CHECKS),VBOX_WITHOUT_DEBUGGER_CHECKS,)
533VBoxSupLib_SOURCES = \
534 $(KBUILD_TARGET)/VBoxSupLib-$(KBUILD_TARGET).cpp
535VBoxSupLib_SOURCES.win = \
536 win/VBoxSupLib.rc
537VBoxSupLib_LIBS.win.x86 = \
538 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/chkstk.obj
539VBoxSupLib_LIBS.win.amd64 = \
540 $(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/chkstk.obj
541ifdef VBOX_WITH_HARDENING
542 VBoxSupLib_LIBS.win = $(SUPR3HardenedStatic_1_TARGET) # includes the rest of the /guard:cf support stuff.
543endif
544VBoxSupLib_VBOX_IMPORT_CHECKER.win.x86 = xp
545VBoxSupLib_VBOX_IMPORT_CHECKER.win.amd64 = xp64
546
547
548#
549# VBoxSupSvc - The system wide service/daemon.
550#
551VBoxSupSvc_TEMPLATE = VBOXR3EXE
552VBoxSupSvc_SOURCES = \
553 SUPSvc.cpp \
554 SUPSvcGlobal.cpp \
555 $(KBUILD_TARGET)/SUPSvc-$(KBUILD_TARGET).cpp
556if1of ($(KBUILD_TARGET), win)
557 VBoxSupSvc_SOURCES += \
558 SUPSvcGrant.cpp
559endif
560ifn1of ($(KBUILD_TARGET), win)
561 VBoxSupSvc_SOURCES += \
562 SUPSvcMain-posix.cpp
563endif
564VBoxSupSvc_LIBS = \
565 $(LIB_RUNTIME)
566
567
568#
569# SUPR0 - The Ring-0 Import library.
570#
571SUPR0_TEMPLATE = VBoxR0
572if1of ($(VBOX_LDR_FMT), pe lx)
573 SUPR0_SOURCES = $(SUPR0_0_OUTDIR)/SUPR0.def
574 SUPR0_CLEAN = $(SUPR0_0_OUTDIR)/SUPR0.def
575$$(SUPR0_0_OUTDIR)/SUPR0.def: \
576 $(PATH_SUB_CURRENT)/SUPDrv.cpp \
577 $(PATH_SUB_CURRENT)/SUPR0-def-$(VBOX_LDR_FMT).sed \
578 | $$(dir $$@)
579 $(SED) \
580 -f $(dir $<)/SUPR0-def-$(VBOX_LDR_FMT).sed \
581 --output $@ \
582 $<
583 # Experiment: Let's see how blunt the ones messing our NULL_THUNK_DATA entries on W10 are.
584 ifeq ($(KBUILD_TARGET),win)
585 ifdef KLIBTWEAKER_EXT
586 SUPR0_POST_CMDS = $(KLIBTWEAKER_EXT) --clear-timestamps --fill-null_thunk_data $(out)
587 endif
588 endif
589endif
590
591
592#
593# SUPRC - The raw-mode context library.
594#
595SUPRC_TEMPLATE := VBoxRc
596SUPRC_DEFS := IN_SUP_RC IN_RT_RC IN_VMM_RC
597SUPRC_SOURCES := SUPLibAll.cpp
598
599
600#
601# SUPR0IdcClient - The Ring-0 IDC client driver library.
602#
603SUPR0IdcClient_TEMPLATE = VBoxR0DrvLib
604SUPR0IdcClient_DEFS = IN_RT_R0 IN_SUP_R0 IN_SUP_STATIC
605SUPR0IdcClient_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
606SUPR0IdcClient_SOURCES.$(KBUILD_TARGET) = \
607 $(KBUILD_TARGET)/SUPR0IdcClient-$(KBUILD_TARGET).c
608SUPR0IdcClient_SOURCES = \
609 SUPR0IdcClient.c \
610 SUPR0IdcClientComponent.c \
611 SUPR0IdcClientStubs.c
612
613
614
615if !defined(VBOX_ONLY_DOCS) \
616 && !defined(VBOX_ONLY_EXTPACKS) \
617 && !defined(VBOX_ONLY_VALIDATIONKIT)
618
619ifeq ($(KBUILD_TARGET),os2)
620
621#
622# VBoxDrv.sys - The OS/2 driver.
623#
624VBoxDrv_TEMPLATE = VBOXR0DRV
625VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
626VBoxDrv_INCS := $(PATH_SUB_CURRENT)
627#VBoxDrv_LDFLAGS = -s -t -v
628VBoxDrv_SOURCES = \
629 os2/SUPDrvA-os2.asm \
630 os2/SUPDrv-os2.def
631VBoxDrv_LIBS = \
632 $(VBoxDrvLib_1_TARGET) \
633 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
634 $(VBOX_GCC_LIBGCC) \
635 end
636
637# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
638LIBRARIES += VBoxDrvLib
639VBoxDrvLib_TEMPLATE = VBOXR0DRV
640VBoxDrvLib_INSTTYPE = none
641VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0
642VBoxDrvLib_INCS := \
643 . \
644 $(PATH_ROOT)/src/VBox/Runtime/include
645VBoxDrvLib_SOURCES = \
646 os2/SUPDrv-os2.cpp \
647 SUPDrv.cpp \
648 SUPDrvGip.cpp \
649 SUPDrvSem.cpp \
650 SUPLibAll.cpp
651
652endif # os2
653
654
655#
656# New VBoxDrv target. TODO: Convert all the above to use this!
657#
658if1of ($(KBUILD_TARGET), darwin freebsd solaris win)
659 ifdef VBOX_WITH_VBOXDRV
660 SYSMODS += VBoxDrv
661 endif
662 VBoxDrv_TEMPLATE = VBOXR0DRV
663 VBoxDrv_NAME.freebsd = vboxdrv
664 VBoxDrv_NAME.solaris = vboxdrv
665 VBoxDrv_NAME.win = VBoxSup
666 ifdef VBOX_SIGNING_MODE
667 VBoxDrv_INSTTYPE.win = none
668 VBoxDrv_DEBUG_INSTTYPE.win = both
669 endif
670 VBoxDrv_INST.darwin = $(INST_VBOXDRV)Contents/MacOS/
671 VBoxDrv_DEBUG_INST.darwin= $(patsubst %/,%,$(INST_VBOXDRV))
672 VBoxDrv_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK_INCS)
673
674 VBoxDrv_DEFS := IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
675 ifdef VBOX_WITH_DTRACE_R0DRV
676 VBoxDrv_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R0DRV
677 endif
678 ifdef VBOX_WITHOUT_DEBUGGER_CHECKS
679 VBoxDrv_DEFS += VBOX_WITHOUT_DEBUGGER_CHECKS
680 endif
681 ifdef VBOX_PERMIT_VISUAL_STUDIO_PROFILING
682 VBoxDrv_DEFS += VBOX_PERMIT_VISUAL_STUDIO_PROFILING
683 endif
684 VBoxDrv_DEFS += VBOX_PERMIT_MORE VBOX_PERMIT_EVEN_MORE
685 #VBoxDrv_DEFS.debug += DEBUG_DARWIN_GIP
686 VBoxDrv_DEFS.darwin := VBOX_WITH_HOST_VMX
687 ifdef VBOX_WITH_RAW_MODE
688 VBoxDrv_DEFS.darwin += VBOX_WITH_RAW_MODE
689 endif
690 if defined(VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION) && defined(VBOX_SIGNING_MODE)
691 VBoxDrv_DEFS.darwin += VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION
692 ifeq ($(VBOX_SIGNING_MODE),test)
693 VBoxDrv_DEFS.darwin += VBOX_WITH_DARWIN_R0_TEST_SIGN
694 endif
695 endif
696 ifdef VBOX_WITH_NETFLT
697 VBoxDrv_DEFS.solaris += VBOX_WITH_NETFLT
698 endif
699 ifdef VBOX_WITH_NATIVE_SOLARIS_LOADING
700 VBoxDrv_DEFS.solaris += VBOX_WITH_NATIVE_SOLARIS_LOADING
701 endif
702 ifdef VBOX_WITHOUT_NATIVE_R0_LOADER
703 VBoxDrv_DEFS.win += VBOX_WITHOUT_NATIVE_R0_LOADER
704 endif
705 ifdef VBOX_WITH_VISTA_NO_SP
706 VBoxDrv_DEFS.win += VBOX_WITH_VISTA_NO_SP
707 endif
708 ifdef VBOX_WITH_HARDENING
709 VBoxDrv_ASDEFS += VBOX_WITH_HARDENING
710 endif
711 ifdef VBOX_WITH_RAM_IN_KERNEL
712 VBoxDrv_DEFS += VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV IPRT_WITHOUT_EFLAGS_AC_PRESERVING
713 else if ($(VBOX_VERSION_BUILD) % 2) == 1
714 VBoxDrv_DEFS += VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV IPRT_WITH_EFLAGS_AC_PRESERVING
715 endif
716
717 VBoxDrv_INCS = . $(VBoxDrv_0_OUTDIR)
718 VBoxDrv_INCS.darwin = ./darwin
719
720 VBoxDrv_LIBS = $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
721 VBoxDrv_LIBS.win = \
722 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
723 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
724 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib
725 ifn1of ($(VBOX_WINDDK), WINDDK80 WINDDK71)
726 VBoxDrv_LIBS.win.x86 = \
727 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/BufferOverflowK.lib
728 endif
729
730 #VBoxDrv_LDFLAGS.darwin = -Wl,-sectcreate,__TEXT,__info_plist,$(VBoxDrv.kext_0_OUTDIR)/Info.plist
731 #VBoxDrv_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
732 VBoxDrv_LDFLAGS.solaris += -N misc/ctf
733 ifdef VBOX_WITH_NATIVE_DTRACE
734 VBoxDrv_LDFLAGS.solaris += -N drv/dtrace
735 endif
736 VBoxDrv_LDFLAGS.win.x86 = -Entry:DriverEntry@8
737 VBoxDrv_LDFLAGS.win.amd64= -Entry:DriverEntry
738
739 VBoxDrv_SOURCES.darwin = \
740 darwin/SUPDrv-darwin.cpp
741 ifdef VBOX_WITH_DARWIN_R0_DARWIN_IMAGE_VERIFICATION
742 VBoxDrv_SOURCES.darwin += \
743 $(VBOX_SUP_WIN_CERTS_FILE)
744 endif
745 VBoxDrv_SOURCES.solaris = \
746 solaris/SUPDrv-solaris.c
747 VBoxDrv_SOURCES.win = \
748 win/SUPDrv-win.cpp \
749 win/SUPDrvA-win.asm \
750 win/VBoxDrv.rc
751 ifdef VBOX_WITH_HARDENING
752 VBoxDrv_SOURCES.win += \
753 win/SUPHardenedVerifyImage-win.cpp \
754 win/SUPHardenedVerifyProcess-win.cpp \
755 $(VBOX_SUP_WIN_CERTS_FILE)
756 endif
757 VBoxDrv_SOURCES = \
758 SUPDrv.d \
759 SUPDrv.cpp \
760 SUPDrvGip.cpp \
761 SUPDrvSem.cpp \
762 SUPDrvTracer.cpp \
763 SUPLibAll.cpp
764 ifdef VBOX_WITH_NATIVE_DTRACE
765 VBoxDrv_SOURCES += \
766 SUPDrv-dtrace.cpp
767 SUPDrv-dtrace.cpp_DEFS.darwin += VBOX_PATH_MACOSX_DTRACE_H=\"$(VBOX_PATH_MACOSX_SDK)/usr/include/sys/dtrace.h\"
768 endif
769 ifn1of ($(KBUILD_TARGET), linux freebsd)
770 VBoxDrv_SOURCES += \
771 SUPDrvTracerA.asm
772 endif
773
774 linux/SUPDrv-linux.c_DEPS = $(VBOX_SVN_REV_HEADER)
775
776endif
777
778
779
780if1of ($(KBUILD_TARGET), darwin)
781 # Files necessary to make a darwin kernel extension bundle.
782 INSTALLS.darwin += VBoxDrv.kext
783 VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
784 VBoxDrv.kext_SOURCES = $(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist
785 VBoxDrv.kext_CLEAN = $(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist
786 VBoxDrv.kext_BLDDIRS = $(VBoxDrv.kext_0_OUTDIR)/Contents/
787
788 $$(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist: \
789 $(PATH_SUB_CURRENT)/darwin/Info.plist \
790 $(VBOX_VERSION_MK) | $$(dir $$@)
791 $(call MSG_GENERATE,VBoxDrv,$@,$<)
792 $(QUIET)$(RM) -f $@
793 $(QUIET)$(SED) \
794 -e 's/@VBOX_VERSION_STRING@/$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_STRING),4.2.51)/g' \
795 -e 's/@VBOX_VERSION_MAJOR@/$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_MAJOR),4)/g' \
796 -e 's/@VBOX_VERSION_MINOR@/$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_MINOR),2)/g' \
797 -e 's/@VBOX_VERSION_BUILD@/$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_BUILD),51)/g' \
798 -e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
799 -e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
800 -e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
801 --output $@ \
802 $<
803
804 $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxDrv)
805endif
806
807
808if1of ($(KBUILD_TARGET), darwin solaris)
809 # Common manual loader script.
810 INSTALLS += SUPDrvScripts
811 SUPDrvScripts_INST = $(INST_DIST)
812 SUPDrvScripts_EXEC_SOURCES = \
813 $(KBUILD_TARGET)/load.sh
814endif
815
816
817if1of ($(KBUILD_TARGET), linux freebsd)
818 if1of ($(KBUILD_TARGET_ARCH), $(VBOX_SUPPORTED_HOST_ARCHS))
819#
820# Targets for installing the linux sources.
821#
822vboxdrv-src_INST = bin/src/vboxdrv/
823vboxdrv-src_SOURCES = \
824 $(subst $(DQUOTE),,$(FILES_VBOXDRV_NOBIN)) \
825 $(vboxdrv-src_0_OUTDIR)/Makefile
826vboxdrv-src_EXEC_SOURCES = \
827 $(subst $(DQUOTE),,$(FILES_VBOXDRV_BIN))
828vboxdrv-src_CLEAN = \
829 $(vboxdrv-src_0_OUTDIR)/Makefile \
830 $(PATH_TARGET)/vboxdrv-src-1.dep \
831
832# Scripts needed for building the kernel modules
833includedep $(PATH_TARGET)/vboxdrv-src-1.dep
834$$(vboxdrv-src_0_OUTDIR)/Makefile: \
835 $(PATH_SUB_CURRENT)/$(KBUILD_TARGET)/Makefile \
836 $$(if $$(eq $$(Support/$(KBUILD_TARGET)/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
837 $$(if $$(eq $$(Support/$(KBUILD_TARGET)/Makefile_VBOX_RAM_IN_KERNEL),$$(VBOX_WITH_RAM_IN_KERNEL)),,FORCE) \
838 | $$(dir $$@)
839 $(call MSG_TOOL,Creating,,$@)
840 $(QUIET)$(SED) -e "" \
841 $(if-expr !defined(VBOX_WITH_HARDENING) ,-e "s;VBOX_WITH_HARDENING;;g",) \
842 $(if-expr ($(VBOX_VERSION_BUILD) % 2) == 0 || defined(VBOX_WITH_RAM_IN_KERNEL) \
843 , -e "s;VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV;;g" -e "s;IPRT_WITH_EFLAGS_AC_PRESERVING;;g",) \
844 $(if-expr !defined(VBOX_WITH_RAM_IN_KERNEL) \
845 , -e 's;VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV;;g' -e 's;IPRT_WITHOUT_EFLAGS_AC_PRESERVING;;g',) \
846 --output $@ $<
847 %$(QUIET2)$(APPEND) -t -n '$(PATH_TARGET)/vboxdrv-src-1.dep' \
848 'Support/$(KBUILD_TARGET)/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)' \
849 'Support/$(KBUILD_TARGET)/Makefile_VBOX_RAM_IN_KERNEL=$(VBOX_WITH_RAM_IN_KERNEL)'
850
851#
852# Build test for the linux host kernel modules.
853#
854$(evalcall2 VBOX_LINUX_KMOD_TEST_BUILD_RULE_FN,vboxdrv-src,,save_symvers)
855
856 ifdef VBOX_WITH_KMOD_WRAPPED_R0_MODS
857#
858# Common wrapper module files.
859#
860INSTALLS.linux += vboxwrappermod-common-src
861vboxwrappermod-common-src_INST = bin/src/common/
862vboxwrappermod-common-src_SOURCES = \
863 linux/SUPWrapperMod-linux.c=>SUPWrapperMod-linux.c \
864 linux/Makefile-wrapper.gmk=>Makefile-wrapper.gmk \
865 $(PATH_ROOT)/src/VBox/Installer/linux/Makefile-header.gmk=>Makefile-header.gmk \
866 $(PATH_ROOT)/src/VBox/Installer/linux/Makefile-footer.gmk=>Makefile-footer.gmk
867 endif
868
869 endif # supported host arch
870endif # linux freebsd
871
872
873ifeq ($(KBUILD_TARGET), win)
874 INSTALLS.win += VBoxSup-inf
875 VBoxSup-inf_TEMPLATE = VBoxR0DrvInfCat
876 VBoxSup-inf_SOURCES = \
877 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.inf
878 VBoxSup-inf_CLEAN = $(VBoxSup-inf_SOURCES)
879 VBoxSup-inf_BLDDIRS = $(PATH_TARGET)/VBoxSupCat.dir
880
881 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.inf: $(PATH_SUB_CURRENT)/win/VBoxSup.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
882 $(call MSG_GENERATE,VBoxSup-inf,$@,$<)
883 $(call VBOX_EDIT_INF_FN,$<,$@)
884
885 ifdef VBOX_SIGNING_MODE
886 VBoxSup-inf_SOURCES += \
887 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.sys \
888 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat \
889 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat=>VBoxSup-PreW10.cat
890
891 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.sys: $$(VBoxDrv_1_TARGET) | $$(dir $$@)
892 $(INSTALL) -m 644 -- "$<" "$(@D)"
893
894 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.cat: \
895 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.inf \
896 $(PATH_TARGET)/VBoxSupCat.dir/VBoxSup.sys
897 $(call MSG_TOOL,Inf2Cat,VBoxSup-inf,$@,$<)
898 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
899 endif # signing
900endif # win
901
902#
903# Linux only.
904#
905PROGRAMS.linux += LnxPerfHack
906LnxPerfHack_TEMPLATE = VBoxR3Tool
907LnxPerfHack_SOURCES = linux/LnxPerfHack.cpp
908
909
910
911endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
912include $(FILE_KBUILD_SUB_FOOTER)
913
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