print compiler version in the kernel banner
And provide kernel compiler version as a sysctl as well. This is useful while we have gcc and clang cohabitation. This could be even more useful when we have support for external toolchains. In cooperation with: mjg MFC after: 13 days
This commit is contained in:
parent
499f60b10b
commit
bfdcb3bcba
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=246246
@ -86,6 +86,7 @@ fi
|
||||
touch version
|
||||
v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
|
||||
i=`${MAKE:-make} -V KERN_IDENT`
|
||||
compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep 'version')
|
||||
|
||||
for dir in /bin /usr/bin /usr/local/bin; do
|
||||
if [ -x "${dir}/svnversion" ] && [ -z ${svnversion} ] ; then
|
||||
@ -159,6 +160,7 @@ $COPYRIGHT
|
||||
|
||||
char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR;
|
||||
char version[sizeof(VERSTR) > 256 ? sizeof(VERSTR) : 256] = VERSTR;
|
||||
char compiler_version[] = "${compiler_v}";
|
||||
char ostype[] = "${TYPE}";
|
||||
char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = RELSTR;
|
||||
int osreldate = ${RELDATE};
|
||||
|
@ -325,6 +325,7 @@ print_version(void *data __unused)
|
||||
while (len > 0 && version[len - 1] == '\n')
|
||||
len--;
|
||||
printf("%.*s %s\n", len, version, machine);
|
||||
printf("%s\n", compiler_version);
|
||||
}
|
||||
|
||||
SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t,
|
||||
|
@ -99,6 +99,9 @@ SYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD|CTLFLAG_CAPRD,
|
||||
SYSCTL_STRING(_kern, KERN_VERSION, version, CTLFLAG_RD|CTLFLAG_MPSAFE,
|
||||
version, 0, "Kernel version");
|
||||
|
||||
SYSCTL_STRING(_kern, KERN_VERSION, compiler_version, CTLFLAG_RD|CTLFLAG_MPSAFE,
|
||||
compiler_version, 0, "Version of compiler used to compile kernel");
|
||||
|
||||
SYSCTL_STRING(_kern, KERN_OSTYPE, ostype, CTLFLAG_RD|CTLFLAG_MPSAFE|
|
||||
CTLFLAG_CAPRD, ostype, 0, "Operating system type");
|
||||
|
||||
|
@ -49,6 +49,7 @@ extern int cold; /* nonzero if we are doing a cold boot */
|
||||
extern int rebooting; /* kern_reboot() has been called. */
|
||||
extern const char *panicstr; /* panic message */
|
||||
extern char version[]; /* system version */
|
||||
extern char compiler_version[]; /* system version */
|
||||
extern char copyright[]; /* system copyright */
|
||||
extern int kstack_pages; /* number of kernel stack pages */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user