File microcode.init of Package microcode_ctl
#! /bin/sh
# Copyright (c) 2001-2002 SuSE Linux AG Nuernberg. All rights reserved.
#
# Author: Björn Jacke <feedback@suse.de>
#
# /etc/init.d/microcode
#
# description: init script for Intel amd AMD CPU microcode update
### BEGIN INIT INFO
# Provides: microcode
# Required-Start:
# Required-Stop:
# Default-Start: 1 2 3 5
# Default-Stop:
# X-UnitedLinux-Default-Enabled: yes
# Short-Description: CPU microcode updater
# Description: update the Intel or AMD CPU microcode (both 32 and 64 bit)
### END INIT INFO
. /etc/rc.status
rc_reset
do_start()
{
echo -n "Checking/updating CPU microcode "
if grep -q -i intel /proc/cpuinfo \
&& /sbin/modinfo microcode >& /dev/null; then
/sbin/modprobe -q microcode
/sbin/microcode_ctl -Qu
elif grep -q -i AuthenticAMD /proc/cpuinfo \
&& /sbin/modinfo microcode >& /dev/null; then
fam=`head /proc/cpuinfo |sed -n -e 's/cpu family.*: \([0-9]\+\)/\1/p'`
# Only try to update when family >= 16 (0x10, fam 10h)
if [ $fam -ge 16 >& /dev/null ];then
# Loading the driver automatically requests the firmware
rmmod microcode >& /dev/null
logger "Requesting microcode for AMD fam10h or newer CPU(s)"
echo -n ".. AMD fam10h or newer CPU(s) found"
/sbin/modprobe -q microcode
else
printf ".. unsupported AMD CPU family: 0x%x" $fam
rc_failed 5
fi
else
rc_failed 6
fi
rc_status -v
}
# See how we were called.
case "$1" in
start)
do_start
;;
status)
echo "$0: reading the microcode status is not yet suported"
rc_failed 4
rc_status -v
;;
stop)
;;
reload)
do_start
;;
*)
echo "Usage: $0 start"
exit 1
;;
esac
rc_exit
# vim: set sw=4 ts=4 et ft=sh: