From: Luis R. Rodriguez Date: Mon, 17 May 2010 18:55:06 +0000 (-0700) Subject: compat: add compat_version read-only module parameter X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=681b57755b37a544615caa4f23443a623be68e25;p=openwrt%2Fstaging%2Fblogic.git compat: add compat_version read-only module parameter This will allow you to supply a version tag for the backport you use. Compat-wireless will re-use this and give it its own value based on the kernel we backport from. It will use either the linux-next git describe or the stable kernel git describe. Any delta on top of the git tree should also be reflected then in case of custom private trees/releases. Signed-off-by: Luis R. Rodriguez --- diff --git a/Makefile b/Makefile index 3692f966770c..0f583bb44a00 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,10 @@ export KLIB_BUILD ?= $(KLIB)/build export PWD := $(shell pwd) +ifeq ($(KERNELRELEASE),) +export COMPAT_VERSION := $(shell git describe) +endif + # This generates a bunch of CONFIG_COMPAT_KERNEL_22 CONFIG_COMPAT_KERNEL_23 .. etc for # each kernel release you need an object for. ifneq ($(wildcard $(KLIB_BUILD)/Makefile),) @@ -29,7 +33,10 @@ obj-y += compat/ # This hack lets us put our include path first than the kernel's # when building our compat modules. Your own makefile would look # the same. -NOSTDINC_FLAGS := -I$(M)/include/ -include $(M)/include/linux/compat-2.6.h $(CFLAGS) +NOSTDINC_FLAGS := -I$(M)/include/ \ + -include $(M)/include/linux/compat-2.6.h \ + $(CFLAGS) \ + -DCOMPAT_VERSION=\"$(COMPAT_VERSION)\" modules: $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules diff --git a/compat/main.c b/compat/main.c index d7f713da3d41..35a5ae8dc29c 100644 --- a/compat/main.c +++ b/compat/main.c @@ -4,6 +4,15 @@ MODULE_AUTHOR("Luis R. Rodriguez"); MODULE_DESCRIPTION("Kernel compatibility module"); MODULE_LICENSE("GPL"); +#ifndef COMPAT_VERSION +#error "You need a COMPAT_VERSION" +#endif + +static char *compat_version = COMPAT_VERSION; + +module_param(compat_version, charp, 0400); +MODULE_PARM_DESC(compat_version, "Version of the kernel compat backport"); + static int __init compat_init(void) { /* pm-qos for kernels <= 2.6.24, this is a no-op on newer kernels */