Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Nov 2007 15:47:54 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        John Smith <lbalbalba@gmail.com>
Cc:        Yuri Pankov <yuri.pankov@gmail.com>, FreeBSD Questions Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Determine FreeBSD version of binary
Message-ID:  <20071108214754.GA22005@dan.emsphone.com>
In-Reply-To: <6dcf0dbc0711081316h7748e759w101e5df72e1514d7@mail.gmail.com>
References:  <6dcf0dbc0711080901g49043bb1u1a8e38cfacbde15c@mail.gmail.com> <20071108175951.GC18314@darklight.org.ru> <6dcf0dbc0711081316h7748e759w101e5df72e1514d7@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Nov 08), John Smith said:
> On Nov 8, 2007 6:59 PM, Yuri Pankov <yuri.pankov@gmail.com> 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.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071108214754.GA22005>