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.
https://gitee.com/openeuler/kernel/pulls/1442 https://gitee.com/openeuler/kernel/issues/I7LEXY https://gitee.com/openeuler/kernel/issues/I575IT https://gitee.com/openeuler/kernel/issues/I7761D
Xie XiuQi (1): kernel: add OPENEULER_VERSION_CODE to version.h
--- v2: fix commit message format error for pr 1442
Makefile | 11 ++++++++++- Makefile.oever | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 Makefile.oever
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/2115 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/2...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/2115 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/2...
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I7LEXY bugzilla: https://gitee.com/openeuler/kernel/issues/I575IT bugzilla: https://gitee.com/openeuler/kernel/issues/I7761D
---------------------------------------------
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/pulls/1442 Link:https://gitee.com/openeuler/kernel/pulls/1219 Link:https://gitee.com/openeuler/kernel/pulls/195 Reviewed-by: Jason Zeng jason.zeng@intel.com Reviewed-by: Duanqiang Wen duanqiangwen@net-swift.com Signed-off-by: Xie XiuQi xiexiuqi@huawei.com
--- v2: fix commit message format error for pr 1442
--- Makefile | 11 ++++++++++- Makefile.oever | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 Makefile.oever
diff --git a/Makefile b/Makefile index e51e4d9174ab..5b2b3ad42a2d 100644 --- a/Makefile +++ b/Makefile @@ -1311,6 +1311,9 @@ uapi-asm-generic: # Generate some files # ---------------------------------------------------------------------------
+# openEuler version variables +include 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
@@ -1335,7 +1338,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