Redhat and kernel question

Michael O'Donnell mod+gnhlug at std.com
Thu Mar 13 13:48:09 EST 2003



>>Um, I do want to know what CPU the kernel was compiled for. Is the -m
>>flag not correct?
>
>I think what he's saying is that uname only provides information
>about the current architecture. Thus, if you are running a kernel on
>an i686, that's what uname -m will report, whereas if you take that
>same kernel and run it on a 486, uname -m on that machine will report
>i486.
>
>What you want is information from the rpm package itself, not uname.
>As Ben pointed out, the defaults for rpm don't show this information,
>however, this command does:
>
> ben> rpm -q kernel --qf '%{NAME}-%{VERSION}-%{RELEASE} %{ARCH}\n'


If all you want to know is whether you're running on
(say) SPARC versus x86, or on which of a few broad
categories of x86 you're running, then yes - uname
or rpm are probably all you need.  That should be
sufficient for nearly any purpose, like (say) many
of the scripted decisions that need to be made during
software installation.

OTOH, if you want to know specifically which CPU your
kernel is targetted towards, like maybe some flavor
of Athlon or Transmeta, or Pentium4 versus Pentium3,
then I don't know of any utility that'll answer that
question for you, and uname definitely does not supply
that level of detail; I'm pretty sure rpm can't do
it, either.  That config/grep trick is the only way
I know.  And just to be clear: in this case we're
talking about the CPU your kernel was targetted for
at build time, not the CPU it happens to be running
on at the moment.

BTW I don't know where that rpm query thingy gets its
info from (my own ignorance - I don't use RedHat)
but if it's some static definition established at
installation time you might be able to fake it out
and cause it to lie to you by reconfigging/rebuilding
your kernel after you've installed it from the RPM.




More information about the gnhlug-discuss mailing list