VirtualBox

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

Last change on this file since 103914 was 103331, checked in by vboxsync, 10 months ago

Config.kmk,Main,libs/xpcom,HostDrivers/Support,Installer: Make VBOX_WITH_XPCOMIPCD_IN_VBOX_SVC the default and remove the deprecated code, bugref:10594

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