Changeset 36510 in vbox for trunk/src/VBox/Additions/common/VBoxGuest
- Timestamp:
- Apr 1, 2011 3:37:35 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest/linux
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/linux/Makefile
r36408 r36510 5 5 6 6 # 7 # Copyright (C) 2006-201 0Oracle Corporation7 # Copyright (C) 2006-2011 Oracle Corporation 8 8 # 9 9 # This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 # 17 17 18 # 19 # First, figure out which architecture we're targeting and the build type. 20 # (We have to support basic cross building (ARCH=i386|x86_64).) 21 # While at it, warn about BUILD_* vars found to help with user problems. 22 # 23 ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),) 24 BUILD_TARGET_ARCH_DEF := amd64 25 else 26 BUILD_TARGET_ARCH_DEF := x86 27 endif 28 ifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),) 29 $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.) 30 BUILD_TARGET_ARCH := 31 endif 32 ifeq ($(BUILD_TARGET_ARCH),) 33 ifeq ($(ARCH),x86_64) 34 BUILD_TARGET_ARCH := amd64 35 else 36 ifeq ($(ARCH),i386) 37 BUILD_TARGET_ARCH := x86 38 else 39 BUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH_DEF) 40 endif 41 endif 42 else 43 ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF)) 44 $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).) 45 endif 46 endif 18 # Linux kbuild sets this to our source directory if we are called from there 19 obj ?= $(CURDIR) 20 include $(obj)/Makefile.include.header 47 21 48 ifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),) 49 $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.) 50 BUILD_TYPE := 51 endif 52 ifeq ($(BUILD_TYPE),) 53 BUILD_TYPE := release 54 else 55 ifneq ($(BUILD_TYPE),release) 56 $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).) 57 endif 58 endif 22 MOD_NAME = vboxguest 59 23 60 61 # override is required by the Debian guys 62 override MODULE = vboxguest 63 OBJS = \ 24 MOD_OBJS = \ 64 25 VBoxGuest-linux.o \ 65 26 VBoxGuest.o \ … … 130 91 VBox/logbackdoor.o 131 92 ifeq ($(BUILD_TARGET_ARCH),x86) 132 OBJS += \93 MOD_OBJS += \ 133 94 common/math/gcc/divdi3.o \ 134 95 common/math/gcc/moddi3.o \ … … 138 99 endif 139 100 ifeq ($(BUILD_TARGET_ARCH),amd64) 140 OBJS += common/alloc/heapsimple.o101 MOD_OBJS += common/alloc/heapsimple.o 141 102 endif 142 103 143 ifneq ($(MAKECMDGOALS),clean) 104 MOD_DEFS = -DIN_GUEST -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM 105 ifeq ($(BUILD_TARGET_ARCH),amd64) 106 MOD_DEFS += -DRT_ARCH_AMD64 107 else 108 MOD_DEFS += -DRT_ARCH_X86 109 endif 110 ifeq ($(BUILD_TARGET_ARCH),amd64) 111 MOD_DEFS += -DVBOX_WITH_64_BITS_GUESTS 112 endif 113 MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) 114 MOD_INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxguest,/ /include /r0drv/linux) 144 115 145 ifeq ($(KERNELRELEASE),)146 147 #148 # building from this directory149 #150 151 # kernel base directory152 ifndef KERN_DIR153 KERN_DIR := /lib/modules/$(shell uname -r)/build154 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)155 KERN_DIR := /usr/src/linux156 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)157 $(error Error: unable to find the sources of your current Linux kernel. \158 Specify KERN_DIR=<directory> and run Make again)159 endif160 $(warning Warning: using /usr/src/linux as the source directory of your \161 Linux kernel. If this is not correct, specify \162 KERN_DIR=<directory> and run Make again.)163 endif164 else165 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)166 $(error Error: KERN_DIR does not point to a directory)167 endif168 endif169 170 # includes171 ifndef KERN_INCL172 KERN_INCL = $(KERN_DIR)/include173 endif174 ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)175 $(error Error: unable to find the include directory for your current Linux \176 kernel. Specify KERN_INCL=<directory> and run Make again)177 endif178 179 # module install dir, only for current kernel180 ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)181 ifndef MODULE_DIR182 MODULE_DIR_TST := /lib/modules/$(shell uname -r)183 ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)184 MODULE_DIR := $(MODULE_DIR_TST)/misc185 else186 $(error Unable to find the folder to install the additions driver to)187 endif188 endif # MODULE_DIR unspecified189 endif190 191 # guess kernel version (24 or 26)192 ifeq ($(shell if grep '"2\.4\.' $(KERN_INCL)/linux/version.h > /dev/null; then echo yes; fi),yes)193 KERN_VERSION := 24194 else195 KERN_VERSION := 26196 endif197 198 else # neq($(KERNELRELEASE),)199 200 #201 # building from kbuild (make -C <kernel_directory> M=`pwd`)202 #203 204 # guess kernel version (24 or 26)205 ifeq ($(shell if echo "$(VERSION).$(PATCHLEVEL)." | grep '2\.4\.' > /dev/null; then echo yes; fi),yes)206 KERN_VERSION := 24207 else208 KERN_VERSION := 26209 endif210 211 endif # neq($(KERNELRELEASE),)212 213 # debug - show guesses.214 ifdef DEBUG215 $(warning dbg: KERN_DIR = $(KERN_DIR))216 $(warning dbg: KERN_INCL = $(KERN_INCL))217 $(warning dbg: MODULE_DIR = $(MODULE_DIR))218 $(warning dbg: KERN_VERSION = $(KERN_VERSION))219 endif220 221 KBUILD_VERBOSE ?= 1222 223 #224 # Compiler options225 #226 ifndef INCL227 INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))228 ifndef KBUILD_EXTMOD229 KBUILD_EXTMOD := $(shell pwd)230 endif231 INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)232 INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxguest,/ /include /r0drv/linux)233 export INCL234 endif235 116 ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxguest),) 236 117 MANGLING := $(KBUILD_EXTMOD)/vboxguest/include/VBox/VBoxGuestMangling.h … … 238 119 MANGLING := $(KBUILD_EXTMOD)/include/VBox/VBoxGuestMangling.h 239 120 endif 240 KFLAGS := -D__KERNEL__ -DMODULE \ 241 -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST -DIN_GUEST_R0 \ 242 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST -DVBOX_WITH_HGCM 243 ifeq ($(BUILD_TARGET_ARCH),amd64) 244 KFLAGS += -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS 121 ifeq ($(KERN_VERSION),24) 122 MOD_CFLAGS = 245 123 else 246 KFLAGS += -DRT_ARCH_X86 247 endif 248 ifeq ($(BUILD_TYPE),debug) 249 KFLAGS += -DDEBUG 124 MOD_CFLAGS = -include $(MANGLING) 250 125 endif 251 126 252 ifeq ($(KERN_VERSION), 24) 253 # 254 # 2.4 255 # 127 MOD_CLEAN = . linux r0drv generic r0drv/linux r0drv/generic VBox \ 128 common/alloc common/err common/log common/math/gcc common/misc \ 129 common/string common/time 256 130 257 ifeq ($(BUILD_TARGET_ARCH),amd64) 258 KFLAGS += -mcmodel=kernel 259 endif 131 include $(obj)/Makefile.include.footer 260 132 261 CFLAGS := -O2 -DVBOX_LINUX_2_4 -DEXPORT_SYMTAB $(INCL) $(KFLAGS) $(KDEBUG) 262 MODULE_EXT := o 263 264 # 2.4 Module linking 265 $(MODULE).o: $(OBJS) 266 $(LD) -o $@ -r $(OBJS) 267 268 .PHONY: $(MODULE) 269 all: $(MODULE) 270 $(MODULE): $(MODULE).o 271 272 else 273 # 274 # 2.6 and later 275 # 276 277 MODULE_EXT := ko 278 279 $(MODULE)-y := $(OBJS) 280 281 # build defs 282 EXTRA_CFLAGS += -include $(MANGLING) $(INCL) $(KFLAGS) $(KDEBUG) 283 284 all: $(MODULE) 285 286 obj-m += $(MODULE).o 287 288 $(MODULE): 289 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules 290 291 endif 292 293 install: $(MODULE) 294 @mkdir -p $(MODULE_DIR); \ 295 install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \ 296 PATH="$(PATH):/bin:/sbin" depmod -a; 297 298 endif # eq($(MAKECMDGOALS),clean) 299 300 check: $(MODULE) 133 check: $(MOD_NAME) 301 134 @if ! readelf -p __ksymtab_strings vboxguest.ko | grep -E "\[.*\] *(RT|g_..*RT.*)"; then \ 302 135 echo "All exported IPRT symbols are properly renamed!"; \ … … 305 138 false; \ 306 139 fi 307 308 clean:309 for f in . linux r0drv generic r0drv/linux r0drv/generic VBox \310 common/alloc common/err common/log common/math/gcc common/misc common/string common/time; \311 do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done312 rm -rf .vboxguest* .tmp_ver* vboxguest.* Module.symvers Modules.symvers modules.order -
trunk/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest
r36408 r36510 82 82 ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestLog.h=>VBoxGuestLog.h \ 83 83 ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuestLib/VMMDev.cpp=>VMMDev.c \ 84 ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.header \ 85 ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.footer \ 84 86 ${PATH_ROOT}/src/VBox/Runtime/include/internal/assert.h=>include/internal/assert.h \ 85 87 ${PATH_ROOT}/src/VBox/Runtime/include/internal/initterm.h=>include/internal/initterm.h \
Note:
See TracChangeset
for help on using the changeset viewer.