From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 20 15:26:50 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9CA2D16A41C for ; Mon, 20 Jun 2005 15:26:50 +0000 (GMT) (envelope-from jilles@stack.nl) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5F44F43D49 for ; Mon, 20 Jun 2005 15:26:50 +0000 (GMT) (envelope-from jilles@stack.nl) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mailhost.stack.nl (Postfix) with ESMTP id B1ABF1F099 for ; Mon, 20 Jun 2005 17:26:49 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 92B871CDE3; Mon, 20 Jun 2005 17:26:49 +0200 (CEST) Date: Mon, 20 Jun 2005 17:26:49 +0200 From: Jilles Tjoelker To: freebsd-hackers@freebsd.org Message-ID: <20050620152649.GA1201@stack.nl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="n8g4imXOkfNTN/H1" Content-Disposition: inline X-Operating-System: FreeBSD 5.4-RELEASE i386 User-Agent: Mutt/1.5.6i Subject: what(1) on kernel binary X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2005 15:26:50 -0000 --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On FreeBSD 4.x, one could easily determine the version and compilation date of a kernel binary like this: jilles@toad /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 --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="newvers.sh.patch" --- 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 ${u}@${h}:${d}\\n"; char ostype[] = "${TYPE}"; char osrelease[] = "${RELEASE}"; --n8g4imXOkfNTN/H1--