[CentOS] compile driver before X starts

Fri Mar 6 19:28:14 UTC 2009
nate <centos at linuxpowered.net>

Joseph L. Casale wrote:
>>Right now I only have to do this for VMWare's drivers, I
>>build custom RPMs of the drivers and the tools and push
>>them out when I push out a new kernel so I don't need to
>>worry about this kind of thing.
>
> That's a cool idea...
> Care to share those two spec files? :)

Sure though they aren't anything too special, I used alien
to create them.

The drivers/tools are automatically installed as part of
kickstart if vmware is detected. Snip from kickstart config(%post):
cat <<EOF;
###############################################################################
## Install VMWare ESX Tools                                                  ##
###############################################################################
EOF
# These are custom RPMs

export CHECK_VMWARE=`/usr/local/sbin/searchdmi.sh VMware ; echo $?`

if [ $CHECK_VMWARE == 0 ]; then
        echo "VMware found!"
        chkconfig --level 12345 ntpd off; chkconfig --list ntpd;
        chkconfig --level 12345 smartd off; chkconfig --list smartd;
        rpm -Uvh --force --nodeps
http://10.1.10.31/cfengine-rpms/vmware/ESX/3.5.0U3/tools/VMWareToolsOnly-3.5.0-123630-1.noarch.rpm
        rpm -Uvh --force
http://10.1.10.31/cfengine-rpms/vmware/ESX/3.5.0U3/drivers/VMWare-esx-guest-drivers-2.6.18_92.1.22.el5-1.i686.rpm
        wget
http://10.1.10.31/cfengine-rpms/vmware/ESX/3.5.0/tools/vmware_preinit.sh
-O /etc/rc3.d/S15vmwareinit
        chmod 555 /etc/rc3.d/S15vmwareinit
        chown root.root /etc/rc3.d/S15vmwareinit
else
        echo "VMware not found! (don't panic)"
fi

I have it download an extra vmwareinit script, which I use to
intialize vmware tools on initial boot a 2nd time, otherwise
it doesn't appear to load right on first boot:
--snip from script--
/etc/init.d/vmware-tools start

# Now I will delete myself
rm -f /etc/rc3.d/S15vmwareinit
--snip from script--

SPEC files are here:
http://portal.aphroland.org/~aphro/specs/

3 of them:
- drivers for i686 kernel (has a special %post to run
  depmod at the end otherwise vmxnet driver will not load
  properly upon reboot). Without vmxnet network performance
  can be significantly lower, though unless your doing
  bandwidth intensive things you may not notice(it took me
  almost a year to notice).
- drivers for x86_64 kernel (no %post required as vmxnet
  doesn't run on x86_64, e1000 is used)
- tools for both architectures - the %post detects what
  architecture is and sets the symlinks automatically.
  I stripped down the tools quite a bit to take out stuff
  I don't need (X11 support, binary kernel modules etc, the
  binary rpms are 7MB combined vs 36MB from the original
  VMware RPMS).

I'm sure there is a more proper way to go about doing it,
the last time I looked into making a "real" RPM the process
looked much more involved than I was willing to commit to,
so alien works as a fine workaround for my needs(I use it
to build probably 20 RPMs at the moment to push out for
various purposes). I've been doing it this way for more
than a year and it's worked great so far.

If I need to update the packages I put the updates in
cfengine, so the servers can pull them down as needed.
I don't use yum or other tools like that on a wide
scale basis(I use them on a test server to stage the
updates and then push the updates out through cfengine).
I want a better system but not sure what the best
choice would be, something that could work by itself
to update but at the same time not conflict with cfengine
and all of the packages that it pushes out. My cfengine
config is roughly 12,000 lines so it's fairly in-depth,
and works extremely well for my needs.

nate