- Only enable microcode_ctl service if the CPU is capable.
- Prevent microcode_ctl getting restarted multiple times on initlevel change (#141581) - Make restart/reload work properly - Do nothing if not started by root.
This commit is contained in:
parent
b59a59af91
commit
5c39a8d890
@ -9,50 +9,43 @@
|
|||||||
# PROGRAM the executable to run
|
# PROGRAM the executable to run
|
||||||
# ARGUMENTS the argument we're going to call PROGRAM with
|
# ARGUMENTS the argument we're going to call PROGRAM with
|
||||||
|
|
||||||
|
# Check that we're a priviledged user
|
||||||
|
[ `id -u` = 0 ] || exit 0
|
||||||
|
|
||||||
DEVICE=/dev/cpu/microcode
|
DEVICE=/dev/cpu/microcode
|
||||||
ARGUMENTS=-Qu
|
ARGUMENTS=-Qu
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
PROGRAM=/sbin/microcode_ctl
|
PROGRAM=/sbin/microcode_ctl
|
||||||
|
|
||||||
# Lets just be sure we have a device file...
|
# Lets just be sure we have a device file...
|
||||||
if [ ! -e $DEVICE ];
|
if [ ! -e $DEVICE ]; then
|
||||||
then
|
|
||||||
echo $"$0: microcode device $DEVICE doesn't exist?"
|
echo $"$0: microcode device $DEVICE doesn't exist?"
|
||||||
exit 1
|
exit 1
|
||||||
elif [ ! -c $DEVICE ];
|
elif [ ! -c $DEVICE ]; then
|
||||||
then
|
|
||||||
echo $"$0: $DEVICE not a character device?"
|
echo $"$0: $DEVICE not a character device?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e /etc/firmware/microcode.dat ];
|
if [ ! -e /etc/firmware/microcode.dat ]; then
|
||||||
then
|
|
||||||
echo $"$0: microcode datafile not present (/etc/firmware/microcode.dat)"
|
echo $"$0: microcode datafile not present (/etc/firmware/microcode.dat)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
. /etc/init.d/functions
|
. /etc/init.d/functions
|
||||||
|
|
||||||
|
RETVAL=0
|
||||||
|
|
||||||
# perform the update
|
# perform the update
|
||||||
function start ()
|
function start ()
|
||||||
{
|
{
|
||||||
RETVAL=1
|
RETVAL=1
|
||||||
# Make sure we are on an intel machine
|
# Make sure we are on an intel machine
|
||||||
vendor=`cat /proc/cpuinfo | \
|
vendor=`cat /proc/cpuinfo | grep "^vendor_id" | sort -u | awk -F ": " '{ print $2 }'`
|
||||||
grep "^vendor_id" | sort -u | \
|
[ "$vendor" != "GenuineIntel" ] && return
|
||||||
awk -F ": " '{ print $2 }'`
|
|
||||||
if [ "$vendor" != "GenuineIntel" ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Microcode wasn't available until 686's.
|
# Microcode wasn't available until 686's.
|
||||||
family=`cat /proc/cpuinfo | \
|
family=`cat /proc/cpuinfo | grep "^cpu family" | sort -u | awk -F ": " '{ print $2 }'`
|
||||||
grep "^cpu family" | sort -u | \
|
[ $family -lt 6 ] && return
|
||||||
awk -F ": " '{ print $2 }'`
|
|
||||||
if [ $family -lt 6 ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n $"Applying Intel Microcode update: "
|
echo -n $"Applying Intel Microcode update: "
|
||||||
|
|
||||||
@ -69,25 +62,38 @@ function start ()
|
|||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
|
||||||
# trap the most common case, errno 19 = no device
|
# trap the most common case, errno 19 = no device
|
||||||
if [ $RETVAL -eq 19 ];
|
if [ $RETVAL -eq 19 ]; then
|
||||||
then
|
|
||||||
echo $"$0: kernel does not have microcode device support"
|
echo $"$0: kernel does not have microcode device support"
|
||||||
fi
|
fi
|
||||||
/sbin/rmmod microcode
|
/sbin/rmmod microcode
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/microcode_ctl
|
||||||
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stop()
|
||||||
|
{
|
||||||
|
rm -f /var/lock/subsys/microcode_ctl
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start|reload|force-reload|restart)
|
start)
|
||||||
start
|
start
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
restart|reload|force-reload)
|
||||||
|
stop
|
||||||
|
start
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo $"Usage: $0 {start|restart}"
|
echo $"Usage: $0 {start|stop|restart}"
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
exit $?
|
||||||
|
|
||||||
|
@ -65,35 +65,28 @@ if [ "$1" = "0" ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%post
|
%post
|
||||||
# Only enable on Intel machines.
|
# Only enable on Intel 686's and above.
|
||||||
vendor=`cat /proc/cpuinfo | grep "^vendor_id" | sort -u | awk -F ": " '{ print $2 }'`
|
vendor=`cat /proc/cpuinfo | grep "^vendor_id" | sort -u | awk -F ": " '{ print $2 }'`
|
||||||
if [ "$vendor" != "GenuineIntel" ]; then
|
[ "$vendor" != "GenuineIntel" ] && exit 0
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
# Microcode wasn't available until 686's.
|
|
||||||
family=`cat /proc/cpuinfo | grep "^cpu family" | sort -u | awk -F ": " '{ print $2 }'`
|
family=`cat /proc/cpuinfo | grep "^cpu family" | sort -u | awk -F ": " '{ print $2 }'`
|
||||||
if [ $family -lt 6 ]; then
|
[ $family -lt 6 ] && exit 0
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
/sbin/chkconfig --add microcode_ctl
|
/sbin/chkconfig --add microcode_ctl
|
||||||
|
|
||||||
%triggerpostun -- kernel-utils
|
%triggerpostun -- kernel-utils
|
||||||
# Only enable on Intel machines.
|
# Only enable on Intel 686's and above.
|
||||||
vendor=`cat /proc/cpuinfo | grep "^vendor_id" | sort -u | awk -F ": " '{ print $2 }'`
|
vendor=`cat /proc/cpuinfo | grep "^vendor_id" | sort -u | awk -F ": " '{ print $2 }'`
|
||||||
if [ "$vendor" != "GenuineIntel" ]; then
|
[ "$vendor" != "GenuineIntel" ] && exit 0
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
# Microcode wasn't available until 686's.
|
|
||||||
family=`cat /proc/cpuinfo | grep "^cpu family" | sort -u | awk -F ": " '{ print $2 }'`
|
family=`cat /proc/cpuinfo | grep "^cpu family" | sort -u | awk -F ": " '{ print $2 }'`
|
||||||
if [ $family -lt 6 ]; then
|
[ $family -lt 6 ] && exit 0
|
||||||
exit 0;
|
|
||||||
fi
|
|
||||||
/sbin/chkconfig --add microcode_ctl
|
/sbin/chkconfig --add microcode_ctl
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri Jan 14 2005 Dave Jones <davej@redhat.com>
|
* Fri Jan 14 2005 Dave Jones <davej@redhat.com>
|
||||||
- Only enable microcode_ctl service if the CPU is capable.
|
- Only enable microcode_ctl service if the CPU is capable.
|
||||||
|
- Prevent microcode_ctl getting restarted multiple times on initlevel change (#141581)
|
||||||
|
- Make restart/reload work properly
|
||||||
|
- Do nothing if not started by root.
|
||||||
|
|
||||||
* Wed Jan 12 2005 Dave Jones <davej@redhat.com>
|
* Wed Jan 12 2005 Dave Jones <davej@redhat.com>
|
||||||
- Adjust dev node location. (#144963)
|
- Adjust dev node location. (#144963)
|
||||||
|
Loading…
Reference in New Issue
Block a user