10-base-classes with i386 and amd64 nfsroot

Rudy Gevaert Rudy.Gevaert at UGent.be
Mon May 14 17:56:56 CEST 2007


Hello Michael,

Michael Tautschnig wrote:
> [...]
>>  spring:/# echo $classes
>>  DEFAULT LINUX I386 FAIBASE UGENT GRUB AMD64 X4100 spring LAST
>>
>>  So for some reasong I386 and AMD64 are defined.
>>
>>  DEFAULT LINUX I386: are defined by the 10-base-classes script.
>>
>>  FAIBASE UGENT GRUB: by 50-host-classes
>>
>>  AMD64 X4100: by spring file in classes directory.
>>
>>  Now in 50-host-classes I can see:
>>  [ -x "`which dpkg`" ] \
>>     && dpkg --print-installation-architecture | tr a-z A-Z
>>
>>  And when I run that in my nfsroot it prints I386.  Because it is a i386 
>>  nfsroot.
>>
>>  I could remove that line, and manually define I386 or AMD64, but the file 
>>  says I should do that :-)
>>
> [...]
> 
> While we don't use a common nfsroot for AMD64 and I386 at our site, we
> still don't use the dpkg --print-installation-architecture thing here. One
> reason for that is that we also want to distinguish between AMD and Intel
> processors. So we are using the following to define the respective classes:
> 
> 
> if grep AMD /proc/cpuinfo | grep -q 64 ; then
>   echo AMD64
> elif grep -q AMD /proc/cpuinfo ; then
>   echo AMD
> else
>   echo IA32
> fi
> 
> This is definitely not the most reliable code, but it seems to work properly
> here. However, we currently only have a single AMD64 system, so there might be
> cases that this code does not catch. Feedback would be most welcome...

Your script helped me a bit.  But I'm having some problems when looking 
at it like this:

What if we want to install IA32 or EM64T machines from intel. (And even 
AMD64)

Say we boot the vmlinuz-install kernel via tftp.  We look in 
/proc/cpuinfo to see which CPU it is.  If we can find the 'lm' flag we 
know our cpu supports long mode, and thus 64 bit:

if egrep -q '^flags:.* lm$|flags:.* lm ' /proc/cpuinfo
then
         echo AMD64
else
	echo IA32
fi

But that means that we will always install 64bit machines on machines 
containing lm flag.  How can we override that?  For instance we want to 
install a 32 bit kernel with 32 bit userspace on a 64bit capable machine.

Setting IA32 in 'class/hostname', with above 10-base-classes script 
gives spring:~# echo $classes
DEFAULT LINUX AMD64 FAIBASE UGENT GRUB IA32 spring LAST

But because I have an AMD64 basefile it:
ftar: extracting /var/lib/fai/config/basefiles///AMD64.tar.gz to 
/tmp/target//

So how about doing it like this:

10-base-classes:
if egrep -q '^flags:.* lm$|flags:.* lm ' /proc/cpuinfo
then
         echo LONGMODE
fi

Put in class/hostname
32BIT

And if there would be a way to then have an other script that does:

if ifclass 32BIT
then
	echo IA32
else
	if ifclass LONGMODE
	then
		echo AMD64
	else
		echo IA32
	fi
fi

However I can't see how I can get FAI to execute the scripts in this order:
0) DEFAULT
1) [0-9][0-9]*: this is ok
2) contents class/hostname: this is ok
3) some script : ?
4) hostname als class: ok
5) LAST: ok

Also I'm not sure how FAI will react to having the IA32/AMD64 classes 
not after DEFAULT, but somewhere in the middle.

Any comments are appreciated :)

Rudy
-- 
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Rudy Gevaert          Rudy.Gevaert at UGent.be          tel:+32 9 264 4734
Directie ICT, afd. Infrastructuur ICT Department, Infrastructure office
Groep Systemen                    Systems group
Universiteit Gent                 Ghent University
Krijgslaan 281, gebouw S9, 9000 Gent, Belgie               www.UGent.be
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --



More information about the linux-fai mailing list