summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorJoshua M. Clulow <josh@sysmgr.org>2020-05-01 13:46:41 -0700
committerJoshua M. Clulow <josh@sysmgr.org>2020-05-01 13:46:49 -0700
commit6112cec5d5374dff12a12bd285afeb5e660b7154 (patch)
tree7877c44ad9e689e3e392da14f070c2825e461d93 /usr/src
parent15fa1d047e03d3f123546d72f130c5ce4b278eba (diff)
downloadillumos-joyent-6112cec5d5374dff12a12bd285afeb5e660b7154.tar.gz
12517 allow for custom per-distribution branding
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk> Reviewed by: Peter Tribble <peter.tribble@gmail.com> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Robert Mustacchi <rm@fingolfin.org>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/Makefile.master19
-rw-r--r--usr/src/cmd/Adm/sun/Makefile6
-rw-r--r--usr/src/cmd/init/Makefile20
-rw-r--r--usr/src/cmd/init/init.c42
-rw-r--r--usr/src/common/bootbanner/bootbanner.c354
-rw-r--r--usr/src/man/man2/sysinfo.214
-rwxr-xr-xusr/src/tools/scripts/bldenv15
-rw-r--r--usr/src/tools/scripts/check_rtime.pl12
-rwxr-xr-xusr/src/tools/scripts/nightly22
-rw-r--r--usr/src/uts/common/Makefile.files1
-rw-r--r--usr/src/uts/common/Makefile.rules12
-rw-r--r--usr/src/uts/common/os/logsubr.c18
-rw-r--r--usr/src/uts/common/sys/Makefile1
-rw-r--r--usr/src/uts/common/sys/bootbanner.h33
-rw-r--r--usr/src/uts/common/sys/systeminfo.h12
-rw-r--r--usr/src/uts/common/syscall/systeminfo.c8
16 files changed, 537 insertions, 52 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index 6ecaba4078..a6d4d763d6 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -30,6 +30,7 @@
# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2020 Joyent, Inc.
# Copyright 2019 RackTop Systems.
+# Copyright 2020 Oxide Computer Company
#
#
@@ -1102,10 +1103,24 @@ VERSION= SunOS Development
PATCHID= $(VERSION)
RELEASE_DATE= release date not set
PATCH_DATE= $(RELEASE_DATE)
-RELEASE_CM= "@($(POUND_SIGN))SunOS $(RELEASE) $(PATCHID) $(PATCH_DATE)"
-DEV_CM= "@($(POUND_SIGN))SunOS Internal Development: non-nightly build"
+RELEASE_CM= "@($(POUND_SIGN))illumos $(PATCHID) $(PATCH_DATE)"
+DEV_CM_TAIL= development build: $(LOGNAME)
+DEV_CM= "@($(POUND_SIGN))illumos $(DEV_CM_TAIL)"
UTS_LABEL= $(RELEASE)
+#
+# The boot banner may be overridden by distributions. Up to five lines can be
+# specified by overriding the BOOTBANNER macros, and any line that expands to
+# an empty string will not be printed. See comments in
+# bootbanner_expand_template() for more details about the template string
+# format.
+#
+BOOTBANNER1= ^o Version ^v ^w-bit
+BOOTBANNER2=
+BOOTBANNER3=
+BOOTBANNER4=
+BOOTBANNER5=
+
PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
$(RELEASE_BUILD)PROCESS_COMMENT= @?${MCS} -d -a $(RELEASE_CM)
diff --git a/usr/src/cmd/Adm/sun/Makefile b/usr/src/cmd/Adm/sun/Makefile
index db3cd6c931..9c280f54ec 100644
--- a/usr/src/cmd/Adm/sun/Makefile
+++ b/usr/src/cmd/Adm/sun/Makefile
@@ -39,7 +39,7 @@ FILEMODE= 0644
ROOTETCFTPUSERSLINK= $(ROOTETC)/ftpusers
-$(ROOTETC)/shadow := FILEMODE = 400
+$(ROOTETC)/shadow := FILEMODE = 400
$(ROOTVARSMB)/smbpasswd := FILEMODE = 0400
@@ -61,8 +61,8 @@ clobber:
motd: FRC
@-$(ECHO) "rebuilding motd"
- @$(RELEASE_BUILD)-$(ECHO) "The Illumos Project\tSunOS $(RELEASE)\t$(VERSION)\t$(RELEASE_DATE)" > motd
- @$(NOT_RELEASE_BUILD)-$(ECHO) "The Illumos Project\tSunOS $(RELEASE)\t$(VERSION)\t`date +'%h. %d, %Y'`" > motd
+ @$(RELEASE_BUILD)-$(ECHO) "The illumos Project\t$(VERSION)\t$(RELEASE_DATE)" > motd
+ @$(NOT_RELEASE_BUILD)-$(ECHO) "The illumos Project\t$(VERSION)\t`date +'%h. %d, %Y'`" > motd
@$(NOT_RELEASE_BUILD)-$(ECHO) $(DEV_CM) | sed -e "s/@(#)//" >> motd
@-$(CAT) release_info >> motd
diff --git a/usr/src/cmd/init/Makefile b/usr/src/cmd/init/Makefile
index 195a1271e8..521c9c26a7 100644
--- a/usr/src/cmd/init/Makefile
+++ b/usr/src/cmd/init/Makefile
@@ -24,20 +24,26 @@
# Use is subject to license terms.
#
# Copyright (c) 2018, Joyent, Inc.
+# Copyright 2020 Oxide Computer Company
-PROG= init
+PROG= init
ROOTFS_PROG= $(PROG)
DEFAULTFILES= init.dfl
include ../Makefile.cmd
+OBJS = init.o bootbanner.o
CSTD = $(CSTD_GNU99)
LDLIBS += -lpam -lbsm -lcontract -lscf
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += $(CNOWARN_UNINIT)
-LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
CLOBBERFILES= $(STATIC)
+CPPFLAGS += -DBOOTBANNER1='"$(BOOTBANNER1)"'
+CPPFLAGS += -DBOOTBANNER2='"$(BOOTBANNER2)"'
+CPPFLAGS += -DBOOTBANNER3='"$(BOOTBANNER3)"'
+CPPFLAGS += -DBOOTBANNER4='"$(BOOTBANNER4)"'
+CPPFLAGS += -DBOOTBANNER5='"$(BOOTBANNER5)"'
# needs work
SMATCH=off
@@ -56,11 +62,17 @@ install: all $(ROOTETCDEFAULTFILES) $(ROOTSBINPROG)
$(RM) $(ROOTETC)/TIMEZONE
cd $(ROOTETC); $(SYMLINK) default/init TIMEZONE
+$(PROG): $(OBJS)
+ $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
+ $(POST_PROCESS)
+
+%.o: $(SRC)/common/bootbanner/%.c
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
+ $(POST_PROCESS_O)
+
test:
rtest $(PROG)
clean:
-lint: lint_PROG
-
include ../Makefile.targ
diff --git a/usr/src/cmd/init/init.c b/usr/src/cmd/init/init.c
index a877806916..460fd42036 100644
--- a/usr/src/cmd/init/init.c
+++ b/usr/src/cmd/init/init.c
@@ -20,6 +20,7 @@
*/
/*
+ * Copyright 2020 Oxide Computer Company
* Copyright (c) 2013 Gary Mills
*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
@@ -99,6 +100,7 @@
#include <sys/tty.h>
#include <sys/types.h>
#include <sys/utsname.h>
+#include <sys/bootbanner.h>
#include <bsm/adt_event.h>
#include <bsm/libbsm.h>
@@ -600,6 +602,7 @@ static int startd_failure_rate_critical();
static char *audit_boot_msg();
static int audit_put_record(int, int, char *);
static void update_boot_archive(int new_state);
+static void init_bootbanner_print(const char *, uint_t);
int
main(int argc, char *argv[])
@@ -669,36 +672,35 @@ main(int argc, char *argv[])
st_init();
if (booting && print_banner) {
- struct utsname un;
- char buf[BUFSIZ], *isa;
- long ret;
- int bits = 32;
-
/*
* We want to print the boot banner as soon as
* possible. In the global zone, the kernel does it,
* but we do not have that luxury in non-global zones,
* so we will print it here.
*/
+#ifdef LEGACY_BANNER
+ struct utsname un;
+ char buf[BUFSIZ];
+ const char *bits;
+ int r;
+
(void) uname(&un);
- ret = sysinfo(SI_ISALIST, buf, sizeof (buf));
- if (ret != -1L && ret <= sizeof (buf)) {
- for (isa = strtok(buf, " "); isa;
- isa = strtok(NULL, " ")) {
- if (strcmp(isa, "sparcv9") == 0 ||
- strcmp(isa, "amd64") == 0) {
- bits = 64;
- break;
- }
- }
+ if ((r = sysinfo(SI_ADDRESS_WIDTH, buf, sizeof (buf))) > 0 &&
+ r < sizeof (buf)) {
+ bits = buf;
+ } else {
+ bits = "64";
}
console(B_FALSE,
- "\n\n%s Release %s Version %s %d-bit\r\n",
+ "\n\n%s Release %s Version %s %s-bit\r\n",
un.sysname, un.release, un.version, bits);
console(B_FALSE,
"Copyright (c) 1983, 2010, Oracle and/or its affiliates."
" All rights reserved.\r\n");
+#else
+ bootbanner_print(init_bootbanner_print, 0);
+#endif
}
/*
@@ -915,6 +917,14 @@ main(int argc, char *argv[])
}
static void
+init_bootbanner_print(const char *line, uint_t num)
+{
+ const char *pfx = (num == 0) ? "\n\n" : "";
+
+ console(B_FALSE, "%s%s\r\n", pfx, line);
+}
+
+static void
update_boot_archive(int new_state)
{
if (new_state != LVL0 && new_state != LVL5 && new_state != LVL6)
diff --git a/usr/src/common/bootbanner/bootbanner.c b/usr/src/common/bootbanner/bootbanner.c
new file mode 100644
index 0000000000..90eccd8e0b
--- /dev/null
+++ b/usr/src/common/bootbanner/bootbanner.c
@@ -0,0 +1,354 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2020 Oxide Computer Company
+ */
+
+#ifdef _KERNEL
+#include <sys/types.h>
+#include <sys/sunddi.h>
+#else
+#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <sys/utsname.h>
+#include <sys/systeminfo.h>
+#endif
+#include <sys/debug.h>
+
+/*
+ * Rendering of the boot banner, used on the system and zone consoles.
+ */
+
+typedef enum ilstr_errno {
+ ILSTR_ERROR_OK = 0,
+ ILSTR_ERROR_NOMEM,
+ ILSTR_ERROR_OVERFLOW,
+} ilstr_errno_t;
+
+typedef struct ilstr {
+ char *ils_data;
+ size_t ils_datalen;
+ size_t ils_strlen;
+ uint_t ils_errno;
+ int ils_kmflag;
+} ilstr_t;
+
+static void
+ilstr_init(ilstr_t *ils, int kmflag)
+{
+ bzero(ils, sizeof (*ils));
+ ils->ils_kmflag = kmflag;
+}
+
+static void
+ilstr_reset(ilstr_t *ils)
+{
+ if (ils->ils_strlen > 0) {
+ /*
+ * Truncate the string but do not free the buffer so that we
+ * can use it again without further allocation.
+ */
+ ils->ils_data[0] = '\0';
+ ils->ils_strlen = 0;
+ }
+ ils->ils_errno = ILSTR_ERROR_OK;
+}
+
+static void
+ilstr_fini(ilstr_t *ils)
+{
+ if (ils->ils_data != NULL) {
+#ifdef _KERNEL
+ kmem_free(ils->ils_data, ils->ils_datalen);
+#else
+ free(ils->ils_data);
+#endif
+ }
+}
+
+static void
+ilstr_append_str(ilstr_t *ils, const char *s)
+{
+ size_t len;
+ size_t chunksz = 64;
+
+ if (ils->ils_errno != ILSTR_ERROR_OK) {
+ return;
+ }
+
+ if ((len = strlen(s)) < 1) {
+ return;
+ }
+
+ /*
+ * Check to ensure that the new string length does not overflow,
+ * leaving room for the termination byte:
+ */
+ if (len >= SIZE_MAX - ils->ils_strlen - 1) {
+ ils->ils_errno = ILSTR_ERROR_OVERFLOW;
+ return;
+ }
+ size_t new_strlen = ils->ils_strlen + len;
+
+ if (new_strlen + 1 >= ils->ils_datalen) {
+ size_t new_datalen = ils->ils_datalen;
+ char *new_data;
+
+ /*
+ * Grow the string buffer to make room for the new string.
+ */
+ while (new_datalen < new_strlen + 1) {
+ if (chunksz >= SIZE_MAX - new_datalen) {
+ ils->ils_errno = ILSTR_ERROR_OVERFLOW;
+ return;
+ }
+ new_datalen += chunksz;
+ }
+
+#ifdef _KERNEL
+ new_data = kmem_alloc(new_datalen, ils->ils_kmflag);
+#else
+ new_data = malloc(new_datalen);
+#endif
+ if (new_data == NULL) {
+ ils->ils_errno = ILSTR_ERROR_NOMEM;
+ return;
+ }
+
+ if (ils->ils_data != NULL) {
+ bcopy(ils->ils_data, new_data, ils->ils_strlen + 1);
+#ifdef _KERNEL
+ kmem_free(ils->ils_data, ils->ils_datalen);
+#else
+ free(ils->ils_data);
+#endif
+ }
+
+ ils->ils_data = new_data;
+ ils->ils_datalen = new_datalen;
+ }
+
+ bcopy(s, ils->ils_data + ils->ils_strlen, len + 1);
+ ils->ils_strlen = new_strlen;
+}
+
+#ifdef _KERNEL
+static void
+ilstr_append_uint(ilstr_t *ils, uint_t n)
+{
+ char buf[64];
+
+ if (ils->ils_errno != ILSTR_ERROR_OK) {
+ return;
+ }
+
+ VERIFY3U(snprintf(buf, sizeof (buf), "%u", n), <, sizeof (buf));
+
+ ilstr_append_str(ils, buf);
+}
+#endif
+
+static void
+ilstr_append_char(ilstr_t *ils, char c)
+{
+ char buf[2];
+
+ if (ils->ils_errno != ILSTR_ERROR_OK) {
+ return;
+ }
+
+ buf[0] = c;
+ buf[1] = '\0';
+
+ ilstr_append_str(ils, buf);
+}
+
+static ilstr_errno_t
+ilstr_errno(ilstr_t *ils)
+{
+ return (ils->ils_errno);
+}
+
+static const char *
+ilstr_cstr(ilstr_t *ils)
+{
+ return (ils->ils_data);
+}
+
+static size_t
+ilstr_len(ilstr_t *ils)
+{
+ return (ils->ils_strlen);
+}
+
+static const char *
+ilstr_errstr(ilstr_t *ils)
+{
+ switch (ils->ils_errno) {
+ case ILSTR_ERROR_OK:
+ return ("ok");
+ case ILSTR_ERROR_NOMEM:
+ return ("could not allocate memory");
+ case ILSTR_ERROR_OVERFLOW:
+ return ("tried to construct too large a string");
+ default:
+ return ("unknown error");
+ }
+}
+
+/*
+ * Expand a boot banner template string. The following expansion tokens
+ * are supported:
+ *
+ * ^^ a literal caret
+ * ^s the base kernel name (utsname.sysname)
+ * ^o the operating system name ("illumos")
+ * ^v the operating system version (utsname.version)
+ * ^r the operating system release (utsname.release)
+ * ^w the native address width in bits (e.g., "32" or "64")
+ */
+static void
+bootbanner_expand_template(const char *input, ilstr_t *output)
+{
+ size_t pos = 0;
+ enum {
+ ST_REST,
+ ST_CARET,
+ } state = ST_REST;
+
+#ifndef _KERNEL
+ struct utsname utsname;
+ bzero(&utsname, sizeof (utsname));
+ (void) uname(&utsname);
+#endif
+
+ for (;;) {
+ char c = input[pos];
+
+ if (c == '\0') {
+ /*
+ * Even if the template came to an end mid way through
+ * a caret expansion, it seems best to just print what
+ * we have and drive on. The onus will be on the
+ * distributor to ensure their templates are
+ * well-formed at build time.
+ */
+ break;
+ }
+
+ switch (state) {
+ case ST_REST:
+ if (c == '^') {
+ state = ST_CARET;
+ } else {
+ ilstr_append_char(output, c);
+ }
+ pos++;
+ continue;
+
+ case ST_CARET:
+ if (c == '^') {
+ ilstr_append_char(output, c);
+ } else if (c == 's') {
+ ilstr_append_str(output, utsname.sysname);
+ } else if (c == 'o') {
+ ilstr_append_str(output, "illumos");
+ } else if (c == 'r') {
+ ilstr_append_str(output, utsname.release);
+ } else if (c == 'v') {
+ ilstr_append_str(output, utsname.version);
+ } else if (c == 'w') {
+#ifdef _KERNEL
+ ilstr_append_uint(output,
+ NBBY * (uint_t)sizeof (void *));
+#else
+ char *bits;
+ char buf[32];
+ int r;
+
+ if ((r = sysinfo(SI_ADDRESS_WIDTH, buf,
+ sizeof (buf))) > 0 &&
+ r < (int)sizeof (buf)) {
+ bits = buf;
+ } else {
+ bits = "64";
+ }
+
+ ilstr_append_str(output, bits);
+#endif
+ } else {
+ /*
+ * Try to make it obvious what went wrong:
+ */
+ ilstr_append_str(output, "!^");
+ ilstr_append_char(output, c);
+ ilstr_append_str(output, " UNKNOWN!");
+ }
+ state = ST_REST;
+ pos++;
+ continue;
+ }
+ }
+}
+
+static void
+bootbanner_print_one(ilstr_t *s, void (*printfunc)(const char *, uint_t),
+ const char *template, uint_t *nump)
+{
+ ilstr_reset(s);
+
+ bootbanner_expand_template(template, s);
+
+ if (ilstr_errno(s) == ILSTR_ERROR_OK) {
+ if (ilstr_len(s) > 0) {
+ printfunc(ilstr_cstr(s), *nump);
+ *nump += 1;
+ }
+ } else {
+ char ebuf[128];
+
+ snprintf(ebuf, sizeof (ebuf), "boot banner error: %s",
+ ilstr_errstr(s));
+
+ printfunc(ebuf, *nump);
+ *nump += 1;
+ }
+}
+
+/*
+ * This routine should be called during early system boot to render the boot
+ * banner on the system console, and during zone boot to do so on the zone
+ * console.
+ *
+ * The "printfunc" argument is a callback function. When passed a string, the
+ * function must print it in a fashion appropriate for the context. The
+ * callback will only be called while within the call to bootbanner_print().
+ * The "kmflag" value accepts the same values as kmem_alloc(9F) in the kernel,
+ * and is ignored otherwise.
+ */
+void
+bootbanner_print(void (*printfunc)(const char *, uint_t), int kmflag)
+{
+ ilstr_t s;
+ uint_t num = 0;
+
+ ilstr_init(&s, kmflag);
+
+ bootbanner_print_one(&s, printfunc, BOOTBANNER1, &num);
+ bootbanner_print_one(&s, printfunc, BOOTBANNER2, &num);
+ bootbanner_print_one(&s, printfunc, BOOTBANNER3, &num);
+ bootbanner_print_one(&s, printfunc, BOOTBANNER4, &num);
+ bootbanner_print_one(&s, printfunc, BOOTBANNER5, &num);
+
+ ilstr_fini(&s);
+}
diff --git a/usr/src/man/man2/sysinfo.2 b/usr/src/man/man2/sysinfo.2
index fc85af6b0e..6815dbc229 100644
--- a/usr/src/man/man2/sysinfo.2
+++ b/usr/src/man/man2/sysinfo.2
@@ -4,7 +4,7 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH SYSINFO 2 "Sep 7, 2015"
+.TH SYSINFO 2 "Apr 27, 2020"
.SH NAME
sysinfo \- get and set system information strings
.SH SYNOPSIS
@@ -177,6 +177,18 @@ compilation system.
.sp
.ne 2
.na
+\fB\fBSI_ADDRESS_WIDTH\fR\fR
+.ad
+.sp .6
+.RS 4n
+Copy into the array pointed to by \fIbuf\fR a string describing the number
+of bits in the address space of the native instruction set; e.g., \fB32\fR
+or \fB64\fR.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fBSI_ISALIST\fR\fR
.ad
.sp .6
diff --git a/usr/src/tools/scripts/bldenv b/usr/src/tools/scripts/bldenv
index 85999e5b77..69f74d89de 100755
--- a/usr/src/tools/scripts/bldenv
+++ b/usr/src/tools/scripts/bldenv
@@ -25,6 +25,7 @@
# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
# Copyright 2020 Joyent, Inc.
+# Copyright 2020 Oxide Computer Company
#
# Uses supplied "env" file, based on /opt/onbld/etc/env, to set shell variables
# before spawning a shell for doing a release-style builds interactively
@@ -247,14 +248,20 @@ if [ "${flags.d_set}" != "true" ] && "${flags.DF_build}"; then
fi
POUND_SIGN="#"
+basews=$(basename -- "$CODEMGR_WS")
# have we set RELEASE_DATE in our env file?
if [ -z "$RELEASE_DATE" ]; then
RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
fi
-BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
-BASEWSDIR=$(basename -- "${CODEMGR_WS}")
-DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
-export DEV_CM RELEASE_DATE POUND_SIGN
+now=$(LC_ALL=C date +%Y-%b-%d)
+DEV_CM_TAIL="development build: $LOGNAME $now [$basews]"
+
+#
+# We export POUND_SIGN, RELEASE_DATE and DEV_CM_TAIL to speed up the build
+# process by avoiding repeated shell invocations to evaluate Makefile.master
+# definitions.
+#
+export POUND_SIGN RELEASE_DATE DEV_CM_TAIL
print 'Build type is \c'
if ${flags.d} ; then
diff --git a/usr/src/tools/scripts/check_rtime.pl b/usr/src/tools/scripts/check_rtime.pl
index f456ea4cbc..ebd49a79bb 100644
--- a/usr/src/tools/scripts/check_rtime.pl
+++ b/usr/src/tools/scripts/check_rtime.pl
@@ -22,6 +22,7 @@
#
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2020 Oxide Computer Company
#
#
@@ -147,7 +148,7 @@ use vars qw($EXRE_exec_data $EXRE_exec_stack $EXRE_nocrlealt);
use vars qw($EXRE_nodirect $EXRE_nosymsort $EXRE_forbidden_dep $EXRE_forbidden);
use vars qw($EXRE_olddep $EXRE_skip $EXRE_stab $EXRE_textrel $EXRE_undef_ref);
use vars qw($EXRE_unref_obj $EXRE_unused_deps $EXRE_unused_obj);
-use vars qw($EXRE_unused_rpath);
+use vars qw($EXRE_unused_rpath $EXRE_no_comment);
use strict;
use Getopt::Std;
@@ -279,11 +280,12 @@ sub ProcFile {
# Determine whether this ELF executable or shared object has a
# conforming mcs(1) comment section. If the correct $(POST_PROCESS)
# macros are used, only a 3 or 4 line .comment section should exist
- # containing one or two "@(#)SunOS" identifying comments (one comment
+ # containing one or two "@(#)illumos" identifying comments (one comment
# for a non-debug build, and two for a debug build). The results of
# the following split should be three or four lines, the last empty
# line being discarded by the split.
- if ($opt{m}) {
+ if ($opt{m} &&
+ (!defined($EXRE_no_comment) || ($RelPath !~ $EXRE_no_comment))) {
my(@Mcs, $Con, $Dev);
@Mcs = split(/\n/, `mcs -p $FullPath 2>&1`);
@@ -292,11 +294,11 @@ sub ProcFile {
foreach my $Line (@Mcs) {
$Val++;
- if (($Val == 3) && ($Line !~ /^@\(#\)SunOS/)) {
+ if (($Val == 3) && ($Line !~ /^@\(#\)illumos/)) {
$Con = 1;
last;
}
- if (($Val == 4) && ($Line =~ /^@\(#\)SunOS/)) {
+ if (($Val == 4) && ($Line =~ /^@\(#\)illumos/)) {
$Dev = 1;
next;
}
diff --git a/usr/src/tools/scripts/nightly b/usr/src/tools/scripts/nightly
index 489f63b897..f6b536c924 100755
--- a/usr/src/tools/scripts/nightly
+++ b/usr/src/tools/scripts/nightly
@@ -29,6 +29,7 @@
# Copyright 2020 Joyent, Inc.
# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2019 Peter Trible.
+# Copyright 2020 Oxide Computer Company
#
# Based on the nightly script from the integration folks,
# Mostly modified and owned by mike_s.
@@ -804,18 +805,20 @@ abssrcdirs="$SRC"
PROTOCMPTERSE="protocmp.terse -gu"
POUND_SIGN="#"
+basews="$(basename "$CODEMGR_WS")"
# have we set RELEASE_DATE in our env file?
if [ -z "$RELEASE_DATE" ]; then
RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
fi
-BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
-BASEWSDIR=$(basename $CODEMGR_WS)
-DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
+now=$(LC_ALL=C date +%Y-%b-%d)
+DEV_CM_TAIL="development build: $LOGNAME $now [$basews]"
-# we export POUND_SIGN, RELEASE_DATE and DEV_CM to speed up the build process
-# by avoiding repeated shell invocations to evaluate Makefile.master
+#
+# We export POUND_SIGN, RELEASE_DATE and DEV_CM_TAIL to speed up the build
+# process by avoiding repeated shell invocations to evaluate Makefile.master
# definitions.
-export POUND_SIGN RELEASE_DATE DEV_CM
+#
+export POUND_SIGN RELEASE_DATE DEV_CM_TAIL
maketype="distributed"
if [[ -z "$MAKE" ]]; then
@@ -1027,9 +1030,9 @@ function logshuffle {
cat $build_time_file $build_environ_file $mail_msg_file \
> ${LLOG}/mail_msg
if [ "$m_FLAG" = "y" ]; then
- cat ${LLOG}/mail_msg | /usr/bin/mailx ${mailx_r} -s \
- "Nightly ${MACH} Build of `basename ${CODEMGR_WS}` ${state}." \
- ${MAILTO}
+ /usr/bin/mailx ${mailx_r} -s \
+ "Nightly ${MACH} Build of ${basews} ${state}." \
+ "${MAILTO}" < "${LLOG}/mail_msg"
fi
if [ "$u_FLAG" = "y" -a "$build_ok" = "y" ]; then
@@ -1086,7 +1089,6 @@ function create_lock {
eval $lockvar=$lockf
while ! staffer ln -s $hostname.$STAFFER.$$ $lockf 2> /dev/null; do
- basews=`basename $CODEMGR_WS`
ls -l $lockf | nawk '{print $NF}' | IFS=. read host user pid
if [ "$host" != "$hostname" ]; then
echo "$MACH build of $basews apparently" \
diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files
index b146c65178..36b2c49d67 100644
--- a/usr/src/uts/common/Makefile.files
+++ b/usr/src/uts/common/Makefile.files
@@ -110,6 +110,7 @@ GENUNIX_OBJS += \
bio.o \
bitmap.o \
blabel.o \
+ bootbanner.o \
brandsys.o \
bz2blocksort.o \
bz2compress.o \
diff --git a/usr/src/uts/common/Makefile.rules b/usr/src/uts/common/Makefile.rules
index a5df77b507..9bd92cb24f 100644
--- a/usr/src/uts/common/Makefile.rules
+++ b/usr/src/uts/common/Makefile.rules
@@ -26,6 +26,7 @@
# Copyright 2019 Joyent, Inc.
# Copyright 2018 Nexenta Systems, Inc.
# Copyright (c) 2017 by Delphix. All rights reserved.
+# Copyright 2020 Oxide Computer Company
#
#
@@ -1518,6 +1519,10 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/common/krtld/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/%.o: $(COMMONBASE)/bootbanner/%.c
+ $(COMPILE.c) -o $@ $<
+ $(CTFCONVERT_O)
+
$(OBJS_DIR)/%.o: $(COMMONBASE)/list/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
@@ -1542,6 +1547,13 @@ $(OBJS_DIR)/%.o: $(COMMONBASE)/nvpair/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/bootbanner.o := CPPFLAGS += \
+ -DBOOTBANNER1='"$(BOOTBANNER1)"' \
+ -DBOOTBANNER2='"$(BOOTBANNER2)"' \
+ -DBOOTBANNER3='"$(BOOTBANNER3)"' \
+ -DBOOTBANNER4='"$(BOOTBANNER4)"' \
+ -DBOOTBANNER5='"$(BOOTBANNER5)"'
+
$(OBJS_DIR)/%.o: $(UTSBASE)/common/os/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
diff --git a/usr/src/uts/common/os/logsubr.c b/usr/src/uts/common/os/logsubr.c
index 149f5f8a88..2874b9049d 100644
--- a/usr/src/uts/common/os/logsubr.c
+++ b/usr/src/uts/common/os/logsubr.c
@@ -20,6 +20,7 @@
*/
/*
+ * Copyright 2020 Oxide Computer Company
* Copyright (c) 2013 Gary Mills
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
*/
@@ -42,6 +43,7 @@
#include <sys/utsname.h>
#include <sys/id_space.h>
#include <sys/zone.h>
+#include <sys/bootbanner.h>
log_zone_t log_global;
queue_t *log_consq;
@@ -181,6 +183,14 @@ log_zonefree(zoneid_t zoneid, void *arg)
kmem_free(lzp, sizeof (log_zone_t));
}
+static void
+log_bootbanner_print(const char *line, uint_t num)
+{
+ const char *pfx = (num == 0) ? "\r" : "";
+
+ printf("%s%s\n", pfx, line);
+}
+
void
log_init(void)
{
@@ -245,12 +255,16 @@ log_init(void)
log_update(&log_backlog, log_backlogq, SL_CONSOLE, log_console);
/*
- * Now that logging is enabled, emit the SunOS banner.
+ * Now that logging is enabled, emit the boot banner.
*/
+#ifdef LEGACY_BANNER
printf("\rSunOS Release %s Version %s %u-bit\n",
utsname.release, utsname.version, NBBY * (uint_t)sizeof (void *));
printf("Copyright (c) 1983, 2010, Oracle and/or its affiliates. "
"All rights reserved.\n");
+#else
+ bootbanner_print(log_bootbanner_print, KM_SLEEP);
+#endif
#ifdef DEBUG
printf("DEBUG enabled\n");
#endif
@@ -491,7 +505,7 @@ log_console(log_t *lp, log_ctl_t *lc)
mblk_t *
log_makemsg(int mid, int sid, int level, int sl, int pri, void *msg,
- size_t size, int on_intr)
+ size_t size, int on_intr)
{
mblk_t *mp = NULL;
mblk_t *mp2;
diff --git a/usr/src/uts/common/sys/Makefile b/usr/src/uts/common/sys/Makefile
index 9dcb787870..3c24a1e04f 100644
--- a/usr/src/uts/common/sys/Makefile
+++ b/usr/src/uts/common/sys/Makefile
@@ -96,6 +96,7 @@ CHKHDRS= \
bofi.h \
bofi_impl.h \
bpp_io.h \
+ bootbanner.h \
bootstat.h \
brand.h \
buf.h \
diff --git a/usr/src/uts/common/sys/bootbanner.h b/usr/src/uts/common/sys/bootbanner.h
new file mode 100644
index 0000000000..93ba1b9e79
--- /dev/null
+++ b/usr/src/uts/common/sys/bootbanner.h
@@ -0,0 +1,33 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2020 Oxide Computer Company
+ */
+
+#ifndef _SYS_BOOTBANNER_H
+#define _SYS_BOOTBANNER_H
+
+/*
+ * Rendering of the boot banner, used on the system and zone consoles.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void bootbanner_print(void (*)(const char *, uint_t), int kmflag);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_BOOTBANNER_H */
diff --git a/usr/src/uts/common/sys/systeminfo.h b/usr/src/uts/common/sys/systeminfo.h
index a664a19b9e..951d799a70 100644
--- a/usr/src/uts/common/sys/systeminfo.h
+++ b/usr/src/uts/common/sys/systeminfo.h
@@ -21,6 +21,7 @@
/*
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
* Copyright 2017 RackTop Systems.
+ * Copyright 2020 Oxide Computer Company
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -56,8 +57,8 @@ extern char platform[];
* 257 - 512 Unix International assigned numbers for `set' style commands
* where the value is selected to be the value for the
* corresponding `get' command plus 256.
- * 513 - 768 Solaris specific `get' style commands.
- * 769 - 1024 Solaris specific `set' style commands where the value is
+ * 513 - 768 illumos-defined `get' style commands.
+ * 769 - 1024 illumos-defined `set' style commands where the value is
* selected to be the value for the corresponding `get' command
* plus 256.
*
@@ -69,7 +70,7 @@ extern char platform[];
/* UI defined `get' commands (1-256) */
#define SI_SYSNAME 1 /* return name of operating system */
#define SI_HOSTNAME 2 /* return name of node */
-#define SI_RELEASE 3 /* return release of operating system */
+#define SI_RELEASE 3 /* return release of operating system */
#define SI_VERSION 4 /* return version field of utsname */
#define SI_MACHINE 5 /* return kind of machine */
#define SI_ARCHITECTURE 6 /* return instruction set arch */
@@ -81,7 +82,7 @@ extern char platform[];
#define SI_SET_HOSTNAME 258 /* set name of node */
#define SI_SET_SRPC_DOMAIN 265 /* set secure RPC domain */
-/* Solaris defined `get' commands (513-768) */
+/* illumos-defined `get' commands (513-768) */
#define SI_PLATFORM 513 /* return platform identifier */
#define SI_ISALIST 514 /* return supported isa list */
#define SI_DHCP_CACHE 515 /* return kernel-cached DHCPACK */
@@ -89,8 +90,9 @@ extern char platform[];
#define SI_ARCHITECTURE_64 517 /* basic 64-bit SI_ARCHITECTURE */
#define SI_ARCHITECTURE_K 518 /* kernel SI_ARCHITECTURE equivalent */
#define SI_ARCHITECTURE_NATIVE 519 /* SI_ARCHITECTURE of the caller */
+#define SI_ADDRESS_WIDTH 520 /* number of bits in native address */
-/* Solaris defined `set' commands (769-1024) (none currently assigned) */
+/* illumos-defined `set' commands (769-1024) (none currently assigned) */
#define HW_INVALID_HOSTID 0xFFFFFFFF /* an invalid hostid */
diff --git a/usr/src/uts/common/syscall/systeminfo.c b/usr/src/uts/common/syscall/systeminfo.c
index 21b5ac08ba..00d11e5aba 100644
--- a/usr/src/uts/common/syscall/systeminfo.c
+++ b/usr/src/uts/common/syscall/systeminfo.c
@@ -19,6 +19,7 @@
* CDDL HEADER END
*/
/*
+ * Copyright 2020 Oxide Computer Company
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -26,6 +27,7 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All rights reserved. */
+
#include <sys/param.h>
#include <sys/types.h>
#include <sys/sysmacros.h>
@@ -81,6 +83,9 @@ systeminfo(int command, char *buf, long count)
kstr = utsname.machine;
break;
#ifdef _LP64
+ case SI_ADDRESS_WIDTH:
+ kstr = "64";
+ break;
case SI_ARCHITECTURE_64:
case SI_ARCHITECTURE_K:
kstr = architecture;
@@ -94,6 +99,9 @@ systeminfo(int command, char *buf, long count)
architecture : architecture_32;
break;
#else
+ case SI_ADDRESS_WIDTH:
+ kstr = "32";
+ break;
case SI_ARCHITECTURE_K:
case SI_ARCHITECTURE_32:
case SI_ARCHITECTURE: