VirtualBox

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

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

SUPHardNt: Rough and untested port of the C code to win.arm64 so the extpack builds. VBP-1447

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