[RFC,1/4] init: Add uts_release

Message ID 20240131104851.2311358-2-john.g.garry@oracle.com
State New
Headers
Series Introduce uts_release |

Commit Message

John Garry Jan. 31, 2024, 10:48 a.m. UTC
  Add a char [] for UTS_RELEASE so that we don't need to rebuild code which
references UTS_RELEASE.

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 include/linux/utsname.h | 1 +
 init/version.c          | 3 +++
 2 files changed, 4 insertions(+)
  

Patch

diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index bf7613ba412b..15b0b1c9a9ee 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -88,5 +88,6 @@  static inline struct new_utsname *init_utsname(void)
 }
 
 extern struct rw_semaphore uts_sem;
+extern const char uts_release[];
 
 #endif /* _LINUX_UTSNAME_H */
diff --git a/init/version.c b/init/version.c
index 94c96f6fbfe6..87fecdd4fbfb 100644
--- a/init/version.c
+++ b/init/version.c
@@ -16,6 +16,7 @@ 
 #include <linux/uts.h>
 #include <linux/utsname.h>
 #include <linux/proc_ns.h>
+#include <generated/utsrelease.h>
 
 static int __init early_hostname(char *arg)
 {
@@ -48,6 +49,8 @@  BUILD_LTO_INFO;
 
 struct uts_namespace init_uts_ns __weak;
 const char linux_banner[] __weak;
+const char uts_release[] = UTS_RELEASE;
+EXPORT_SYMBOL_GPL(uts_release);
 
 #include "version-timestamp.c"