Messages in this thread | | | Date | Tue, 15 Jun 1999 10:23:53 +0200 (MET DST) | From | Wojtek Pilorz <> | Subject | Re: proc entry for actual kernel filename |
| |
On Mon, 14 Jun 1999, Mike Bennett wrote:
> Date: Mon, 14 Jun 1999 21:52:26 -0400 > From: Mike Bennett <mbennett@cfcc.cc.fl.us> > To: Keith Owens <kaos@ocs.com.au> > Cc: linux-kernel@vger.rutgers.edu > Subject: Re: proc entry for actual kernel filename > > On Tue, Jun 15, 1999 at 11:16:43AM +1000, Keith Owens wrote: > > On Mon, 14 Jun 1999 20:59:40 -0400, > > Mike Bennett <mbennett@cfcc.cc.fl.us> wrote: > > >I can get the > > >kernel version from several places, but nowhere can I find the actual > > >kernel filename that was booted. > > > > /proc/cmdline gives you the lilo label (BOOT_IMAGE). You can scan > > lilo.conf to get the filename. Remember that at boot time there is no > > concept of a file, lilo picks up the filename when you build a new > > configuration and stores physical block numbers for the "file" to boot. > > > > Now that makes perfect sense. <kicking myself in the head> > I've had the answer all along, but was too blind to see it. > That will work and simple to do. Unfortunately there are some problems with this solution: 1. One could use loadlin, etc. rather than LILO 2. One could use LILO, but on a different system, so boot records could be built from lilo.conf on a filesystem which is even not mounted (I myself often do that if I have multiple Linux systems installed on one computer). 3. One could specify -m to lilo, so again parsing /etc/lilo.conf could be misleading.
> > Thanks! > Mike >
I would suggest using an approach implemented in RedHat Linux (see initscripts parckage), or a similar approach.
The general idea is that contents of /proc/version is used to identify kernel. It is a line like that below: Linux version 2.2.5 (root@tst.tst) (gcc version 2.7.2.3) #1 Thu Apr 8 09:33:30 CEST 1999
Then for each kernel, a file containing this line is created when installing the kernel; Name of this files is related to name of kernel file is such a way, that kernel file name (and file names of related files, e.g. System.map) can be easily derived.
System initialization script (rc.sysinit in RedHat Linux) scans the files containing version lines for the contents of /proc/version, and makes necessary symbolic links. The solution used in RedHat Linux is good also for kernels which contains modules.
Best regards,
Wojtek
- 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/
| |