Installing Debian kernels (after initial boot)

Chad Walstrom chewie at wookimus.net
Mon Aug 19 19:48:56 CEST 2002


I've added a small shell source script to our ./class directory that
populates the kernelimage variable with a kernel specific to the CPU's
present on the system, though in a very limited way.  We only have
machines greater than Pentium II class or AMD K7 class.  We have a
couple SMP machines, but there is currently no Debian -k7-smp kernel
package (we compiled one for ourselves).

Disclaimer, it's not the slickest of scripts, nor does it do everything
"right", but it does limit the subshells that are run and cleans up
after itself.  One change that might be worthwhile is setting the
_kernel_version variable to the $KERNELVERSION that is set in
/etc/fai.conf.

To get this to work, remember to comment out any other kernelimage
assignments in *.var files (unless you want to use those files as an
override to this script).

The script goes like so:

### BEGIN SCRIPT ###
#! /bin/bash
#
# $Id: S05kernelimage.source,v 1.2 2002/08/14 15:15:48 chad Exp $
#
# Report class based on CPU info -- used to install custom kernels
# This may not be the fastest executing script, but it does only use two
# programs, this shell and sed.
#
# Variables that are not needed are unset at the end of the script
_vendor_amd="AuthenticAMD"
_vendor_intel="GenuineIntel"

_cpu_vendors=`/bin/sed -e '/^vendor_id.*:/ !D' -e 's/^.*: //' /proc/cpuinfo`
_cpu_families=`/bin/sed -e '/^cpu family.*:/ !D' -e 's/^.*: //' /proc/cpuinfo`

_kernel_suffix=
_kernel_version="2.4.18"

case $_cpu_vendors in
    # Used the '*' in case vendor listed multiple times
    ${_vendor_amd}*) 
        for family in $_cpu_families
        do
            [ $family -eq 6 ] && _kernel_suffix="-k7" 
        done
        ;;
    ${_vendor_intel}*) 
        for family in $_cpu_families
        do
            [ $family -eq 6 ] && _kernel_suffix="-686" 
        done
        ;;
    *) _kernel_suffix="-386" ;;
esac

# Test to see if this machine has two processors
[ `/bin/grep -c processor /proc/cpuinfo` -gt 1 ] && \
        _kernel_suffix="${_kernel_suffix}-smp"

# Set the FAI kernelimage variable
kernelimage="kernel-image-${_kernel_version}${_kernel_suffix}"

# Clean up
unset _cpu_vendors _cpu_families family _vendor_amd _vendor_intel 
unset _kernel_suffix _kernel_version

### END SCRIPT ###

-- 
Chad Walstrom <chewie at wookimus.net>                 | a.k.a. ^chewie
http://www.wookimus.net/                            | s.k.a. gunnarr



More information about the linux-fai mailing list