VirtualBox

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

Last change on this file since 103306 was 103306, checked in by vboxsync, 3 months ago

HostDrivers/Support: Add VBoxXPCOMIPCD to the list of hardened libraries based on VBOX_WITH_XPCOMIPCD_IN_VBOX_SVC, bugref:10594 [missing entry]

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

© 2023 Oracle
ContactPrivacy policyTerms of Use