1 export KMODDIR?= updates/
2 KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)"
3 ifneq ($(origin $(KLIB)), undefined)
4 KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)"
6 export KLIB:= /lib/modules/$(shell uname -r)
8 export KLIB_BUILD ?= $(KLIB)/build
10 export PWD := $(shell pwd)
12 ifeq ($(KERNELRELEASE),)
13 export COMPAT_BASE_TREE := "linux-next.git"
14 # For this specific tree this is only relevant in
15 # terms of the last time we synched code up with upstream
16 # for internal stuff. For other compatability projects this
17 # would be the git describe of the base tree you are
19 export COMPAT_BASE_TREE_VERSION := "next-20100517"
20 export COMPAT_VERSION := $(shell git describe)
23 # This generates a bunch of CONFIG_COMPAT_KERNEL_22 CONFIG_COMPAT_KERNEL_23 .. etc for
24 # each kernel release you need an object for.
25 ifneq ($(wildcard $(KLIB_BUILD)/Makefile),)
26 COMPAT_LATEST_VERSION = 33
27 KERNEL_SUBLEVEL := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
28 COMPAT_VERSIONS := $(shell I=$(COMPAT_LATEST_VERSION); while [ "$$I" -gt $(KERNEL_SUBLEVEL) ]; do echo $$I; I=$$(($$I - 1)); done)
29 $(foreach ver,$(COMPAT_VERSIONS),$(eval export CONFIG_COMPAT_KERNEL_$(ver)=y))
32 ifeq ($(CONFIG_COMPAT_KERNEL_33),y)
33 ifneq ($(CONFIG_FW_LOADER),)
34 export CONFIG_COMPAT_FIRMWARE_CLASS=m
40 # This hack lets us put our include path first than the kernel's
41 # when building our compat modules. Your own makefile would look
43 NOSTDINC_FLAGS := -I$(M)/include/ \
44 -include $(M)/include/linux/compat-2.6.h \
46 -DCOMPAT_BASE_TREE=\"$(COMPAT_BASE_TREE)\" \
47 -DCOMPAT_BASE_TREE_VERSION=\"$(COMPAT_BASE_TREE_VERSION)\" \
48 -DCOMPAT_VERSION=\"$(COMPAT_VERSION)\"
51 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
53 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
56 @./scripts/compat_firmware_install
58 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean
61 clean-files := Module.symvers modules.order Module.markers compat/modules.order