From: Xie XiuQi xiexiuqi@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I7LEXY
---------------------------------------------
Add OPENEULER_VERSION_CODE to version.h, so modules or applications can identify the specific kernel version.
In most cases, the out-of-tree module needs to identify the release version of the openEuler for interface adaptation. The existing OPENEULER_VERSION() and OPENEULER_VERSION_CODE() cannot distinguish between LTS versions and innovative versions. Therefore, a new macro OPENEULER_LTS is introduced.
The version information is generated in "linux/version.h", as bellow: include/generated/uapi/linux/version.h
``` #define OPENEULER_LTS 0 // 1: LTS; 0: none LTS #define OPENEULER_MAJOR 9999 // OS Major version, 9999: none released #define OPENEULER_MINOR 0 // SP release version #define OPENEULER_VERSION(a,b) (((a) << 8) + (b)) #define OPENEULER_VERSION_CODE 2559744 ```
Use Makefile.oever to avoid future merge conflicts.
Link:https://gitee.com/openeuler/kernel/issues/I575IT Link:https://gitee.com/openeuler/kernel/issues/I7761D Link:https://gitee.com/openeuler/kernel/pulls/1442 Link:https://gitee.com/openeuler/kernel/pulls/1219 Link:https://gitee.com/openeuler/kernel/pulls/195 Signed-off-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Wei Li liwei391@huawei.com --- Makefile | 11 ++++++++++- Makefile.oever | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 Makefile.oever
diff --git a/Makefile b/Makefile index 5c418efbe89b..e458c8265d75 100644 --- a/Makefile +++ b/Makefile @@ -1226,6 +1226,9 @@ uapi-asm-generic: # Generate some files # ---------------------------------------------------------------------------
+# openEuler version variables +include $(srctree)/Makefile.oever + # KERNELRELEASE can change from a few different places, meaning version.h # needs to be updated, so this check is forced on all builds
@@ -1250,7 +1253,13 @@ define filechk_version.h ((c) > 255 ? 255 : (c)))'; \ echo #define LINUX_VERSION_MAJOR $(VERSION); \ echo #define LINUX_VERSION_PATCHLEVEL $(PATCHLEVEL); \ - echo #define LINUX_VERSION_SUBLEVEL $(SUBLEVEL) + echo #define LINUX_VERSION_SUBLEVEL $(SUBLEVEL); \ + echo #define OPENEULER_LTS $(OPENEULER_LTS); \ + echo #define OPENEULER_MAJOR $(OPENEULER_MAJOR); \ + echo #define OPENEULER_MINOR $(OPENEULER_MINOR); \ + echo '#define OPENEULER_VERSION(a,b) (((a) << 8) + (b))'; \ + echo #define OPENEULER_VERSION_CODE $(shell \ + expr $(OPENEULER_MAJOR) * 256 + $(OPENEULER_MINOR)) endef
$(version_h): PATCHLEVEL := $(or $(PATCHLEVEL), 0) diff --git a/Makefile.oever b/Makefile.oever new file mode 100644 index 000000000000..96beccf3569c --- /dev/null +++ b/Makefile.oever @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 +OPENEULER_LTS = 0 +OPENEULER_MAJOR = 9999 +OPENEULER_MINOR = 0