VirtualBox

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

Last change on this file since 106985 was 106985, checked in by vboxsync, 2 weeks ago

SUPHardNt: VBoxSupLib.dll is only needed for fully hardened builds. jiraref:VBP-1442

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