Changeset 36584 in vbox for trunk/src/VBox/Additions/linux
- Timestamp:
- Apr 6, 2011 2:41:38 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71024
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/Makefile.module
r36293 r36584 4 4 # (For 2.6.x this file must be 'Makefile'!) 5 5 # 6 # Copyright (C) 2006-201 0Oracle Corporation6 # Copyright (C) 2006-2011 Oracle Corporation 7 7 # 8 8 # This file is part of VirtualBox Open Source Edition (OSE), as … … 15 15 # 16 16 17 # 18 # First, figure out which architecture we're targeting and the build type. 19 # (We have to support basic cross building (ARCH=i386|x86_64).) 20 # While at it, warn about BUILD_* vars found to help with user problems. 21 # 22 ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),) 23 BUILD_TARGET_ARCH_DEF := amd64 24 else 25 BUILD_TARGET_ARCH_DEF := x86 26 endif 27 ifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),) 28 $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.) 29 BUILD_TARGET_ARCH := 30 endif 31 ifeq ($(BUILD_TARGET_ARCH),) 32 ifeq ($(ARCH),x86_64) 33 BUILD_TARGET_ARCH := amd64 34 else 35 ifeq ($(ARCH),i386) 36 BUILD_TARGET_ARCH := x86 37 else 38 BUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH_DEF) 39 endif 40 endif 41 else 42 ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF)) 43 $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).) 44 endif 45 endif 17 # Linux kbuild sets this to our source directory if we are called from there 18 obj ?= $(CURDIR) 19 include $(obj)/Makefile.include.header 46 20 47 ifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),) 48 $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.) 49 BUILD_TYPE := 50 endif 51 ifeq ($(BUILD_TYPE),) 52 BUILD_TYPE := release 53 else 54 ifneq ($(BUILD_TYPE),release) 55 $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).) 56 endif 57 endif 58 59 60 # override is required by the Debian guys 61 override MODULE = vboxsf 62 OBJS = \ 21 MOD_NAME = vboxsf 22 MOD_OBJS = \ 63 23 vfsmod.o \ 64 24 dirops.o \ … … 75 35 VbglR0CanUsePhysPageList.o 76 36 ifeq ($(BUILD_TARGET_ARCH),x86) 77 OBJS += \37 MOD_OBJS += \ 78 38 divdi3.o \ 79 39 moddi3.o \ … … 83 43 endif 84 44 85 EXTRA_CFLAGS = -fshort-wchar 45 MOD_INCL = \ 46 $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) \ 47 $(addprefix -I$(KBUILD_EXTMOD)/vboxsf,/ /include /r0drv/linux) 86 48 87 ifneq ($(MAKECMDGOALS),clean)88 89 ifeq ($(KERNELRELEASE),)90 91 #92 # building from this directory93 #94 95 # kernel base directory96 ifndef KERN_DIR97 KERN_DIR := /lib/modules/$(shell uname -r)/build98 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)99 KERN_DIR := /usr/src/linux100 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)101 $(error Error: unable to find the sources of your current Linux kernel. \102 Specify KERN_DIR=<directory> and run Make again)103 endif104 $(warning Warning: using /usr/src/linux as the source directory of your \105 Linux kernel. If this is not correct, specify \106 KERN_DIR=<directory> and run Make again.)107 endif108 else109 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)110 $(error Error: KERN_DIR does not point to a directory)111 endif112 endif113 114 # includes115 ifndef KERN_INCL116 KERN_INCL = $(KERN_DIR)/include117 endif118 ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)119 $(error Error: unable to find the include directory for your current Linux \120 kernel. Specify KERN_INCL=<directory> and run Make again)121 endif122 123 # module install dir.124 ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)125 ifndef MODULE_DIR126 MODULE_DIR_TST := /lib/modules/$(shell uname -r)127 ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)128 MODULE_DIR := $(MODULE_DIR_TST)/misc129 else130 $(error Unable to find the folder to install the shared folders driver to)131 endif132 endif # MODULE_DIR unspecified133 endif134 135 # guess kernel version (24 or 26)136 ifeq ($(shell if grep '"2\.4\.' $(KERN_INCL)/linux/version.h > /dev/null; then echo yes; fi),yes)137 KERN_VERSION := 24138 else139 KERN_VERSION := 26140 endif141 142 else # neq($(KERNELRELEASE),)143 144 #145 # building from kbuild (make -C <kernel_directory> M=`pwd`)146 #147 148 # guess kernel version (24 or 26)149 ifeq ($(shell if echo "$(VERSION).$(PATCHLEVEL)." | grep '2\.4\.' > /dev/null; then echo yes; fi),yes)150 KERN_VERSION := 24151 else152 KERN_VERSION := 26153 endif154 155 endif # neq($(KERNELRELEASE),)156 157 # debug - show guesses.158 ifdef DEBUG159 $(warning dbg: KERN_DIR = $(KERN_DIR))160 $(warning dbg: KERN_INCL = $(KERN_INCL))161 $(warning dbg: MODULE_DIR = $(MODULE_DIR))162 $(warning dbg: KERN_VERSION = $(KERN_VERSION))163 endif164 165 KBUILD_VERBOSE ?= 1166 167 #168 # Compiler options169 #170 ifndef INCL171 INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))172 ifndef KBUILD_EXTMOD173 KBUILD_EXTMOD := $(shell pwd)174 endif175 INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)176 INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxsf,/ /include /r0drv/linux)177 export INCL178 endif179 49 ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxsf),) 180 50 MANGLING := $(KBUILD_EXTMOD)/vboxsf/include/VBox/VBoxGuestMangling.h … … 182 52 MANGLING := $(KBUILD_EXTMOD)/include/VBox/VBoxGuestMangling.h 183 53 endif 184 KFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \ 54 55 MOD_DEFS = -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \ 185 56 -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DIN_MODULE -DIN_GUEST_R0 186 57 # our module does not export any symbol 187 KFLAGS+= -DRT_NO_EXPORT_SYMBOL58 MOD_DEFS += -DRT_NO_EXPORT_SYMBOL 188 59 ifeq ($(BUILD_TARGET_ARCH),amd64) 189 KFLAGS+= -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS60 MOD_DEFS += -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS 190 61 else 191 KFLAGS += -DRT_ARCH_X86 192 endif 193 ifeq ($(BUILD_TYPE),debug) 194 KFLAGS += -DDEBUG 62 MOD_DEFS += -DRT_ARCH_X86 195 63 endif 196 64 197 65 ifeq ($(KERN_VERSION), 24) 198 # 199 # 2.4 200 # 201 202 ifeq ($(BUILD_TARGET_ARCH),amd64) 203 KFLAGS += -mcmodel=kernel 204 endif 205 206 CFLAGS := -O2 -DVBOX_LINUX_2_4 $(INCL) $(KFLAGS) $(KDEBUG) 207 MODULE_EXT := o 208 209 # 2.4 Module linking 210 $(MODULE).o: $(OBJS) 211 $(LD) -o $@ -r $(OBJS) 212 213 .PHONY: $(MODULE) 214 all: $(MODULE) 215 $(MODULE): $(MODULE).o 216 66 MOD_CFLAGS = 217 67 else 218 # 219 # 2.6 and later 220 # 221 222 MODULE_EXT := ko 223 224 $(MODULE)-y := $(OBJS) 68 MOD_CFLAGS = -fshort-wchar -include $(MANGLING) 225 69 226 70 # special hack for Fedora Core 6 2.6.18 (fc6), rhel5 2.6.18 (el5), 227 71 # ClarkConnect 4.3 (cc4) and ClarkConnect 5 (v5) 228 ifeq ($(KERNELRELEASE),)229 KFLAGS+= $(foreach inc,$(KERN_INCL),\230 $(if $(wildcard $(inc)/linux/utsrelease.h),\231 $(if $(shell grep '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h; \72 ifeq ($(KERNELRELEASE),) 73 MOD_EXTRA += $(foreach inc,$(KERN_INCL),\ 74 $(if $(wildcard $(inc)/linux/utsrelease.h),\ 75 $(if $(shell grep '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h; \ 232 76 grep '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h; \ 233 77 grep '"2.6.18.*v5.*"' $(inc)/linux/utsrelease.h; \ 234 78 grep '"2.6.18.*cc4.*"' $(inc)/linux/utsrelease.h),\ 235 79 -DKERNEL_FC6,),)) 236 else237 KFLAGS+= $(if $(shell echo "$(KERNELRELEASE)"|grep '2.6.18.*fc6.*';\80 else 81 MOD_EXTRA += $(if $(shell echo "$(KERNELRELEASE)"|grep '2.6.18.*fc6.*';\ 238 82 echo "$(KERNELRELEASE)"|grep '2.6.18.*el5.*';\ 239 83 echo "$(KERNELRELEASE)"|grep '2.6.18.*v5.*';\ 240 84 echo "$(KERNELRELEASE)"|grep '2.6.18.*cc4.*'),\ 241 85 -DKERNEL_FC6,) 86 endif 242 87 endif 243 88 244 # build defs 245 EXTRA_CFLAGS += -include $(MANGLING) $(INCL) $(KFLAGS) $(KDEBUG) 89 MOD_CLEAN = . linux r0drv r0drv/linux 246 90 247 all: $(MODULE) 248 249 obj-m += $(MODULE).o 250 251 $(MODULE): 252 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules 253 254 endif 255 256 install: $(MODULE) 257 @mkdir -p $(MODULE_DIR); \ 258 install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \ 259 PATH="$(PATH):/bin:/sbin" depmod -a; 260 261 endif # eq($(MAKECMDGOALS),clean) 262 263 # important: Don't remove Module.symvers! DKMS does 'make clean' before building ... 264 clean: 265 for f in . linux r0drv r0drv/linux; do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done 266 rm -rf .vboxsf* .tmp_ver* vboxsf.* Modules.symvers modules.order 91 include $(obj)/Makefile.include.footer -
trunk/src/VBox/Additions/linux/sharedfolders/files_vboxsf
r36190 r36584 65 65 ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuestLib/VMMDev.cpp=>VMMDev.c \ 66 66 ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuestLib/VbglR0CanUsePhysPageList.cpp=>VbglR0CanUsePhysPageList.c \ 67 ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.header \ 68 ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.footer \ 67 69 ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/divdi3.c=>divdi3.c \ 68 70 ${PATH_ROOT}/src/VBox/Runtime/common/math/gcc/moddi3.c=>moddi3.c \
Note:
See TracChangeset
for help on using the changeset viewer.