1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
# $Id: Makefile.kmk $
## @file
# Makefile for the Cross Platform Guest Additions Driver.
#
#
# Copyright (C) 2007-2012 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
SUB_DEPTH = ../../../../..
include $(KBUILD_PATH)/subheader.kmk
if1of ($(KBUILD_TARGET), darwin freebsd haiku $(if $(defined VBOX_WITH_ADDITION_DRIVERS),linux,) os2 solaris win)
#
# VBoxGuest - The Guest Additions Driver.
#
SYSMODS += VBoxGuest
VBoxGuest_TEMPLATE = VBOXGUESTR0
VBoxGuest_NAME.freebsd = vboxguest
VBoxGuest_NAME.haiku = vboxguest
VBoxGuest_NAME.linux = vboxguest
VBoxGuest_NAME.solaris = vboxguest
VBoxGuest_INST.darwin = $(INST_ADDITIONS)VBoxGuest.kext/Contents/MacOS/
ifdef VBOX_SIGN_ADDITIONS # See Additions/WINNT/Makefile.kmk?
VBoxGuest_INSTTYPE.win = none
VBoxGuest_DEBUG_INSTTYPE.win = both
endif
VBoxGuest_DEFS.haiku = VBOX_SVN_REV=$(VBOX_SVN_REV) _KERNEL_MODE=1
VBoxGuest_DEFS.linux = KBUILD_MODNAME=KBUILD_STR\(vboxguest\) KBUILD_BASENAME=KBUILD_STR\(vboxguest\) DEBUG_HASH=2 DEBUG_HASH2=3 EXPORT_SYMTAB
VBoxGuest_DEFS.solaris = VBOX_SVN_REV=$(VBOX_SVN_REV)
VBoxGuest_DEFS.win = # VBOX_WITH_VRDP_SESSION_HANDLING
VBoxGuest_DEFS.darwin = VBOX_GUESTDRV_WITH_RELEASE_LOGGER
ifeq ($(KBUILD_TYPE),release)
# Allow stopping/removing the driver without a reboot
# in debug mode; this is very useful for testing the shutdown stuff!
VBoxGuest_DEFS.win += VBOX_REBOOT_ON_UNINSTALL
endif
ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION
VBoxGuest_DEFS.win += VBOX_WITH_GUEST_BUGCHECK_DETECTION
endif
#VBoxGuest_DEFS.win += LOG_ENABLED LOG_TO_BACKDOOR
VBoxGuest_DEFS.win += \
$(if $(VBOX_WITH_DPC_LATENCY_CHECKER),VBOX_WITH_DPC_LATENCY_CHECKER,)
VBoxGuest_DEPS.solaris += $(VBOX_SVN_REV_KMK)
VBoxGuest_DEPS.linux += $(VBOX_SVN_REV_HEADER)
VBoxGuest_DEPS.haiku += $(VBOX_SVN_REV_HEADER)
VBoxGuest_DEPS.freebsd += $(VBOX_SVN_REV_HEADER)
VBoxGuest_DEPS.darwin += $(VBOX_SVN_REV_HEADER)
VBoxGuest_DEFS = VBGL_VBOXGUEST VBOX_WITH_HGCM
VBoxGuest_INCS = .
VBoxGuest_INCS.freebsd = $(VBoxGuest_0_OUTDIR) $(PATH_STAGE)/gen-sys-hdrs
VBoxGuest_INCS.linux = ../../../Runtime/r0drv/linux
ifeq ($(KBUILD_HOST),solaris)
VBoxGuest_LDFLAGS.solaris += -N misc/ctf
else
VBoxGuest_SOURCES.solaris = solaris/deps.asm
VBoxGuest_solaris/deps.asm_ASFLAGS = -f bin -g null
endif
ifneq ($(KBUILD_TARGET),os2)
ifeq ($(KBUILD_TARGET),win)
VBoxGuest_LDFLAGS.x86 = -Entry:DriverEntry@8
VBoxGuest_LDFLAGS.amd64 = -Entry:DriverEntry
VBoxGuest_LIBS = \
$(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/ntoskrnl.lib \
$(PATH_SDK_$(VBOX_WINDDK_GST)_LIB)/hal.lib
ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION
VBoxGuest_LIBS += \
$(PATH_SDK_$(VBOX_WINDDK_GST_WLH)_LIB)/aux_klib.lib \
$(PATH_SDK_$(VBOX_WINDDK_GST_WLH)_LIB)/ksecdd.lib \
$(PATH_SDK_$(VBOX_WINDDK_GST_WLH)_LIB)/BufferOverflowK.lib
VBoxGuest.cpp_SDKS = $(VBOX_WINDDK_GST_WLH)
endif
endif # win
ifn1of ($(KBUILD_TARGET), linux freebsd solaris haiku)
VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).cpp
else
VBoxGuest_SOURCES = VBoxGuest-$(KBUILD_TARGET).c
endif
VBoxGuest_SOURCES += \
VBoxGuest.cpp \
VBoxGuest2.cpp
ifeq ($(KBUILD_TARGET), win)
VBoxGuest_SOURCES += \
VBoxGuest-$(KBUILD_TARGET)-pnp.cpp \
win/VBoxGuest.rc
endif
VBoxGuest_LIBS += \
$(VBOX_LIB_VBGL_R0BASE) \
$(VBOX_LIB_IPRT_GUEST_R0)
VBoxGuest_ORDERDEPS.freebsd = \
$(PATH_STAGE)/gen-sys-hdrs/pci_if.h \
$(PATH_STAGE)/gen-sys-hdrs/bus_if.h \
$(PATH_STAGE)/gen-sys-hdrs/device_if.h
ifeq ($(KBUILD_TARGET),haiku)
# Haiku drivers cannot export symbols for other drivers, but modules can.
# Therefore vboxguest is a module containing the ring-0 guest lib, and vboxdev/vboxsf
# use this module to access the guest lib
SYSMODS += VBoxDev
VBoxDev_TEMPLATE = VBOXGUESTR0
VBoxDev_NAME = vboxdev
VBoxDev_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV) _KERNEL_MODE=1 VBGL_VBOXGUEST VBOX_WITH_HGCM IN_RING0
VBoxDev_SOURCES = VBoxDev-haiku.c VBoxGuest-haiku-stubs.c
endif
else # OS/2:
# The library order is crucial, so a bit of trickery is necessary.
# A library is used to make sure that VBoxGuestA-os2.asm is first in the link. (temporary hack?)
VBoxGuest_SOURCES = \
VBoxGuestA-os2.asm \
VBoxGuest-os2.def
#VBoxGuest_LDFLAGS = -s -t -v
VBoxGuest_LIBS = \
$(TARGET_VBoxGuestLibOs2Hack) \
$(VBOX_LIB_VBGL_R0BASE) \
$(VBOX_LIB_IPRT_GUEST_R0) \
$(VBOX_GCC_LIBGCC) \
end
## When debugging init with kDrvTest:
#VBoxGuest_NAME = VBoxGst
# see
LIBRARIES += VBoxGuestLibOs2Hack
VBoxGuestLibOs2Hack_TEMPLATE = VBOXGUESTR0LIB
VBoxGuestLibOs2Hack_INSTTYPE = none
VBoxGuestLibOs2Hack_DEFS = $(VBoxGuest_DEFS)
VBoxGuestLibOs2Hack_INCS = \
. \
$(PATH_ROOT)/src/VBox/Runtime/include # for the os2ddk
VBoxGuestLibOs2Hack_SOURCES = \
VBoxGuest-os2.cpp \
VBoxGuest.cpp \
VBoxGuest2.cpp
endif # OS/2
VBoxGuest2.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
VBoxGuest.cpp_DEFS = VBOX_SVN_REV=$(VBOX_SVN_REV)
ifeq ($(KBUILD_TARGET),win)
#
# Windows NT4 driver.
#
SYSMODS.x86 += VBoxGuestNT
VBoxGuestNT_EXTENDS = VBoxGuest
VBoxGuestNT_INSTTYPE.win = both
VBoxGuestNT_SDKS = ReorderCompilerIncs $(VBOX_WINDDK_GST_NT4)
VBoxGuestNT_DEFS = $(VBoxGuest_DEFS) TARGET_NT4
VBoxGuestNT_SOURCES = \
VBoxGuest.cpp \
VBoxGuest2.cpp \
VBoxGuest-$(KBUILD_TARGET).cpp \
VBoxGuest-$(KBUILD_TARGET)-legacy.cpp \
win/VBoxGuest.rc
VBoxGuestNT_LIBS = \
$(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/exsup.lib \
$(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/ntoskrnl.lib \
$(PATH_SDK_$(VBOX_WINDDK_GST_NT4)_LIB)/hal.lib \
$(VBOX_LIB_VBGL_R0BASE) \
$(VBOX_LIB_IPRT_GUEST_R0_NT4)
endif # win
endif # enabled
ifeq ($(KBUILD_TARGET), darwin)
# Files necessary to make a darwin kernel extension bundle.
INSTALLS += VBoxGuest.kext
VBoxGuest.kext_INST = $(INST_ADDITIONS)/VBoxGuest.kext/Contents/
VBoxGuest.kext_SOURCES = $(VBoxGuest.kext_0_OUTDIR)/Info.plist
VBoxGuest.kext_CLEAN = $(VBoxGuest.kext_0_OUTDIR)/Info.plist
$$(VBoxGuest.kext_0_OUTDIR)/Info.plist: \
$(PATH_SUB_CURRENT)/darwin/Info.plist \
$(VBOX_VERSION_MK) | $$(dir $$@)
$(call MSG_GENERATE,VBoxGuest,$@,$<)
$(QUIET)$(RM) -f $@
$(QUIET)$(SED) \
-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
--output $@ \
$<
endif # darwin
ifeq ($(KBUILD_TARGET),linux)
#
# Install the source files and script(s).
#
include $(PATH_SUB_CURRENT)/linux/files_vboxguest
# sources and stuff.
INSTALLS += vboxguest-src
vboxguest-src_INST = $(INST_ADDITIONS)src/vboxguest/
vboxguest-src_MODE = a+r,u+w
vboxguest-src_SOURCES = $(subst ",,$(FILES_VBOXGUEST_NOBIN))
INSTALLS += vboxguest-conf
vboxguest-conf_INST = $(INST_ADDITIONS)src/
vboxguest-conf_MODE = a+r,u+w
vboxguest-conf_SOURCES = $(vboxguest-sh_0_OUTDIR)/dkms.conf
vboxguest-conf_CLEAN = $(vboxguest-sh_0_OUTDIR)/dkms.conf
INSTALLS += vboxguest-scripts
vboxguest-scripts_INST = $(INST_ADDITIONS)src/
vboxguest-scripts_MODE = a+rx,u+w
vboxguest-scripts_SOURCES = ../../../HostDrivers/linux/do_dkms \
../../../HostDrivers/linux/build_in_tmp
$$(vboxguest-sh_0_OUTDIR)/dkms.conf: \
$(PATH_SUB_CURRENT)/linux/dkms.conf \
$(VBOX_VERSION_STAMP) \
| $$(dir $$@)
$(call MSG_TOOL,Creating,,$@)
$(QUIET)$(SED) \
-e "s;_VERSION_;${VBOX_VERSION_STRING};g" \
-e "s;_BUILDTYPE_;$(KBUILD_TYPE);g" \
--output $@ $<
# scripts.
INSTALLS += vboxguest-sh
vboxguest-sh_INST = $(INST_ADDITIONS)src/vboxguest/
vboxguest-sh_MODE = a+rx,u+w
vboxguest-sh_SOURCES = $(subst ",,$(FILES_VBOXGUEST_BIN))
vboxguest-sh_SOURCES += $(PATH_ROOT)/src/VBox/HostDrivers/linux/do_Module.symvers
endif # Linux
ifeq ($(KBUILD_TARGET),freebsd)
#
# Install the source files and script(s).
#
include $(PATH_SUB_CURRENT)/freebsd/files_vboxguest
# sources and stuff.
INSTALLS += vboxguest-src
vboxguest-src_INST = $(INST_ADDITIONS)src/vboxguest/
vboxguest-src_MODE = a+r,u+w
vboxguest-src_SOURCES = $(subst ",,$(FILES_VBOXGUEST_NOBIN))
endif # FreeBSD
ifeq ($(KBUILD_TARGET),win)
#
# VBoxGuestInst - The installer.
#
#PROGRAMS += VBoxGuestInst
VBoxGuestInst_TEMPLATE= NewVBoxGuestR3Exe
VBoxGuestInst_SOURCES = win/VBoxGuestInst.cpp
endif
include $(FILE_KBUILD_SUB_FOOTER)
|