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