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),)
# 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
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 */