Re: proc entry for actual kernel filename

DAVID BALAZIC (david.balazic@uni-mb.si)
Wed, 16 Jun 1999 17:33:11 +0100 (MET)


To find the matching kernel file to the currently running
one , read /proc/version , it looks like :

Linux version 2.2.5-15 (root@porky.devel.redhat.com) (gcc version egcs-2.91.66
19990314/Linux (egcs-1.1.2 release)) #1 Mon Apr 19 21:39:28 EDT 1999

( it is a single line, it may be truncated in this mail )

The exactly same line is contained in the kernel file ,
and ONLY in that kernel file , that was actually booted.
This is because each compiled kernel on the world has this
line unique.
You can extract this line from a kernel file like this :

strings vmlinuz.2.x.x | grep 'Linux version'

Unfortunatelly this doesn't work with zImage files.
In that case you must extract the info right after compiling
from the vmlinuz file and save it somewhere. Maybe :
/boot/zImage-2.2.5-x3 # this is the kernel
/boot/zImage-2.2.5-x3.info # this is the version info

Then all you have to do is match the /proc/version string with
files /boot/*.info and so on.

Something similar is done in RedHat5.2 ( and probably other
versions too ) , so if you have red hat , have a look in
/etc/rc.d/rc.sysinit and search for the string 'ktag'.

Hope this helps.

--
David Balazic , student
E-mail   : 1stein@writeme.com     |     living in  sLOVEnija
home page: http://surf.to/stein
Computer: Amiga 1200 + Quantum LPS-340AT
--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/