From owner-freebsd-questions@FreeBSD.ORG Thu Nov 8 23:36:37 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3508D16A418 for ; Thu, 8 Nov 2007 23:36:37 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.freebsd.org (Postfix) with ESMTP id F2A9C13C480 for ; Thu, 8 Nov 2007 23:36:36 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.1/8.14.1) id lA8NaPF4075111; Thu, 8 Nov 2007 17:36:25 -0600 (CST) (envelope-from dan) Date: Thu, 8 Nov 2007 17:36:25 -0600 From: Dan Nelson To: Erik Osterholm , FreeBSD Questions Mailing List Message-ID: <20071108233625.GA72824@dan.emsphone.com> References: <6dcf0dbc0711080901g49043bb1u1a8e38cfacbde15c@mail.gmail.com> <20071108175951.GC18314@darklight.org.ru> <6dcf0dbc0711081316h7748e759w101e5df72e1514d7@mail.gmail.com> <20071108214754.GA22005@dan.emsphone.com> <20071108231421.GA42848@aleph.cepheid.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071108231421.GA42848@aleph.cepheid.org> X-OS: FreeBSD 7.0-BETA1 User-Agent: Mutt/1.5.16 (2007-06-09) Cc: Subject: Re: Determine FreeBSD version of binary X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Nov 2007 23:36:37 -0000 In the last episode (Nov 08), Erik Osterholm said: > On Thu, Nov 08, 2007 at 03:47:54PM -0600, Dan Nelson wrote: > > In the last episode (Nov 08), John Smith said: > > > On Nov 8, 2007 6:59 PM, Yuri Pankov wrote: > > > > May be not entirely correct, but close: > > > > > > > > ldd binary | grep libc.so > > > > > > Yes, that helps somewhat. At least I now know that it's FreeBSD > > > 4.x. And before I again forget something I forgot to mention > > > earlier on: I also have a file called 'kernel'. Could that > > > somehow give somewhat more detailed information about exactly > > > which 4.x kernel it is, and if so, how would I go about doing > > > that ? > > > > Run "strings /kernel | tail" on it. > > > > There's also a better way to determine the FreeBSD version an > > executable was built for. As long as you didn't build world with > > -O2, the "file" command can print it. Note that you will need to > > run a 5.x or newer version of file, since even though 4.x puts the > > version in each binary, its file command doesn't print it. > > > > $ file /bin/ls > > /bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), for FreeBSD 7.0 (700052), dynamically linked (uses shared libs), FreeBSD-style, stripped > > $ file /mnt/oldsystem/bin/ls > > /mnt/oldsystem/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1, for FreeBSD 4.2, statically linked, stripped > > > > If you like building with -O2, apply the patch in PR 101590. > > Interesting. Does 6.2/amd64 build with -O2 by default? The default was switched from -O to -O2 in src/share/mk/sys.mk r1.81, which was before 6.x was branched, so none of the 6.x releases have versions in their executables. > $ file /bin/ls > /bin/ls: ELF 64-bit LSB executable, AMD x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), stripped > > This was after a buildworld with no special options added, and > nothing affecting the kernel in make.conf. -- Dan Nelson dnelson@allantgroup.com