On Thursday 24 March 2005 04:31, Sean Dague wrote: > On Tue, Mar 22, 2005 at 04:49:45PM +0100, Erich Focht wrote: > > The systemconfigurator kernel version recognition fails This is due to > > the VERY simple way of detection of the kernel version in > > /usr/lib/systemconfig/Initrd/Generic.pm. For the RHEL3-ia64 kernel the > > the string 1.1.3 was recognized as version, which is obviously wrong. ... > > - if(/[^\/\-]([123]\.\d+\.[\w\-\.]+)/) { > > + if(/Linux version[^\/\-]([123]\.\d+\.[\w\-\.]+)/) { ... > > This only works on Red Hat Kernels, for whatever reason, so you'll need a > more generic patch before it should be included.
Hmmm, actually it only works with vmlinux-* kernels on ia32, not with the bzImage-alike. On ia64 it is fine with any kernel I tried. Attached is a more involved version recognition including the bzImage kernels on ia32. Also I attached a perl program which can be used to check whether kernels are recognized or not. Simply call ./sc_kernel_version.pl <your_favourite_kernel_file> If it fails with any kernel, please tell me. Regards, Erich
sc_kernel_version.pl
Description: Perl program
--- usr/lib/systemconfig/Initrd/Generic.pm.orig 2005-03-21 14:54:43.094022920 +0100 +++ usr/lib/systemconfig/Initrd/Generic.pm 2005-03-21 14:56:24.169657088 +0100 @@ -47,12 +47,24 @@ while(<IN>) { # When Linux Kernel 4.0pre1 comes out, we'll have to change this - if(/[^\/\-]([123]\.\d+\.[\w\-\.]+)/) { + if(/Linux version ([123]\.\d+\.[\w\-\.]+)/) { verbose("Found version '$1' at line # $."); $version = $1; last; } } + if ($version eq "0.0.0") { + # trying ia32 bzImage kind of thing + my $buffer; + if (seek(IN, 0x202, 0) && (read(IN, $buffer, 4) == 4) + && (substr($buffer,0,4) eq "HdrS") + && seek(IN, 0x20e, 0) && (read(IN, $buffer, 2) == 2)) { + my $ofs = 0x200 + unpack("S", substr($buffer,0,2)); + if (seek(IN, $ofs, 0) && (read(IN, $buffer, 80) == 80)) { + $version = substr($buffer, 0, index($buffer, " ")); + } + } + } close(IN); return $version;