Changeset 36602 in vbox for trunk/src/VBox/Additions/linux/drm
- Timestamp:
- Apr 6, 2011 9:41:35 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71047
- Location:
- trunk/src/VBox/Additions/linux/drm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/Makefile.module
r36293 r36602 15 15 # 16 16 17 ## @todo We must make this into a common template *soon*. 17 # Linux kbuild sets this to our source directory if we are called from there 18 obj ?= $(CURDIR) 19 include $(obj)/Makefile.include.header 18 20 19 # 20 # First, figure out which architecture we're targeting and the build type. 21 # (We have to support basic cross building (ARCH=i386|x86_64).) 22 # While at it, warn about BUILD_* vars found to help with user problems. 23 # 24 ifeq ($(filter-out x86_64 amd64 AMD64,$(shell uname -m)),) 25 BUILD_TARGET_ARCH_DEF := amd64 26 else 27 BUILD_TARGET_ARCH_DEF := x86 28 endif 29 ifneq ($(filter-out amd64 x86,$(BUILD_TARGET_ARCH)),) 30 $(warning Ignoring unknown BUILD_TARGET_ARCH value '$(BUILD_TARGET_ARCH)'.) 31 BUILD_TARGET_ARCH := 32 endif 33 ifeq ($(BUILD_TARGET_ARCH),) 34 ifeq ($(ARCH),x86_64) 35 BUILD_TARGET_ARCH := amd64 36 else 37 ifeq ($(ARCH),i386) 38 BUILD_TARGET_ARCH := x86 39 else 40 BUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH_DEF) 41 endif 42 endif 43 else 44 ifneq ($(BUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH_DEF)) 45 $(warning Using BUILD_TARGET_ARCH='$(BUILD_TARGET_ARCH)' from the $(origin BUILD_TARGET_ARCH).) 46 endif 47 endif 21 MOD_NAME = vboxvideo 48 22 49 ifneq ($(filter-out release profile debug strict,$(BUILD_TYPE)),) 50 $(warning Ignoring unknown BUILD_TYPE value '$(BUILD_TYPE)'.) 51 BUILD_TYPE := 52 endif 53 ifeq ($(BUILD_TYPE),) 54 BUILD_TYPE := release 55 else 56 ifneq ($(BUILD_TYPE),release) 57 $(warning Using BUILD_TYPE='$(BUILD_TYPE)' from the $(origin BUILD_TYPE).) 58 endif 59 endif 23 MOD_OBJS = vboxvideo_drm.o 60 24 61 EXTRA_CFLAGS = -fshort-wchar62 63 ifneq ($(MAKECMDGOALS),clean)64 65 ifeq ($(KERNELRELEASE),)66 67 #68 # building from this directory69 #70 71 # kernel base directory72 ifndef KERN_DIR73 KERN_DIR := /lib/modules/$(shell uname -r)/build74 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)75 KERN_DIR := /usr/src/linux76 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)77 $(error Error: unable to find the sources of your current Linux kernel. \78 Specify KERN_DIR=<directory> and run Make again)79 endif80 $(warning Warning: using /usr/src/linux as the source directory of your \81 Linux kernel. If this is not correct, specify \82 KERN_DIR=<directory> and run Make again.)83 endif84 else85 ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)86 $(error Error: KERN_DIR does not point to a directory)87 endif88 endif89 90 # includes91 ifndef KERN_INCL92 KERN_INCL = $(KERN_DIR)/include93 endif94 ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)95 $(error Error: unable to find the include directory for your current Linux \96 kernel. Specify KERN_INCL=<directory> and run Make again)97 endif98 99 # module install dir.100 ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)101 ifndef MODULE_DIR102 MODULE_DIR_TST := /lib/modules/$(shell uname -r)103 ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)104 MODULE_DIR := $(MODULE_DIR_TST)/misc105 else106 $(error Unable to find the folder to install the DRM driver to)107 endif108 endif # MODULE_DIR unspecified109 endif110 111 # guess kernel version (24 or 26)112 ifeq ($(shell if grep '"2\.4\.' $(KERN_INCL)/linux/version.h > /dev/null; then echo yes; fi),yes)113 KERN_VERSION := 24114 else115 KERN_VERSION := 26116 endif117 118 else # neq($(KERNELRELEASE),)119 120 #121 # building from kbuild (make -C <kernel_directory> M=`pwd`)122 #123 124 # guess kernel version (24 or 26)125 ifeq ($(shell if echo "$(VERSION).$(PATCHLEVEL)." | grep '2\.4\.' > /dev/null; then echo yes; fi),yes)126 KERN_VERSION := 24127 else128 KERN_VERSION := 26129 endif130 131 endif # neq($(KERNELRELEASE),)132 133 # debug - show guesses.134 ifdef DEBUG135 $(warning dbg: KERN_DIR = $(KERN_DIR))136 $(warning dbg: KERN_INCL = $(KERN_INCL))137 $(warning dbg: MODULE_DIR = $(MODULE_DIR))138 $(warning dbg: KERN_VERSION = $(KERN_VERSION))139 endif140 141 KBUILD_VERBOSE ?= 1142 143 #144 # Compiler options145 #146 ifndef INCL147 INCL := $(addprefix -I,$(KERN_INCL) $(EXTRA_INCL))148 ifndef KBUILD_EXTMOD149 KBUILD_EXTMOD := $(shell pwd)150 endif151 INCL += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)152 INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxvideo,/ /include /r0drv/linux)153 export INCL154 endif155 25 ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxvideo),) 156 26 MANGLING := $(KBUILD_EXTMOD)/vboxvideo/include/VBox/VBoxGuestMangling.h … … 158 28 MANGLING := $(KBUILD_EXTMOD)/include/VBox/VBoxGuestMangling.h 159 29 endif 160 KFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \ 161 -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DLOG_TO_BACKDOOR -DIN_MODULE \ 162 -DIN_GUEST_R0 30 MOD_CFLAGS = -fshort-wchar -include $(MANGLING) 31 MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) 32 # What on earth is this? 33 MOD_INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxvideo,/ /include /r0drv/linux) 34 MOD_DEFS := -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \ 35 -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DLOG_TO_BACKDOOR -DIN_MODULE \ 36 -DIN_GUEST_R0 163 37 # our module does not export any symbol 164 KFLAGS+= -DRT_NO_EXPORT_SYMBOL38 MOD_DEFS += -DRT_NO_EXPORT_SYMBOL 165 39 ifeq ($(BUILD_TARGET_ARCH),amd64) 166 KFLAGS+= -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS40 MOD_DEFS += -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS 167 41 else 168 KFLAGS+= -DRT_ARCH_X8642 MOD_DEFS += -DRT_ARCH_X86 169 43 endif 170 ifeq ($(BUILD_TYPE),debug) 171 KFLAGS += -DDEBUG 172 endif 44 MOD_CLEAN = . linux r0drv r0drv/linux 173 45 174 # override is required by the Debian guys 175 override MODULE = vboxvideo 176 OBJS = vboxvideo_drm.o 177 178 ifeq ($(KERN_VERSION), 24) 179 # 180 # 2.4 181 # 182 183 CFLAGS := -O2 -DVBOX_LINUX_2_4 $(INCL) $(KFLAGS) $(KDEBUG) 184 MODULE_EXT := o 185 186 # 2.4 Module linking 187 $(MODULE).o: $(OBJS) 188 $(LD) -o $@ -r $(OBJS) 189 190 .PHONY: $(MODULE) 191 all: $(MODULE) 192 $(MODULE): $(MODULE).o 193 194 else 195 # 196 # 2.6 and later 197 # 198 199 MODULE_EXT := ko 200 201 $(MODULE)-y := $(OBJS) 202 203 # special hack for Fedora Core 6 2.6.18 (fc6), rhel5 2.6.18 (el5), 204 # ClarkConnect 4.3 (cc4) and ClarkConnect 5 (v5) 205 ifeq ($(KERNELRELEASE),) 206 KFLAGS += $(foreach inc,$(KERN_INCL),\ 207 $(if $(wildcard $(inc)/linux/utsrelease.h),\ 208 $(if $(shell grep '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h; \ 209 grep '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h; \ 210 grep '"2.6.18.*v5.*"' $(inc)/linux/utsrelease.h; \ 211 grep '"2.6.18.*cc4.*"' $(inc)/linux/utsrelease.h),\ 212 -DKERNEL_FC6,),)) 213 else 214 KFLAGS += $(if $(shell echo "$(KERNELRELEASE)"|grep '2.6.18.*fc6.*';\ 215 echo "$(KERNELRELEASE)"|grep '2.6.18.*el5.*';\ 216 echo "$(KERNELRELEASE)"|grep '2.6.18.*v5.*';\ 217 echo "$(KERNELRELEASE)"|grep '2.6.18.*cc4.*'),\ 218 -DKERNEL_FC6,) 219 endif 220 221 # build defs 222 EXTRA_CFLAGS += -include $(MANGLING) $(INCL) $(KFLAGS) $(KDEBUG) 223 224 all: $(MODULE) 225 226 obj-m += $(MODULE).o 227 228 $(MODULE): 229 $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules 230 231 endif 232 233 install: $(MODULE) 234 @mkdir -p $(MODULE_DIR); \ 235 install -m 0664 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \ 236 PATH="$(PATH):/bin:/sbin" depmod -a; 237 238 endif # eq($(MAKECMDGOALS),clean) 239 240 # important: Don't remove Module.symvers! DKMS does 'make clean' before building ... 241 clean: 242 for f in . linux r0drv r0drv/linux; do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done 243 rm -rf .vboxvideo* .tmp_ver* vboxvideo.* Modules.symvers modules.order 244 46 include $(obj)/Makefile.include.footer -
trunk/src/VBox/Additions/linux/drm/files_vboxvideo_drm
r36198 r36602 22 22 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_drm.c=>vboxvideo_drm.c \ 23 23 ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_drm.h=>vboxvideo_drm.h \ 24 ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.header \ 25 ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.footer \ 24 26 ${PATH_OUT}/version-generated.h=>version-generated.h \ 25 27 ${PATH_OUT}/product-generated.h=>product-generated.h \
Note:
See TracChangeset
for help on using the changeset viewer.