kern/126926: [patch] Add MACHINE to dmesg

Gavin Atkinson gavin at
Thu Aug 28 20:40:01 UTC 2008

>Number:         126926
>Category:       kern
>Synopsis:       [patch] Add MACHINE to dmesg
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 28 20:40:00 UTC 2008
>Originator:     Gavin Atkinson
>Release:        FreeBSD 7.0-STABLE amd64
System: FreeBSD 7.0-STABLE FreeBSD 7.0-STABLE #3: Fri Jun 20 09:21:51 UTC 2008 root at amd64

	As somebody who has seen a lot of PRs, it has often proved difficult
to determine whether somebody is running an i386 or amd64 kernel.  Sometimes
it is obvious from looking at the I/O ranges assigned, but other times (see
www/126925 for example) there may be nothing at all in the dmesg to indicate
the architecture that the kernel was built for.  This patch adds it.

	Look at the dmesg in www/126925 and tell me if it was an i386 or
amd64 kernel...

	This patch will include the contents of ${MACHINE} into the kernel
VERSTR, which in turn will lead to the following appearance in a dmesg:

Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.0-CURRENT #28: Tue Aug 19 19:42:20 BST 2008
    root at i386
WARNING: WITNESS option enabled, expect reduced performance.

(note the architecture on the sixth line).  This will also be included in
the output of `sysctl kern.version` and `uname -v`, but I don't see these
as a disadvantage.  Given the recent change to include the SVN revision
number if available into this string, I think it's safe to change the
format again on the assumption that nobody is parsing this directly.

--- begins here ---
Index: src/sys/conf/
RCS file: /home/ncvs/src/sys/conf/,v
retrieving revision 1.76
diff -u -r1.76
--- src/sys/conf/	13 Jul 2008 20:08:38 -0000	1.76
+++ src/sys/conf/	16 Aug 2008 09:25:24 -0000
@@ -86,6 +86,7 @@
 touch version
 v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
 i=`${MAKE:-make} -V KERN_IDENT`
+p=`${MAKE:-make} -V MACHINE`
 for dir in /bin /usr/bin /usr/local/bin; do
 	if [ -x "${dir}/svnversion" ]; then
@@ -105,7 +106,7 @@
 cat << EOF > vers.c
 #define SCCSSTR "@(#)${VERSION} #${v}${svn}: ${t}"
-#define VERSTR "${VERSION} #${v}${svn}: ${t}\\n    ${u}@${h}:${d}\\n"
+#define VERSTR "${VERSION} #${v}${svn}: ${t}\\n    ${u}@${h}:${d} ${p}\\n"
 #define RELSTR "${RELEASE}"
 char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR;
--- ends here ---


More information about the freebsd-bugs mailing list