summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/compat/Kbuild.include1
-rw-r--r--src/compat/version/linux/version.h10
2 files changed, 11 insertions, 0 deletions
diff --git a/src/compat/Kbuild.include b/src/compat/Kbuild.include
index e937671..209c0cc 100644
--- a/src/compat/Kbuild.include
+++ b/src/compat/Kbuild.include
@@ -6,6 +6,7 @@ kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
ccflags-y += -include $(kbuild-dir)/compat/compat.h
asflags-y += -include $(kbuild-dir)/compat/compat-asm.h
+LINUXINCLUDE := -DCOMPAT_VERSION=$(VERSION) -DCOMPAT_PATCHLEVEL=$(PATCHLEVEL) -DCOMPAT_SUBLEVEL=$(SUBLEVEL) -I$(kbuild-dir)/compat/version $(LINUXINCLUDE)
ifeq ($(wildcard $(srctree)/include/linux/ptr_ring.h),)
ccflags-y += -I$(kbuild-dir)/compat/ptr_ring/include
diff --git a/src/compat/version/linux/version.h b/src/compat/version/linux/version.h
new file mode 100644
index 0000000..90988b3
--- /dev/null
+++ b/src/compat/version/linux/version.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2015-2021 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
+ */
+
+#include_next <linux/version.h>
+#undef KERNEL_VERSION
+#define KERNEL_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + (c))
+#undef LINUX_VERSION_CODE
+#define LINUX_VERSION_CODE KERNEL_VERSION(COMPAT_VERSION, COMPAT_PATCHLEVEL, COMPAT_SUBLEVEL)