Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/init/version.c
0004  *
0005  *  Copyright (C) 1992  Theodore Ts'o
0006  *
0007  *  May be freely distributed as part of Linux.
0008  */
0009 
0010 #include <generated/compile.h>
0011 #include <linux/build-salt.h>
0012 #include <linux/elfnote-lto.h>
0013 #include <linux/export.h>
0014 #include <linux/init.h>
0015 #include <linux/printk.h>
0016 #include <linux/uts.h>
0017 #include <linux/utsname.h>
0018 #include <generated/utsrelease.h>
0019 #include <linux/version.h>
0020 #include <linux/proc_ns.h>
0021 
0022 struct uts_namespace init_uts_ns = {
0023     .ns.count = REFCOUNT_INIT(2),
0024     .name = {
0025         .sysname    = UTS_SYSNAME,
0026         .nodename   = UTS_NODENAME,
0027         .release    = UTS_RELEASE,
0028         .version    = UTS_VERSION,
0029         .machine    = UTS_MACHINE,
0030         .domainname = UTS_DOMAINNAME,
0031     },
0032     .user_ns = &init_user_ns,
0033     .ns.inum = PROC_UTS_INIT_INO,
0034 #ifdef CONFIG_UTS_NS
0035     .ns.ops = &utsns_operations,
0036 #endif
0037 };
0038 EXPORT_SYMBOL_GPL(init_uts_ns);
0039 
0040 static int __init early_hostname(char *arg)
0041 {
0042     size_t bufsize = sizeof(init_uts_ns.name.nodename);
0043     size_t maxlen  = bufsize - 1;
0044     size_t arglen;
0045 
0046     arglen = strlcpy(init_uts_ns.name.nodename, arg, bufsize);
0047     if (arglen > maxlen) {
0048         pr_warn("hostname parameter exceeds %zd characters and will be truncated",
0049             maxlen);
0050     }
0051     return 0;
0052 }
0053 early_param("hostname", early_hostname);
0054 
0055 /* FIXED STRINGS! Don't touch! */
0056 const char linux_banner[] =
0057     "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
0058     LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
0059 
0060 const char linux_proc_banner[] =
0061     "%s version %s"
0062     " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
0063     " (" LINUX_COMPILER ") %s\n";
0064 
0065 BUILD_SALT;
0066 BUILD_LTO_INFO;