On FreeBSD 4.x, one could easily determine the version and compilation date of a kernel binary like this:
[EMAIL PROTECTED] /home/jilles% what /kernel /kernel: FreeBSD 4.11-STABLE #20: Mon May 9 18:43:52 CEST 2005 On FreeBSD 5.x/6.x with GCC 3.x, this doesn't work anymore. The cause is that these two arrays (in /sys/conf/newvers.sh) are now both aligned to a 32-byte boundary, so there are 28 null bytes between @(#) and the version number: char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; char sccs[4] = { '@', '(', '#', ')' }; A possible solution is to change the two arrays to a single one containing 28 null bytes and @(#). char sccs[32] = { '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '@', '(', '#', ')' }; The symbols sccs and sccspad are not otherwise used in the RELENG_5 kernel. what(1) still shows some garbage from the em(4) driver: $RCSfile: if_em_hw.h,v $$Revision: 1.41 $$Date: 2004/05/17 15:18:53 $ $RCSfile: if_em_hw.h,v $$Revision: 1.41 $$Date: 2004/05/17 15:18:53 $ -- Jilles Tjoelker
--- src/sys/conf/newvers.sh.orig Thu Nov 4 23:02:55 2004 +++ src/sys/conf/newvers.sh Wed Jun 15 18:15:55 2005 @@ -85,8 +85,7 @@ i=`${MAKE:-make} -V KERN_IDENT` cat << EOF > vers.c $COPYRIGHT -char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; -char sccs[4] = { '@', '(', '#', ')' }; +char sccs[32] = { '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '\\0', '@', '(', '#', ')' }; char version[] = "${VERSION} #${v}: ${t}\\n [EMAIL PROTECTED]:${d}\\n"; char ostype[] = "${TYPE}"; char osrelease[] = "${RELEASE}";
_______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"