detecting i386 or x86_64 in kickstart

Klaus Steden klaus.steden at thomson.net
Fri Jan 26 18:35:15 UTC 2007


> >>I figured /proc/cpuinfo would be the ticket, but I have no clue what 
> >>to look for. Where can I find the docs for all of the info in 
> >>/proc/cpuinfo?
> >>
> >'uname -i' is probably a better option than digging through cpuinfo.
> It lies. uname -i give me what architecture of software is installed. I 
> need cpuinfo to know if the cpu is capable of 64bit.
> 
> I seems like I'm going to need to use cobbler or otherwise keep a 
> database and have a dynamically generated ks file via http.
> 
/proc/cpuinfo is not that difficult a beast to wrangle ... what you're looking
for is something like this:

model name      : AMD Athlon(tm) 64 Processor 3200+
model name      : Intel(R) Pentium(R) 4 CPU 3.00GHz
model name      : Intel(R) Xeon(TM) CPU 2.40GHz
model name      : Dual Core AMD Opteron(tm) Processor 275

You can wrangle something like this in '%pre' with a bit of shell script ...

-- cut --
cpu_arch=`grep "^model name" /proc/cpuinfo |awk -F: '{print $2}'`
case "$cpu_arch" in
    *Athlon*64*)
    	type=x86_64
	;;
    *Opteron*)
    	type=x86_64
	;;
    *Xeon*)
    	type=i386
	;;
esac
-- cut --

I wouldn't use that code fragment exactly, but you get the idea ...

I found when I had to handle both 32-bit and 64-bit arches, I tinkered with
the Anaconda process a little bit to generate kickstarts from CGI queries
instead of statically, and bundled 32-bit and 64-bit bootstrap kernels on the
same install medium.

YMMV, but it's not that difficult to do what I think you want to do.

good luck,
Klaus




More information about the Kickstart-list mailing list