VirtualBox

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

Last change on this file since 52204 was 52204, checked in by vboxsync, 11 years ago

SUP,LDR: Changed RTLdrGetBits to allow not resolving imports. Combined the memory and image purification code with the process validation code, adding a validation kind/mode parameter. The process verfication code now checks that code sections are unmodified. Had to add a self purification run before hooking NtCreateSection to undo a weird kernel32 change that avast made (making GetBinaryTypeW specify write thru when opening a file). So, VM startup is now even slower thanks to avast.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 26.0 KB
Line 
1# $Id: Makefile.kmk 52204 2014-07-26 11:22:44Z vboxsync $
2## @file
3# Sub-Makefile for the support library and the drivers/modules/kexts it uses.
4#
5
6#
7# Copyright (C) 2006-2012 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# The contents of this file may alternatively be used under the terms
18# of the Common Development and Distribution License Version 1.0
19# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20# VirtualBox OSE distribution, in which case the provisions of the
21# CDDL are applicable instead of those of the GPL.
22#
23# You may elect to license modified versions of this file under the
24# terms and conditions of either the GPL or the CDDL or both.
25#
26
27SUB_DEPTH = ../../../..
28include $(KBUILD_PATH)/subheader.kmk
29
30#
31# Targets
32#
33LIBRARIES += SUPR3 SUPR3Static
34ifdef VBOX_WITH_HARDENING
35 LIBRARIES += SUPR3HardenedStatic
36endif
37DLLS.win += VBoxSupLib
38ifdef VBOX_WITH_32_ON_64_MAIN_API
39 LIBRARIES += SUPR3-x86
40endif
41ifndef VBOX_ONLY_DOCS
42 if1of ($(VBOX_LDR_FMT), pe lx)
43 LIBRARIES += SUPR0
44 endif
45endif
46if !defined(VBOX_ONLY_DOCS) \
47 && !defined(VBOX_ONLY_EXTPACKS) \
48 && !defined(VBOX_ONLY_VALIDATIONKIT)
49 ifdef VBOX_WITH_SUPSVC
50 PROGRAMS += VBoxSupSvc
51 endif
52 ifdef VBOX_WITH_VBOXDRV
53 LIBRARIES += SUPR0IdcClient
54 SYSMODS.freebsd += vboxdrv
55 SYSMODS.os2 += VBoxDrv
56 endif
57 INSTALLS.linux += vboxdrv-mod
58 INSTALLS.freebsd += vboxdrv-mod
59
60 #
61 # Include sub-makefile(s).
62 #
63 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
64
65 #
66 # Populate FILES_VBOXDRV_NOBIN and FILES_VBOXDRV_BIN
67 #
68 ifeq ($(KBUILD_TARGET),linux)
69 include $(PATH_SUB_CURRENT)/linux/files_vboxdrv
70 endif
71 ifeq ($(KBUILD_TARGET),freebsd)
72 include $(PATH_SUB_CURRENT)/freebsd/files_vboxdrv
73 endif
74endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
75
76#
77# Authenticode related trust anchors and certificates -> .cpp
78#
79VBOX_SUP_WIN_CERTS_FILE = $(SUPR3_0_OUTDIR)/TrustAnchorsAndCerts.cpp
80VBOX_SUP_WIN_CERTS := \
81 SpcRootMicrosoft0=SpcRoot-MicrosoftAuthenticodeTmRootAuthority-01.taf \
82 SpcRootMicrosoft1=SpcRoot-MicrosoftRootAuthority-00c1008b3c3c8811d13ef663ecdf40.taf \
83 SpcRootMicrosoft2=SpcRoot-MicrosoftRootCertificateAuthority-79ad16a14aa0a5ad4c7358f407132e65.taf \
84 SpcRootMicrosoft3=SpcRoot-MicrosoftRootCertificateAuthority2010-28cc3a25bfba44ac449a9b586b4339aa.taf \
85 SpcRootMicrosoft4=SpcRoot-MicrosoftRootCertificateAuthority2011-3f8bc8b5fc9fb29643b569d66c42e144.taf \
86 SpcRootMicrosoft5=SpcRoot-MicrosoftDigitalMediaAuthority2005-6eff330eb6e7569740680870104baaba.taf \
87 NtRootMicrosoft6=NtRoot-MicrosoftCodeVerificationRoot-729404101f3e0ca347837fca175a8438.taf \
88 TimeRootMicrosoft0=Timestamp-CopyrightC1997MicrosoftCorp-01.taf \
89 TrustedCertVBox0=Trusted-OracleCorporationVirtualBox-51ca009816fdbd80f120e015ee75823e.taf
90VBOX_SUP_WIN_CERT_NAMES := $(foreach cert,$(VBOX_SUP_WIN_CERTS),$(firstword $(subst =,$(SPACE) ,$(cert))))
91VBOX_PATH_SUPR3_CERTIFICATES := $(PATH_SUB_CURRENT)/win/Certificates
92
93# 1=name, 2=filter, 3=buildcert?.
94if "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING)
95 VBOX_SUP_GEN_CERT_MACRO = 'SUPTAENTRY const g_aSUP$(1)TAs[] =' '{' \
96 $(if-expr "$(3)" == "",,' SUPTAENTRY_GEN(g_abSUPBuildCert),') \
97 $(foreach certnm,$(filter $(2),$(VBOX_SUP_WIN_CERT_NAMES)), ' SUPTAENTRY_GEN(g_abSUP$(certnm)),') \
98 '};' 'unsigned const g_cSUP$(1)TAs = RT_ELEMENTS(g_aSUP$(1)TAs);' '' ''
99else
100 VBOX_SUP_GEN_CERT_MACRO = 'SUPTAENTRY const g_aSUP$(1)TAs[] =' '{' \
101 $(foreach certnm,$(filter $(2),$(VBOX_SUP_WIN_CERT_NAMES)), ' SUPTAENTRY_GEN(g_abSUP$(certnm)),') \
102 '};' 'unsigned const g_cSUP$(1)TAs = RT_ELEMENTS(g_aSUP$(1)TAs);' '' ''
103endif
104
105$$(VBOX_SUP_WIN_CERTS_FILE): $(MAKEFILE_CURRENT) \
106 $(foreach cert,$(VBOX_SUP_WIN_CERTS),$(VBOX_PATH_SUPR3_CERTIFICATES)/$(lastword $(subst =,$(SPACE) ,$(cert)))) \
107 $(VBOX_BIN2C) \
108 $(if-expr "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING),$(VBOX_RTSIGNTOOL)) \
109 | $$(dir $$@)
110 $(QUIET)$(RM) -f -- $@ [email protected]
111 $(QUIET)$(APPEND) -n "$@" \
112 '' \
113 '#include <VBox/sup.h>' \
114 ''
115 $(foreach cert,$(VBOX_SUP_WIN_CERTS), $(NLTAB)$(VBOX_BIN2C) -ascii --append \
116 "SUP$(firstword $(subst =,$(SP) ,$(cert)))" \
117 "$(VBOX_PATH_SUPR3_CERTIFICATES)/$(lastword $(subst =,$(SP) ,$(cert)))" \
118 "$@")
119# The build certificate.
120if "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING)
121 $(VBOX_RTSIGNTOOL) extract-exe-signer-cert --exe $(VBOX_RTSIGNTOOL) --output "[email protected]" --der
122 $(VBOX_BIN2C) -ascii --append SUPBuildCert "[email protected]" $@
123 $(QUIET)$(RM) -f -- [email protected]
124endif
125# Generate certificate lists.
126 $(QUIET)$(APPEND) -n "$@" '' \
127 $(call VBOX_SUP_GEN_CERT_MACRO,All,%,build) \
128 $(call VBOX_SUP_GEN_CERT_MACRO,SpcRoot,SpcRoot%) \
129 $(call VBOX_SUP_GEN_CERT_MACRO,NtKernelRoot,NtRoot%) \
130 $(call VBOX_SUP_GEN_CERT_MACRO,Timestamp,TimeRoot%) \
131 $(call VBOX_SUP_GEN_CERT_MACRO,Trusted,TrustedCert%,build)
132
133tst: $(VBOX_SUP_WIN_CERTS_FILE)
134
135
136#
137# The Ring-3 Support Library (this is linked into the IPRT dll, VBoxRT).
138#
139SUPR3_TEMPLATE = VBOXR3
140SUPR3_DEFS = \
141 IN_SUP_R3 IN_RT_R3 \
142 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC) \
143 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
144 $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
145 VBOX_PERMIT_MORE
146SUPR3_INCS := $(PATH_SUB_CURRENT)
147SUPR3_SOURCES = \
148 SUPLib.cpp \
149 SUPLibLdr.cpp \
150 SUPLibSem.cpp \
151 SUPLibTracerA.asm \
152 SUPR3HardenedIPRT.cpp \
153 SUPR3HardenedVerify.cpp \
154 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp \
155 $(VBOX_SUP_WIN_CERTS_FILE)
156ifdef VBOX_WITH_HARDENING
157 SUPR3_SOURCES.win = \
158 win/SUPHardenedVerifyImage-win.cpp
159endif
160
161SUPR3-x86_TEMPLATE = VBoxR3Dll-x86
162SUPR3-x86_EXTENDS = SUPR3
163
164
165#
166# Static version of SUPR3. This is more of a stub than anything else in a
167# hardened build, at least on windows.
168#
169SUPR3Static_TEMPLATE = VBOXR3STATIC
170SUPR3Static_EXTENDS = SUPR3
171SUPR3Static_DEFS = $(SUPR3_DEFS) IN_SUP_R3_STATIC
172SUPR3Static_SOURCES.win = $(filter-out win/SUPHardenedVerifyImage-win.cpp, $(SUPR3_SOURCES.win))
173
174
175#
176# The static part of the hardened support library (ring-3).
177#
178VBOX_PATH_RUNTIME_SRC ?= $(PATH_ROOT)/src/VBox/Runtime
179SUPR3HardenedStatic_TEMPLATE = VBOXR3HARDENEDLIB
180SUPR3HardenedStatic_DEFS = IN_SUP_HARDENED_R3
181SUPR3HardenedStatic_DEFS += \
182 $(if $(VBOX_WITH_SUPSVC),VBOX_WITH_SUPSVC,) \
183 $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
184 $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
185 $(if $(VBOX_WITHOUT_DEBUGGER_CHECKS),VBOX_WITHOUT_DEBUGGER_CHECKS,) \
186 $(if $(VBOX_PERMIT_VISUAL_STUDIO_PROFILING),VBOX_PERMIT_VISUAL_STUDIO_PROFILING,) \
187 VBOX_PERMIT_MORE
188ifdef VBOX_WITH_VISTA_NO_SP
189 SUPR3HardenedStatic_DEFS.win += VBOX_WITH_VISTA_NO_SP
190endif
191SUPR3HardenedStatic_INCS = .
192SUPR3HardenedStatic_SOURCES = \
193 SUPR3HardenedMain.cpp \
194 SUPR3HardenedVerify.cpp \
195 SUPR3HardenedNoCrt.cpp \
196 $(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp
197SUPR3HardenedStatic_SOURCES.win = \
198 win/SUPR3HardenedMain-win.cpp \
199 win/SUPR3HardenedMainA-win.asm \
200 win/SUPHardenedVerifyProcess-win.cpp \
201 win/SUPHardenedVerifyImage-win.cpp \
202 $(VBOX_SUP_WIN_CERTS_FILE)
203
204if "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING) ## @todo some of this move up.
205 SUPR3HardenedStatic_DEFS += IN_RT IN_RT_R3 IN_RT_STATIC IPRT_NO_CRT RT_WITH_NOCRT_ALIASES LOG_DISABLED IPRT_NO_ERROR_DATA
206 SUPR3HardenedStatic_DEFS.win += LDR_ONLY_PE __STRALIGN_H_
207
208 SUPR3HardenedStatic_INCS += $(PATH_ROOT)/include/iprt/nocrt $(VBOX_PATH_RUNTIME_SRC)/include
209
210 SUPR3HardenedStatic_SOURCES += \
211 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldr.cpp \
212 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldrEx.cpp \
213 $(VBOX_PATH_RUNTIME_SRC)/common/ldr/ldrPE.cpp \
214 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-basics.cpp \
215 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-cursor.cpp \
216 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-default-allocator.cpp \
217 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-dump.cpp \
218 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-encode.cpp \
219 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-bitstring.cpp \
220 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-bitstring-decode.cpp \
221 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-boolean.cpp \
222 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-boolean-decode.cpp \
223 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-core.cpp \
224 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-core-decode.cpp \
225 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-dyntype.cpp \
226 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-dyntype-decode.cpp \
227 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-integer.cpp \
228 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-integer-decode.cpp \
229 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-null.cpp \
230 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-null-decode.cpp \
231 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-objid.cpp \
232 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-objid-decode.cpp \
233 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-octetstring.cpp \
234 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-octetstring-decode.cpp \
235 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-string.cpp \
236 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-string-decode.cpp \
237 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-time.cpp \
238 $(VBOX_PATH_RUNTIME_SRC)/common/asn1/asn1-ut-time-decode.cpp \
239 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/digest-core.cpp \
240 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/digest-builtin.cpp \
241 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-asn1-decoder.cpp \
242 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-core.cpp \
243 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-init.cpp \
244 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-sanity.cpp \
245 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkcs7-verify.cpp \
246 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-builtin.cpp \
247 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-core.cpp \
248 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-signature-rsa.cpp \
249 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-verify.cpp \
250 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/pkix-util.cpp \
251 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-asn1-decoder.cpp \
252 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-core.cpp \
253 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-init.cpp \
254 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/rsa-sanity.cpp \
255 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-asn1-decoder.cpp \
256 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-core.cpp \
257 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-init.cpp \
258 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/spc-sanity.cpp \
259 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-asn1-decoder.cpp \
260 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-certpaths.cpp \
261 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-core.cpp \
262 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-init.cpp \
263 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-sanity.cpp \
264 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/x509-verify.cpp \
265 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/store.cpp \
266 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/store-inmem.cpp \
267 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-asn1-decoder.cpp \
268 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-core.cpp \
269 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-init.cpp \
270 $(VBOX_PATH_RUNTIME_SRC)/common/crypto/taf-sanity.cpp \
271 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-md2.cpp \
272 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-md5.cpp \
273 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha1.cpp \
274 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha256.cpp \
275 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/alt-sha512.cpp \
276 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/md2str.cpp \
277 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/md5str.cpp \
278 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha1str.cpp \
279 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha256str.cpp \
280 $(VBOX_PATH_RUNTIME_SRC)/common/checksum/sha512str.cpp \
281 $(VBOX_PATH_RUNTIME_SRC)/common/err/errinfo.cpp \
282 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathChangeToUnixSlashes.cpp \
283 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathExt.cpp \
284 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrPrintHexBytes.cpp \
285 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16PrintHexBytes.cpp \
286 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTUtf16ICmpAscii.cpp \
287 $(VBOX_PATH_RUNTIME_SRC)/common/string/strstrip.cpp \
288 \
289 $(VBOX_PATH_RUNTIME_SRC)/common/err/errmsg.cpp \
290 $(VBOX_PATH_RUNTIME_SRC)/common/math/bignum.cpp \
291 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg1Weak.cpp \
292 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2Weak.cpp \
293 $(VBOX_PATH_RUNTIME_SRC)/common/misc/RTAssertMsg2WeakV.cpp \
294 $(VBOX_PATH_RUNTIME_SRC)/common/misc/zero.asm \
295 $(VBOX_PATH_RUNTIME_SRC)/common/path/RTPathFilename.cpp \
296 $(VBOX_PATH_RUNTIME_SRC)/common/string/memchr.asm \
297 $(VBOX_PATH_RUNTIME_SRC)/common/string/memcmp.asm \
298 $(VBOX_PATH_RUNTIME_SRC)/common/string/memcpy.asm \
299 $(VBOX_PATH_RUNTIME_SRC)/common/string/memmove.asm \
300 $(VBOX_PATH_RUNTIME_SRC)/common/string/mempcpy.asm \
301 $(VBOX_PATH_RUNTIME_SRC)/common/string/memset.asm \
302 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCat.cpp \
303 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCmp.cpp \
304 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrCopy.cpp \
305 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrNCmp.cpp \
306 $(VBOX_PATH_RUNTIME_SRC)/common/string/RTStrNLen.cpp \
307 $(VBOX_PATH_RUNTIME_SRC)/common/string/strchr.asm \
308 $(VBOX_PATH_RUNTIME_SRC)/common/string/strcmp.asm \
309 $(VBOX_PATH_RUNTIME_SRC)/common/string/strcpy.asm \
310 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformat.cpp \
311 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformatrt.cpp \
312 $(VBOX_PATH_RUNTIME_SRC)/common/string/strformattype.cpp \
313 $(VBOX_PATH_RUNTIME_SRC)/common/string/stringalloc.cpp \
314 $(VBOX_PATH_RUNTIME_SRC)/common/string/strlen.asm \
315 $(VBOX_PATH_RUNTIME_SRC)/common/string/strncmp.asm \
316 $(VBOX_PATH_RUNTIME_SRC)/common/string/strncpy.asm \
317 $(VBOX_PATH_RUNTIME_SRC)/common/string/strprintf.cpp \
318 $(VBOX_PATH_RUNTIME_SRC)/common/string/strtonum.cpp \
319 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-16.cpp \
320 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-8.cpp \
321 $(VBOX_PATH_RUNTIME_SRC)/common/string/utf-8-case.cpp \
322 $(VBOX_PATH_RUNTIME_SRC)/common/string/unidata-upper.cpp \
323 $(VBOX_PATH_RUNTIME_SRC)/common/string/unidata-lower.cpp \
324 $(VBOX_PATH_RUNTIME_SRC)/common/time/time.cpp \
325 $(VBOX_PATH_RUNTIME_SRC)/generic/RTAssertShouldPanic-generic.cpp \
326 $(VBOX_PATH_RUNTIME_SRC)/generic/memsafer-generic.cpp \
327 $(VBOX_PATH_RUNTIME_SRC)/generic/uuid-generic.cpp \
328
329
330 SUPR3HardenedStatic_SOURCES.win += \
331 win/SUPR3HardenedNoCrt-win.cpp \
332 $(VBOX_PATH_RUNTIME_SRC)/nt/RTErrConvertFromNtStatus.cpp \
333 $(VBOX_PATH_RUNTIME_SRC)/win/RTErrConvertFromWin32.cpp \
334 $(VBOX_PATH_RUNTIME_SRC)/win/errmsgwin.cpp
335
336 # Add necessary compiler specific files from libcmt.lib and the lib dir.
337 ifeq ($(KBUILD_TARGET),win)
338 SUPR3HardenedStatic_VBOX_LIBC_OBJS = chkstk.obj
339 ifeq ($(KBUILD_TARGET_ARCH),x86)
340 SUPR3HardenedStatic_VBOX_LIBC_OBJS += \
341 alloca16.obj \
342 ulldiv.obj \
343 ulldvrm.obj \
344 ullrem.obj \
345 ullshr.obj \
346 lldiv.obj \
347 lldvrm.obj \
348 llmul.obj \
349 llrem.obj \
350 llshl.obj \
351 llshr.obj \
352 rotl.obj \
353 rotr.obj
354 endif
355 SUPR3HardenedStatic_SOURCES.win += $(addprefix $(SUPR3HardenedStatic_0_OUTDIR)/,$(SUPR3HardenedStatic_VBOX_LIBC_OBJS))
356
357 $(addprefix $$(SUPR3HardenedStatic_0_OUTDIR)/,$(SUPR3HardenedStatic_VBOX_LIBC_OBJS)): \
358 $$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.$(KBUILD_TARGET_ARCH))_LIB)/libcmt.lib | $$(dir $$@)
359 $(TOOL_$(TEMPLATE_VBOXR3HARDENEDEXE_TOOL.win.$(KBUILD_TARGET_ARCH))_AR) "$<" \
360 /EXTRACT:`$(TOOL_$(TEMPLATE_VBOXR3HARDENEDEXE_TOOL.win.$(KBUILD_TARGET_ARCH))_AR) "$<" /LIST \
361 | $(SED_EXT) -n -e '/[\\/:]$(notdir $@)/p'` \
362 "/OUT:$@"
363 endif
364endif
365
366SUPR3HardenedMain.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
367
368
369#
370# VBoxSupLib - Windows DLL for catching thread creation and termination.
371#
372VBoxSupLib_TEMPLATE = $(if-expr "$(KBUILD_TARGET)" == "win" && defined(VBOX_WITH_HARDENING),VBOXR3HARDENEDLIB,VBOXR3)
373VBoxSupLib_LDFLAGS.win.amd64 = -Entry:DllMainEntrypoint
374VBoxSupLib_LDFLAGS.win.x86 = -Entry:DllMainEntrypoint
375VBoxSupLib_DEFS = \
376 $(if $(VBOX_WITHOUT_DEBUGGER_CHECKS),VBOX_WITHOUT_DEBUGGER_CHECKS,)
377VBoxSupLib_SOURCES = \
378 $(KBUILD_TARGET)/VBoxSupLib-$(KBUILD_TARGET).cpp
379VBoxSupLib_LIBS.win = \
380 $(SUPR3HardenedStatic_1_TARGET)
381
382
383#
384# VBoxSupSvc - The system wide service/daemon.
385#
386VBoxSupSvc_TEMPLATE = VBOXR3EXE
387VBoxSupSvc_SOURCES = \
388 SUPSvc.cpp \
389 SUPSvcGlobal.cpp \
390 $(KBUILD_TARGET)/SUPSvc-$(KBUILD_TARGET).cpp
391if1of ($(KBUILD_TARGET), win)
392 VBoxSupSvc_SOURCES += \
393 SUPSvcGrant.cpp
394endif
395ifn1of ($(KBUILD_TARGET), win)
396 VBoxSupSvc_SOURCES += \
397 SUPSvcMain-posix.cpp
398endif
399VBoxSupSvc_LIBS = \
400 $(LIB_RUNTIME)
401
402
403#
404# SUPR0 - The Ring-0 Import library.
405#
406SUPR0_TEMPLATE = VBoxR0
407if1of ($(VBOX_LDR_FMT), pe lx)
408 SUPR0_SOURCES = $(SUPR0_0_OUTDIR)/SUPR0.def
409 SUPR0_CLEAN = $(SUPR0_0_OUTDIR)/SUPR0.def
410$$(SUPR0_0_OUTDIR)/SUPR0.def: \
411 $(PATH_SUB_CURRENT)/SUPDrv.c \
412 $(PATH_SUB_CURRENT)/SUPR0-def-$(VBOX_LDR_FMT).sed \
413 | $$(dir $$@)
414 $(SED) \
415 -f $(dir $<)/SUPR0-def-$(VBOX_LDR_FMT).sed \
416 --output $@ \
417 $<
418endif
419
420
421#
422# SUPR0IdcClient - The Ring-0 IDC client driver library.
423#
424SUPR0IdcClient_TEMPLATE = VBoxR0DrvLib
425SUPR0IdcClient_DEFS = IN_RT_R0 IN_SUP_R0 IN_SUP_STATIC
426SUPR0IdcClient_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK)INCS
427SUPR0IdcClient_SOURCES.$(KBUILD_TARGET) = \
428 $(KBUILD_TARGET)/SUPR0IdcClient-$(KBUILD_TARGET).c
429SUPR0IdcClient_SOURCES = \
430 SUPR0IdcClient.c \
431 SUPR0IdcClientComponent.c \
432 SUPR0IdcClientStubs.c
433
434
435
436if !defined(VBOX_ONLY_DOCS) \
437 && !defined(VBOX_ONLY_EXTPACKS) \
438 && !defined(VBOX_ONLY_VALIDATIONKIT)
439
440ifeq ($(KBUILD_TARGET),os2)
441
442#
443# VBoxDrv.sys - The OS/2 driver.
444#
445VBoxDrv_TEMPLATE = VBOXR0DRV
446VBoxDrv_DEFS = IN_RT_R0 IN_SUP_R0
447VBoxDrv_INCS := $(PATH_SUB_CURRENT)
448#VBoxDrv_LDFLAGS = -s -t -v
449VBoxDrv_SOURCES = \
450 os2/SUPDrvA-os2.asm \
451 os2/SUPDrv-os2.def
452VBoxDrv_LIBS = \
453 $(VBoxDrvLib_1_TARGET) \
454 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
455 $(VBOX_GCC_LIBGCC) \
456 end
457
458# temp hack to ensure that SUPDrvA-os2.asm is first in the link.
459LIBRARIES += VBoxDrvLib
460VBoxDrvLib_TEMPLATE = VBOXR0DRV
461VBoxDrvLib_INSTTYPE = none
462VBoxDrvLib_DEFS = IN_RT_R0 IN_SUP_R0
463VBoxDrvLib_INCS := \
464 . \
465 $(PATH_ROOT)/src/VBox/Runtime/include
466VBoxDrvLib_SOURCES = \
467 os2/SUPDrv-os2.cpp \
468 SUPDrv.c \
469 SUPDrvSem.c
470
471endif # os2
472ifeq ($(KBUILD_TARGET),freebsd)
473
474#
475# vboxdrv.ko - The FreeBSD Kernel Module.
476#
477vboxdrv_TEMPLATE = VBOXR0DRV
478vboxdrv_DEFS = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
479vboxdrv_INCS := $(PATH_SUB_CURRENT)
480vboxdrv_LIBS = $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
481vboxdrv_SOURCES := \
482 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
483 $(PATH_SUB_CURRENT)/$(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).def \
484 SUPDrv.c \
485 SUPDrvSem.c
486## @todo the SUPDrv-freebsd.def is most probably gonna break it and require build system hacking...
487
488#
489# Targets for installing the freebsd sources.
490#
491vboxdrv-mod_INST = bin/src/vboxdrv/
492vboxdrv-mod_SOURCES = \
493 $(subst $(DQUOTE),,$(FILES_VBOXDRV_NOBIN)) \
494 $(vboxdrv-mod_0_OUTDIR)/Makefile
495vboxdrv-mod_CLEAN = \
496 $(vboxdrv-mod_0_OUTDIR)/Makefile
497
498$$(vboxdrv-mod_0_OUTDIR)/Makefile: \
499 $(PATH_SUB_CURRENT)/freebsd/Makefile \
500 $$(if $$(eq $$(Support/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
501 | $$(dir $$@)
502 $(call MSG_TOOL,Creating,,$@)
503 $(QUIET)$(RM) -f -- $@
504 ifndef VBOX_WITH_HARDENING
505 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
506 else
507 $(QUIET)$(CP) -f $< $@
508 endif
509
510endif # freebsd
511
512
513#
514# New VBoxDrv target. TODO: Convert all the above to use this!
515#
516if1of ($(KBUILD_TARGET), darwin linux solaris win)
517 ifdef VBOX_WITH_VBOXDRV
518 SYSMODS += VBoxDrv
519 endif
520 VBoxDrv_TEMPLATE = VBOXR0DRV
521 VBoxDrv_NAME.freebsd = vboxdrv
522 VBoxDrv_NAME.linux = vboxdrv
523 VBoxDrv_NAME.solaris = vboxdrv
524 ifdef VBOX_SIGNING_MODE
525 VBoxDrv_INSTTYPE.win = none
526 VBoxDrv_DEBUG_INSTTYPE.win = both
527 endif
528 VBoxDrv_INST.darwin = $(INST_VBOXDRV)Contents/MacOS/
529 VBoxDrv_DEBUG_INST.darwin= $(patsubst %/,%,$(INST_VBOXDRV))
530 VBoxDrv_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK) $(VBOX_WINPSDK)INCS
531
532 VBoxDrv_DEFS := IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
533 ifdef VBOX_WITH_DTRACE_R0DRV
534 VBoxDrv_DEFS += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R0DRV
535 endif
536 ifdef VBOX_WITHOUT_DEBUGGER_CHECKS
537 VBoxDrv_DEFS += VBOX_WITHOUT_DEBUGGER_CHECKS
538 endif
539 ifdef VBOX_PERMIT_VISUAL_STUDIO_PROFILING
540 VBoxDrv_DEFS += VBOX_PERMIT_VISUAL_STUDIO_PROFILING
541 endif
542 VBoxDrv_DEFS += VBOX_PERMIT_MORE
543 #VBoxDrv_DEFS.debug += DEBUG_DARWIN_GIP
544 VBoxDrv_DEFS.darwin := VBOX_WITH_HOST_VMX
545 VBoxDrv_DEFS.linux := \
546 KBUILD_MODNAME=KBUILD_STR\(vboxdrv\) KBUILD_BASENAME=KBUILD_STR\(vboxdrv\) MODULE CONFIG_VBOXDRV_AS_MISC
547 ifdef VBOX_LINUX_VERSION_2_4
548 VBoxDrv_DEFS.linux += EXPORT_SYMTAB
549 endif
550 ifdef VBOX_WITH_NETFLT
551 VBoxDrv_DEFS.solaris += VBOX_WITH_NETFLT
552 endif
553 ifdef VBOX_WITH_NATIVE_SOLARIS_LOADING
554 VBoxDrv_DEFS.solaris += VBOX_WITH_NATIVE_SOLARIS_LOADING
555 endif
556 ifdef VBOX_WITHOUT_NATIVE_R0_LOADER
557 VBoxDrv_DEFS.win += VBOX_WITHOUT_NATIVE_R0_LOADER
558 endif
559 ifdef VBOX_WITH_VISTA_NO_SP
560 VBoxDrv_DEFS.win += VBOX_WITH_VISTA_NO_SP
561 endif
562 ifdef VBOX_WITH_HARDENING
563 VBoxDrv_ASDEFS += VBOX_WITH_HARDENING
564 endif
565
566 VBoxDrv_INCS = . $(VBoxDrv_0_OUTDIR)
567 VBoxDrv_INCS.darwin = ./darwin
568 VBoxDrv_INCS.linux = $(PATH_ROOT)/src/VBox/Runtime/r0drv/linux
569
570 VBoxDrv_LIBS = $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
571 VBoxDrv_LIBS.linux.debug = $(VBoxDrv_LIBS) $(VBOX_GCC_LIBGCC)
572 VBoxDrv_LIBS.win = \
573 $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) \
574 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
575 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib
576
577 #VBoxDrv_LDFLAGS.darwin = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
578 VBoxDrv_LDFLAGS.solaris += -N misc/ctf
579 ifdef VBOX_WITH_NATIVE_DTRACE
580 VBoxDrv_LDFLAGS.solaris += -N drv/dtrace
581 endif
582 VBoxDrv_LDFLAGS.win.x86 = -Entry:DriverEntry@8
583 VBoxDrv_LDFLAGS.win.amd64= -Entry:DriverEntry
584
585 VBoxDrv_SOURCES.darwin = \
586 darwin/SUPDrv-darwin.cpp
587 VBoxDrv_SOURCES.linux = \
588 linux/SUPDrv-linux.c
589 VBoxDrv_SOURCES.solaris = \
590 solaris/SUPDrv-solaris.c
591 VBoxDrv_SOURCES.win = \
592 win/SUPDrv-win.cpp \
593 win/SUPDrvA-win.asm \
594 win/VBoxDrv.rc
595 ifdef VBOX_WITH_HARDENING
596 VBoxDrv_SOURCES.win += \
597 win/SUPHardenedVerifyImage-win.cpp \
598 win/SUPHardenedVerifyProcess-win.cpp \
599 $(VBOX_SUP_WIN_CERTS_FILE)
600 endif
601 VBoxDrv_SOURCES = \
602 SUPDrv.d \
603 SUPDrv.c \
604 SUPDrvSem.c \
605 SUPDrvTracer.cpp
606 ifdef VBOX_WITH_NATIVE_DTRACE
607 VBoxDrv_SOURCES += \
608 SUPDrv-dtrace.cpp
609 SUPDrv-dtrace.cpp_DEFS.darwin += VBOX_PATH_MACOSX_DTRACE_H=\"$(VBOX_PATH_MACOSX_SDK)/usr/include/sys/dtrace.h\"
610 endif
611 ifn1of ($(KBUILD_TARGET), linux freebsd)
612 VBoxDrv_SOURCES += \
613 SUPDrvTracerA.asm
614 endif
615 ifndef VBOX_LINUX_VERSION_2_4
616 VBoxDrv_SOURCES.linux += \
617 linux/SUPDrv-linux.mod.c
618 endif
619
620endif
621
622
623
624if1of ($(KBUILD_TARGET), darwin)
625 # Files necessary to make a darwin kernel extension bundle.
626 INSTALLS.darwin += VBoxDrv.kext
627 VBoxDrv.kext_INST = $(INST_VBOXDRV)Contents/
628 VBoxDrv.kext_SOURCES = $(VBoxDrv.kext_0_OUTDIR)/Info.plist
629 VBoxDrv.kext_CLEAN = $(VBoxDrv.kext_0_OUTDIR)/Info.plist
630
631$$(VBoxDrv.kext_0_OUTDIR)/Info.plist: \
632 $(PATH_SUB_CURRENT)/darwin/Info.plist \
633 $(VBOX_VERSION_MK) | $$(dir $$@)
634 $(call MSG_GENERATE,VBoxDrv,$@,$<)
635 $(QUIET)$(RM) -f $@
636 $(QUIET)$(SED) \
637 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
638 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
639 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
640 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
641 -e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
642 -e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
643 -e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
644 --output $@ \
645 $<
646endif
647
648
649if1of ($(KBUILD_TARGET), darwin solaris)
650 # Common manual loader script.
651 INSTALLS += SUPDrvScripts
652 SUPDrvScripts_INST = $(INST_DIST)
653 SUPDrvScripts_EXEC_SOURCES = \
654 $(KBUILD_TARGET)/load.sh
655endif
656
657
658if1of ($(KBUILD_TARGET), linux)
659 #
660 # Targets for installing the linux sources.
661 #
662 vboxdrv-mod_INST = bin/src/vboxdrv/
663 vboxdrv-mod_SOURCES = \
664 $(subst $(DQUOTE),,$(FILES_VBOXDRV_NOBIN)) \
665 $(vboxdrv-mod_0_OUTDIR)/Makefile
666 vboxdrv-mod_EXEC_SOURCES = \
667 $(subst $(DQUOTE),,$(FILES_VBOXDRV_BIN)) \
668 $(PATH_ROOT)/src/VBox/HostDrivers/linux/do_Module.symvers
669 vboxdrv-mod_CLEAN = \
670 $(vboxdrv-mod_0_OUTDIR)/Makefile \
671 $(PATH_TARGET)/vboxdrv-mod-1.dep \
672
673 # Scripts needed for building the kernel modules
674 includedep $(PATH_TARGET)/vboxdrv-mod-1.dep
675 $$(vboxdrv-mod_0_OUTDIR)/Makefile: \
676 $(PATH_SUB_CURRENT)/linux/Makefile \
677 $$(if $$(eq $$(Support/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
678 | $$(dir $$@)
679 $(call MSG_TOOL,Creating,,$@)
680 ifndef VBOX_WITH_HARDENING
681 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
682 else
683 $(QUIET)$(CP) -f $< $@
684 endif
685 %$(QUIET2)$(APPEND) -t '$(PATH_TARGET)/vboxdrv-mod-1.dep' 'Support/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
686endif # real linux
687
688
689ifeq ($(KBUILD_TARGET), win)
690 INSTALLS.win += VBoxDrv-inf
691 VBoxDrv-inf_INST = $(INST_BIN)
692 VBoxDrv-inf_MODE = a+r,u+w
693 VBoxDrv-inf_SOURCES = \
694 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf
695 VBoxDrv-inf_CLEAN = $(VBoxDrv-inf_SOURCES)
696 VBoxDrv-inf_BLDDIRS = $(PATH_TARGET)/VBoxDrvCat.dir
697
698 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf: $(PATH_SUB_CURRENT)/win/VBoxDrv.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
699 $(call MSG_GENERATE,VBoxDrv-inf,$@,$<)
700 $(call VBOX_EDIT_INF_FN,$<,$@)
701
702 ifdef VBOX_SIGNING_MODE
703 VBoxDrv-inf_SOURCES += \
704 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys \
705 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat
706
707 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys: $$(VBoxDrv_1_TARGET) | $$(dir $$@)
708 $(INSTALL) -m 644 $< $(@D)
709
710 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.cat: \
711 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.inf \
712 $(PATH_TARGET)/VBoxDrvCat.dir/VBoxDrv.sys
713 $(call MSG_TOOL,Inf2Cat,VBoxDrv-inf,$@,$<)
714 $(call VBOX_MAKE_CAT_FN, $(@D),$@)
715 endif # signing
716endif # win
717
718
719endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
720include $(FILE_KBUILD_SUB_FOOTER)
721
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