blob: 94c96f6fbfe6a277b79c02070620949b5bfa566b [file] [log] [blame]
Thomas Gleixner457c8992019-05-19 13:08:55 +01001// SPDX-License-Identifier: GPL-2.0-only
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * linux/init/version.c
4 *
5 * Copyright (C) 1992 Theodore Ts'o
6 *
7 * May be freely distributed as part of Linux.
8 */
9
Sam Ravnborg92045952009-10-18 00:36:47 +020010#include <generated/compile.h>
Laura Abbott9afb7192018-07-05 17:49:37 -070011#include <linux/build-salt.h>
Yonghong Song1fdd7432021-04-01 16:27:23 -070012#include <linux/elfnote-lto.h>
Masahiro Yamadae4f02fd2017-11-17 15:29:10 -080013#include <linux/export.h>
Dan Moulding5a704622022-07-17 17:31:37 -070014#include <linux/init.h>
15#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/uts.h>
17#include <linux/utsname.h>
David Howells0bb80f22013-04-12 01:50:06 +010018#include <linux/proc_ns.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Dan Moulding5a704622022-07-17 17:31:37 -070020static int __init early_hostname(char *arg)
21{
22 size_t bufsize = sizeof(init_uts_ns.name.nodename);
23 size_t maxlen = bufsize - 1;
Azeem Shaikh8ebab152023-08-30 16:08:06 +000024 ssize_t arglen;
Dan Moulding5a704622022-07-17 17:31:37 -070025
Azeem Shaikh8ebab152023-08-30 16:08:06 +000026 arglen = strscpy(init_uts_ns.name.nodename, arg, bufsize);
27 if (arglen < 0) {
Dan Moulding5a704622022-07-17 17:31:37 -070028 pr_warn("hostname parameter exceeds %zd characters and will be truncated",
29 maxlen);
30 }
31 return 0;
32}
33early_param("hostname", early_hostname);
34
Roman Zippel3eb3c7402007-01-10 14:45:28 +010035const char linux_proc_banner[] =
36 "%s version %s"
37 " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
38 " (" LINUX_COMPILER ") %s\n";
Laura Abbott9afb7192018-07-05 17:49:37 -070039
40BUILD_SALT;
Yonghong Song1fdd7432021-04-01 16:27:23 -070041BUILD_LTO_INFO;
Masahiro Yamada2df8220c2022-08-28 11:39:53 +090042
43/*
44 * init_uts_ns and linux_banner contain the build version and timestamp,
45 * which are really fixed at the very last step of build process.
46 * They are compiled with __weak first, and without __weak later.
47 */
48
49struct uts_namespace init_uts_ns __weak;
50const char linux_banner[] __weak;
51
52#include "version-timestamp.c"
53
54EXPORT_SYMBOL_GPL(init_uts_ns);