1 | # $Id: Makefile 96814 2022-09-21 14:37:14Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Makefile for the VirtualBox Linux Host Driver.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2022 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 |
|
---|
37 | # Linux kbuild sets this to our source directory if we are called from there
|
---|
38 | obj ?= $(CURDIR)
|
---|
39 | include $(obj)/Makefile-header.gmk
|
---|
40 | VBOXDRV_DIR := $(VBOX_MODULE_SRC_DIR)
|
---|
41 |
|
---|
42 | VBOXMOD_NAME = vboxdrv
|
---|
43 | VBOXMOD_OBJS = \
|
---|
44 | linux/SUPDrv-linux.o \
|
---|
45 | SUPDrv.o \
|
---|
46 | SUPDrvGip.o \
|
---|
47 | SUPDrvSem.o \
|
---|
48 | SUPDrvTracer.o \
|
---|
49 | SUPLibAll.o \
|
---|
50 | common/string/strformatrt.o
|
---|
51 |
|
---|
52 | ifndef VBOX_WITHOUT_COMBINED_SOURCES
|
---|
53 | VBOXMOD_OBJS += \
|
---|
54 | combined-agnostic1.o \
|
---|
55 | combined-agnostic2.o \
|
---|
56 | combined-os-specific.o
|
---|
57 | else # VBOX_WITHOUT_COMBINED_SOURCES
|
---|
58 | VBOXMOD_OBJS += \
|
---|
59 | r0drv/alloc-r0drv.o \
|
---|
60 | r0drv/initterm-r0drv.o \
|
---|
61 | r0drv/memobj-r0drv.o \
|
---|
62 | r0drv/mpnotification-r0drv.o \
|
---|
63 | r0drv/powernotification-r0drv.o \
|
---|
64 | r0drv/linux/assert-r0drv-linux.o \
|
---|
65 | r0drv/linux/alloc-r0drv-linux.o \
|
---|
66 | r0drv/linux/initterm-r0drv-linux.o \
|
---|
67 | r0drv/linux/memobj-r0drv-linux.o \
|
---|
68 | r0drv/linux/memuserkernel-r0drv-linux.o \
|
---|
69 | r0drv/linux/mp-r0drv-linux.o \
|
---|
70 | r0drv/linux/mpnotification-r0drv-linux.o \
|
---|
71 | r0drv/linux/process-r0drv-linux.o \
|
---|
72 | r0drv/linux/rtStrFormatKernelAddress-r0drv-linux.o \
|
---|
73 | r0drv/linux/semevent-r0drv-linux.o \
|
---|
74 | r0drv/linux/semeventmulti-r0drv-linux.o \
|
---|
75 | r0drv/linux/semfastmutex-r0drv-linux.o \
|
---|
76 | r0drv/linux/semmutex-r0drv-linux.o \
|
---|
77 | r0drv/linux/spinlock-r0drv-linux.o \
|
---|
78 | r0drv/linux/thread-r0drv-linux.o \
|
---|
79 | r0drv/linux/thread2-r0drv-linux.o \
|
---|
80 | r0drv/linux/threadctxhooks-r0drv-linux.o \
|
---|
81 | r0drv/linux/time-r0drv-linux.o \
|
---|
82 | r0drv/linux/timer-r0drv-linux.o \
|
---|
83 | r0drv/generic/semspinmutex-r0drv-generic.o \
|
---|
84 | common/alloc/alloc.o \
|
---|
85 | common/checksum/crc32.o \
|
---|
86 | common/checksum/ipv4.o \
|
---|
87 | common/checksum/ipv6.o \
|
---|
88 | common/err/RTErrConvertFromErrno.o \
|
---|
89 | common/err/RTErrConvertToErrno.o \
|
---|
90 | common/err/errinfo.o \
|
---|
91 | common/log/log.o \
|
---|
92 | common/log/logellipsis.o \
|
---|
93 | common/log/logrel.o \
|
---|
94 | common/log/logrelellipsis.o \
|
---|
95 | common/log/logcom.o \
|
---|
96 | common/log/logformat.o \
|
---|
97 | common/log/RTLogCreateEx.o \
|
---|
98 | common/misc/RTAssertMsg1Weak.o \
|
---|
99 | common/misc/RTAssertMsg2.o \
|
---|
100 | common/misc/RTAssertMsg2Add.o \
|
---|
101 | common/misc/RTAssertMsg2AddWeak.o \
|
---|
102 | common/misc/RTAssertMsg2AddWeakV.o \
|
---|
103 | common/misc/RTAssertMsg2Weak.o \
|
---|
104 | common/misc/RTAssertMsg2WeakV.o \
|
---|
105 | common/misc/assert.o \
|
---|
106 | common/misc/handletable.o \
|
---|
107 | common/misc/handletablectx.o \
|
---|
108 | common/misc/thread.o \
|
---|
109 | common/string/RTStrCat.o \
|
---|
110 | common/string/RTStrCopy.o \
|
---|
111 | common/string/RTStrCopyEx.o \
|
---|
112 | common/string/RTStrCopyP.o \
|
---|
113 | common/string/RTStrEnd.o \
|
---|
114 | common/string/RTStrNCmp.o \
|
---|
115 | common/string/RTStrNLen.o \
|
---|
116 | common/string/stringalloc.o \
|
---|
117 | common/string/strformat.o \
|
---|
118 | common/string/RTStrFormat.o \
|
---|
119 | common/string/strformatnum.o \
|
---|
120 | common/string/strformattype.o \
|
---|
121 | common/string/strprintf.o \
|
---|
122 | common/string/strprintf-ellipsis.o \
|
---|
123 | common/string/strprintf2.o \
|
---|
124 | common/string/strprintf2-ellipsis.o \
|
---|
125 | common/string/strtonum.o \
|
---|
126 | common/table/avlpv.o \
|
---|
127 | common/time/time.o \
|
---|
128 | r0drv/linux/RTLogWriteDebugger-r0drv-linux.o \
|
---|
129 | generic/RTAssertShouldPanic-generic.o \
|
---|
130 | generic/RTLogWriteStdErr-stub-generic.o \
|
---|
131 | generic/RTLogWriteStdOut-stub-generic.o \
|
---|
132 | generic/RTLogWriteUser-generic.o \
|
---|
133 | generic/RTMpGetArraySize-generic.o \
|
---|
134 | generic/RTMpGetCoreCount-generic.o \
|
---|
135 | generic/RTSemEventWait-2-ex-generic.o \
|
---|
136 | generic/RTSemEventWaitNoResume-2-ex-generic.o \
|
---|
137 | generic/RTSemEventMultiWait-2-ex-generic.o \
|
---|
138 | generic/RTSemEventMultiWaitNoResume-2-ex-generic.o \
|
---|
139 | generic/RTTimerCreate-generic.o \
|
---|
140 | generic/errvars-generic.o \
|
---|
141 | generic/mppresent-generic.o \
|
---|
142 | generic/uuid-generic.o \
|
---|
143 | VBox/log-vbox.o \
|
---|
144 | VBox/RTLogWriteVmm-amd64-x86.o
|
---|
145 | ifeq ($(VBOX_KBUILD_TARGET_ARCH),amd64)
|
---|
146 | VBOXMOD_OBJS += common/alloc/heapsimple.o
|
---|
147 | endif
|
---|
148 | endif # VBOX_WITHOUT_COMBINED_SOURCES
|
---|
149 | ifeq ($(VBOX_KBUILD_TARGET_ARCH),x86)
|
---|
150 | VBOXMOD_OBJS += \
|
---|
151 | math/gcc/divdi3.o \
|
---|
152 | math/gcc/divmoddi4.o \
|
---|
153 | math/gcc/moddi3.o \
|
---|
154 | math/gcc/qdivrem.o \
|
---|
155 | math/gcc/udivdi3.o \
|
---|
156 | math/gcc/udivmoddi4.o \
|
---|
157 | math/gcc/divdi3.o \
|
---|
158 | math/gcc/umoddi3.o
|
---|
159 | endif
|
---|
160 | ifdef VBOX_WITH_NATIVE_DTRACE
|
---|
161 | VBOXMOD_OBJS += SUPDrvDTrace.o
|
---|
162 | endif
|
---|
163 |
|
---|
164 | VBOXMOD_INCL = \
|
---|
165 | $(VBOXDRV_DIR) \
|
---|
166 | $(VBOXDRV_DIR)include \
|
---|
167 | $(VBOXDRV_DIR)r0drv/linux
|
---|
168 | ifdef VBOX_WITH_NATIVE_DTRACE
|
---|
169 | VBOXMOD_INCL += \
|
---|
170 | /usr/include/linux \
|
---|
171 | /usr/include
|
---|
172 | endif
|
---|
173 |
|
---|
174 | VBOXMOD_DEFS = \
|
---|
175 | RT_OS_LINUX \
|
---|
176 | IN_RING0 \
|
---|
177 | IN_RT_R0 \
|
---|
178 | IN_SUP_R0 \
|
---|
179 | VBOX \
|
---|
180 | RT_WITH_VBOX \
|
---|
181 | VBOX_WITH_HARDENING \
|
---|
182 | SUPDRV_WITH_RELEASE_LOGGER \
|
---|
183 | VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV \
|
---|
184 | IPRT_WITHOUT_EFLAGS_AC_PRESERVING \
|
---|
185 | VBOX_WITH_64_BITS_GUESTS # <-- must be consistent with Config.kmk!
|
---|
186 | ifndef CONFIG_VBOXDRV_FIXEDMAJOR
|
---|
187 | VBOXMOD_DEFS += CONFIG_VBOXDRV_AS_MISC
|
---|
188 | endif
|
---|
189 | ifdef VBOX_WITH_NATIVE_DTRACE
|
---|
190 | VBOXMOD_DEFS += VBOX_WITH_NATIVE_DTRACE
|
---|
191 | endif
|
---|
192 | ifdef VBOX_WITH_TEXT_MODMEM_HACK
|
---|
193 | VBOXMOD_DEFS += RTMEMALLOC_EXEC_HEAP VBOX_WITH_TEXT_MODMEM_HACK
|
---|
194 | endif
|
---|
195 | VBOXMOD_CFLAGS = -include $(VBOXDRV_DIR)include/VBox/SUPDrvMangling.h \
|
---|
196 | -fno-omit-frame-pointer -fno-pie -Wno-declaration-after-statement
|
---|
197 |
|
---|
198 |
|
---|
199 | include $(obj)/Makefile-footer.gmk
|
---|
200 |
|
---|
201 | check: $(VBOXMOD_0_TARGET)
|
---|
202 | @if ! readelf -p __ksymtab_strings vboxdrv.ko | grep -E "\[.*\] *(RT|g_..*RT.*)"; then \
|
---|
203 | echo "All exported IPRT symbols are properly renamed!"; \
|
---|
204 | else \
|
---|
205 | echo "error: Some exported IPRT symbols was not properly renamed! See above." >&2; \
|
---|
206 | false; \
|
---|
207 | fi
|
---|
208 |
|
---|