VirtualBox

vbox的更動 68609 路徑 trunk/src/VBox/Installer


忽略:
時間撮記:
2017-9-1 下午04:33:52 (7 年 以前)
作者:
vboxsync
訊息:

Linux driver make files: clean up.
bugref:4567: Linux kernel driver maintenance

Simplify the Makefile.include.header and .footer templates and remove some
content which was either no longer relevant or perhaps never really needed.
Also make a small fix to build_in_tmp which sometimes caused it to fail on
Linux 2.4-based systems (that is, CentOS 3).

位置:
trunk/src/VBox/Installer/linux
檔案:
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Installer/linux/Makefile.include.footer

    r66016 r68609  
    1818override MODULE = $(MOD_NAME)
    1919OBJS   = $(MOD_OBJS)
    20 
    21 ifneq ($(MAKECMDGOALS),clean)
    2220
    2321KBUILD_VERBOSE ?= 1
     
    4442#
    4543
     44# Note: while 2.4 kernels could also do "proper" builds from kbuild, the make
     45# script needed to support it was somewhat different from 2.6.  Since this
     46# script works and 2.4 is not a moving target we will not try do do things the
     47# "proper" way.
     48
    4649ifeq ($(BUILD_TARGET_ARCH),amd64)
    4750 KFLAGS  += -mcmodel=kernel
     
    5962$(MODULE): $(MODULE).o
    6063
    61 else
     64install: $(MODULE)
     65        @mkdir -p $(MODULE_DIR); \
     66        install -m 0644 -o root -g root $(MODULE).$(MODULE_EXT) \
     67        $(INSTALL_MOD_PATH)/$(KERN_DIR)/$(INSTALL_MOD_DIR); \
     68        PATH="$(PATH):/bin:/sbin" depmod -a;
     69
     70clean:
     71        for f in $(sort $(dir $(OBJS))); do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
     72        rm -rf .$(MOD_NAME)* .tmp_ver* $(MOD_NAME).* Modules.symvers modules.order
     73
     74else  # ! $(KERN_VERSION), 24
    6275#
    6376# 2.6 and later
     
    8598        $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) CONFIG_MODULE_SIG= -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) -j$(JOBS) modules
    8699
    87 modules_install:
    88         $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) CONFIG_MODULE_SIG= -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) modules_install
     100install: $(MODULE)
     101        $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) CONFIG_MODULE_SIG= -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) modules_install
    89102
    90 endif
    91 
    92 install: $(MODULE)
    93         @mkdir -p $(MODULE_DIR); \
    94         install -m 0644 -o root -g root $(MODULE).$(MODULE_EXT) $(MODULE_DIR); \
    95         PATH="$(PATH):/bin:/sbin" depmod -a;
    96 
    97 endif # eq($(MAKECMDGOALS),clean)
     103modules_install: install
     104all: install
    98105
    99106clean:
    100         for f in $(MOD_CLEAN); do rm -f $$f/*.o $$f/.*.cmd $$f/.*.flags; done
    101         rm -rf .$(MOD_NAME)* .tmp_ver* $(MOD_NAME).* Modules.symvers modules.order
     107        $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) CONFIG_MODULE_SIG= -C $(KERN_DIR) SUBDIRS=$(CURDIR) SRCROOT=$(CURDIR) clean
     108
     109.PHONY: $(MODULE) install modules_install clean
     110endif
  • trunk/src/VBox/Installer/linux/Makefile.include.header

    r66503 r68609  
    1616
    1717# Testing:
    18 # * Building with KERN_VER set to an installed but non-current kernel works and
    19 #   installs to the right location.
    20 # * Building with KERN_DIR and/or MODULE_DIR set uses the value specified and
     18# * Building with KERN_DIR set uses the value specified and
    2119#   the default value for the unspecified one if any.
    2220
     
    3533# MOD_INCL = <any additional include paths which this module needs>
    3634# MOD_CFLAGS = <any additional CFLAGS which this module needs>
    37 # MOD_CLEAN = <list of directories that the clean target should look at>
    3835# include $(obj)/Makefile.include.footer
    3936#
     
    8784endif
    8885
    89 ifneq ($(MAKECMDGOALS),clean)
    90 
    9186ifeq ($(KERNELRELEASE),)
    9287
     
    9590 #
    9691
    97  # target kernel version
    98  ifndef KERN_VER
    99   KERN_VER := $(shell uname -r)
    100  else
    101   ifneq ($(shell if test -d /lib/modules/$(KERN_VER)/build; then echo yes; fi),yes)
    102    KERN_VER := $(shell uname -r)
    103   endif
    104  endif
    105 
    10692 # kernel base directory
    10793 ifndef KERN_DIR
    108   KERN_DIR := /lib/modules/$(KERN_VER)/build
     94  KERN_DIR := /lib/modules/$(shell uname -r)/build
    10995  ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
    110    KERN_DIR := /usr/src/linux
    111    ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes)
    112     $(error Error: unable to find the sources of your current Linux kernel. \
     96   $(error Error: unable to find the sources of your current Linux kernel. \
    11397                   Specify KERN_DIR=<directory> and run Make again)
    114    endif
    115    $(warning Warning: using /usr/src/linux as the source directory of your \
    116                       Linux kernel. If this is not correct, specify \
    117                       KERN_DIR=<directory> and run Make again.)
    11898  endif
    11999 else
     
    125105 # includes
    126106 ifndef KERN_INCL
    127   KERN_INCL = $(KERN_DIR)/include
     107  KERN_INCL := $(KERN_DIR)/include
    128108 endif
    129109 ifneq ($(shell if test -d $(KERN_INCL); then echo yes; fi),yes)
     
    132112 endif
    133113
    134  # module install dir, only for current kernel
    135  ifneq ($(filter install install_rpm,$(MAKECMDGOALS)),)
    136   ifndef MODULE_DIR
    137    MODULE_DIR_TST := /lib/modules/$(KERN_VER)
    138    ifeq ($(shell if test -d $(MODULE_DIR_TST); then echo yes; fi),yes)
    139     MODULE_DIR := $(MODULE_DIR_TST)/misc
    140    else
    141     $(error Unable to find the folder to install the module to)
    142    endif
    143   endif # MODULE_DIR unspecified
    144  endif
     114 # module install dir
     115 INSTALL_MOD_DIR ?= misc
    145116
    146  # guess kernel version (24 or 26)
    147  ifeq ($(shell if grep '"2\.4\.' $(KERN_INCL)/linux/version.h > /dev/null; then echo yes; fi),yes)
     117 # guess kernel major version (24 or later)
     118 ifeq ($(shell if grep '"2\.4\.' $(KERN_INCL)/linux/version.h > /dev/null 2>&1; then echo yes; fi),yes)
    148119  KERN_VERSION := 24
    149120 else
     
    164135 endif
    165136
     137 KERN_DIR := /lib/modules/$(KERNELRELEASE)/build
     138 KERN_INCL := $(KERN_DIR)/include
     139
    166140endif # neq($(KERNELRELEASE),)
    167141
    168142# debug - show guesses.
    169143ifdef DEBUG
    170 $(warning dbg: KERN_DIR     = $(KERN_DIR))
    171 $(warning dbg: KERN_INCL    = $(KERN_INCL))
    172 $(warning dbg: MODULE_DIR   = $(MODULE_DIR))
    173 $(warning dbg: KERN_VERSION = $(KERN_VERSION))
     144$(warning dbg: KERN_DIR         = $(KERN_DIR))
     145$(warning dbg: KERN_INCL        = $(KERN_INCL))
     146$(warning dbg: INSTALL_MOD_PATH = $(INSTALL_MOD_PATH))
     147$(warning dbg: INSTALL_MOD_DIR  = $(INSTALL_MOD_DIR))
     148$(warning dbg: KERN_VERSION     = $(KERN_VERSION))
    174149endif
    175 
    176 endif # eq($(MAKECMDGOALS),clean)
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette