aboutsummaryrefslogtreecommitdiffstats
path: root/init/version.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/version.c')
-rw-r--r--init/version.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/init/version.c b/init/version.c
index cba341161b58..01d4ab05f0ba 100644
--- a/init/version.c
+++ b/init/version.c
@@ -9,43 +9,29 @@
#include <generated/compile.h>
#include <linux/build-salt.h>
+#include <linux/elfnote-lto.h>
#include <linux/export.h>
+#include <linux/init.h>
+#include <linux/printk.h>
#include <linux/uts.h>
#include <linux/utsname.h>
#include <generated/utsrelease.h>
-#include <linux/version.h>
#include <linux/proc_ns.h>
-#ifndef CONFIG_KALLSYMS
-#define version(a) Version_ ## a
-#define version_string(a) version(a)
-
-extern int version_string(LINUX_VERSION_CODE);
-int version_string(LINUX_VERSION_CODE);
-#endif
-
-struct uts_namespace init_uts_ns = {
- .kref = KREF_INIT(2),
- .name = {
- .sysname = UTS_SYSNAME,
- .nodename = UTS_NODENAME,
- .release = UTS_RELEASE,
- .version = UTS_VERSION,
- .machine = UTS_MACHINE,
- .domainname = UTS_DOMAINNAME,
- },
- .user_ns = &init_user_ns,
- .ns.inum = PROC_UTS_INIT_INO,
-#ifdef CONFIG_UTS_NS
- .ns.ops = &utsns_operations,
-#endif
-};
-EXPORT_SYMBOL_GPL(init_uts_ns);
+static int __init early_hostname(char *arg)
+{
+ size_t bufsize = sizeof(init_uts_ns.name.nodename);
+ size_t maxlen = bufsize - 1;
+ size_t arglen;
-/* FIXED STRINGS! Don't touch! */
-const char linux_banner[] =
- "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
- LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
+ arglen = strlcpy(init_uts_ns.name.nodename, arg, bufsize);
+ if (arglen > maxlen) {
+ pr_warn("hostname parameter exceeds %zd characters and will be truncated",
+ maxlen);
+ }
+ return 0;
+}
+early_param("hostname", early_hostname);
const char linux_proc_banner[] =
"%s version %s"
@@ -53,3 +39,17 @@ const char linux_proc_banner[] =
" (" LINUX_COMPILER ") %s\n";
BUILD_SALT;
+BUILD_LTO_INFO;
+
+/*
+ * init_uts_ns and linux_banner contain the build version and timestamp,
+ * which are really fixed at the very last step of build process.
+ * They are compiled with __weak first, and without __weak later.
+ */
+
+struct uts_namespace init_uts_ns __weak;
+const char linux_banner[] __weak;
+
+#include "version-timestamp.c"
+
+EXPORT_SYMBOL_GPL(init_uts_ns);