- Make microcode_ctl event driven (Bill Nottingham ) Resolves rhbz#479898
This commit is contained in:
parent
734422963a
commit
1fad0c77e5
@ -1,79 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# chkconfig: 2345 0 99
|
|
||||||
# description: script to apply cpu microcode
|
|
||||||
|
|
||||||
# Check that we're a priviledged user
|
|
||||||
[ `id -u` = 0 ] || exit 0
|
|
||||||
|
|
||||||
DATAFILE=/lib/firmware/microcode.dat
|
|
||||||
|
|
||||||
. /etc/init.d/functions
|
|
||||||
|
|
||||||
RETVAL=0
|
|
||||||
|
|
||||||
# perform the update
|
|
||||||
function start ()
|
|
||||||
{
|
|
||||||
RETVAL=1
|
|
||||||
|
|
||||||
# Intel 686 and above, AMD family 16 and above
|
|
||||||
vendor=`grep "^vendor_id" /proc/cpuinfo | head -n1 | awk -F ": " '{ print $2 }'`
|
|
||||||
family=`grep "^cpu family" /proc/cpuinfo | head -n1 | awk -F ": " '{ print $2 }'`
|
|
||||||
|
|
||||||
if [ "$vendor" = "GenuineIntel" ] && [ $family -ge 6 ]; then
|
|
||||||
echo -n $"Applying Intel CPU microcode update: "
|
|
||||||
elif [ "$vendor" = "AuthenticAMD" ] && [ $family -ge 16 ]; then
|
|
||||||
echo $"Loading AMD microcode update module"
|
|
||||||
/sbin/modprobe microcode
|
|
||||||
return
|
|
||||||
else
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e $DATAFILE ]; then
|
|
||||||
echo $"$0: CPU microcode data file not present ($DATAFILE)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
/sbin/modprobe microcode
|
|
||||||
|
|
||||||
lt=0
|
|
||||||
while [ ! -c /dev/cpu/microcode ]; do
|
|
||||||
lt=$[lt+1];
|
|
||||||
[ $lt -gt 5 ] && break;
|
|
||||||
sleep 0.1;
|
|
||||||
done
|
|
||||||
|
|
||||||
/sbin/microcode_ctl -Qu
|
|
||||||
RETVAL=$?
|
|
||||||
|
|
||||||
/sbin/rmmod microcode
|
|
||||||
|
|
||||||
return $RETVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
stop()
|
|
||||||
{
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
start
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stop
|
|
||||||
;;
|
|
||||||
restart|reload|force-reload)
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo $"Usage: $0 {start|stop|restart}"
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
exit $?
|
|
||||||
|
|
3
microcode_ctl.rules
Normal file
3
microcode_ctl.rules
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
KERNEL=="cpu[0-9]*", RUN+="/sbin/modprobe microcode"
|
||||||
|
KERNEL=="microcode", RUN+="/sbin/microcode_ctl -Qu"
|
||||||
|
|
@ -1,22 +1,22 @@
|
|||||||
Summary: Tool to update x86/x86-64 CPU microcode.
|
Summary: Tool to update x86/x86-64 CPU microcode.
|
||||||
Name: microcode_ctl
|
Name: microcode_ctl
|
||||||
Version: 1.17
|
Version: 1.17
|
||||||
Release: %(R="$Revision$"; RR="${R##: }"; echo ${RR%%?})%{?dist}
|
Release: 2%{?dist}
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://www.urbanmyth.org/microcode/
|
URL: http://www.urbanmyth.org/microcode/
|
||||||
Source0: http://www.urbanmyth.org/microcode/microcode_ctl-%{version}.tar.gz
|
Source0: http://www.urbanmyth.org/microcode/microcode_ctl-%{version}.tar.gz
|
||||||
Source1: microcode_ctl.init
|
Source1: microcode_ctl.rules
|
||||||
# Microcode now distributed directly by Intel, at
|
# Microcode now distributed directly by Intel, at
|
||||||
# http://downloadcenter.intel.com (just search for microcode)
|
# http://downloadcenter.intel.com (just search for microcode)
|
||||||
Source2: microcode-20100209.dat
|
Source2: microcode-20100209.dat
|
||||||
# http://www.amd64.org/support/microcode.html
|
# http://www.amd64.org/support/microcode.html
|
||||||
Source3: amd-ucode-2009-10-09.tar
|
Source3: amd-ucode-2009-10-09.tar
|
||||||
Buildroot: %{_tmppath}/%{name}-%{version}-root
|
Buildroot: %{_tmppath}/%{name}-%{version}-root
|
||||||
|
Requires: udev
|
||||||
Requires(pre): /sbin/chkconfig /sbin/service
|
Requires(pre): /sbin/chkconfig /sbin/service
|
||||||
Requires(pre): grep gawk coreutils
|
Requires(pre): grep gawk coreutils
|
||||||
Obsoletes: kernel-utils
|
|
||||||
ExclusiveArch: %{ix86} x86_64
|
ExclusiveArch: %{ix86} x86_64
|
||||||
|
|
||||||
Patch1: microcode_ctl.patch
|
Patch1: microcode_ctl.patch
|
||||||
@ -42,7 +42,10 @@ mkdir -p %{buildroot}/lib/firmware/amd-ucode/
|
|||||||
make DESTDIR=%{buildroot} PREFIX=%{_prefix} \
|
make DESTDIR=%{buildroot} PREFIX=%{_prefix} \
|
||||||
INSDIR=/sbin MANDIR=%{_mandir}/man8 RCDIR=%{_sysconfdir} install clean
|
INSDIR=/sbin MANDIR=%{_mandir}/man8 RCDIR=%{_sysconfdir} install clean
|
||||||
|
|
||||||
install %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/microcode_ctl
|
rm -rf %{buildroot}/etc/*
|
||||||
|
|
||||||
|
mkdir -p %{buildroot}/lib/udev/rules.d
|
||||||
|
install -m 644 %{SOURCE1} %{buildroot}/lib/udev/rules.d/89-microcode.rules
|
||||||
install -m 644 %{SOURCE2} %{buildroot}/lib/firmware/microcode.dat
|
install -m 644 %{SOURCE2} %{buildroot}/lib/firmware/microcode.dat
|
||||||
|
|
||||||
install -m 644 amd-ucode-2009-10-09/microcode_amd.bin %{buildroot}/lib/firmware/amd-ucode/microcode_amd.bin
|
install -m 644 amd-ucode-2009-10-09/microcode_amd.bin %{buildroot}/lib/firmware/amd-ucode/microcode_amd.bin
|
||||||
@ -57,51 +60,22 @@ rm -rf %{buildroot}
|
|||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%{_sysconfdir}/init.d/microcode_ctl
|
|
||||||
/lib/firmware/*
|
/lib/firmware/*
|
||||||
|
/lib/udev/rules.d/*
|
||||||
/sbin/microcode_ctl
|
/sbin/microcode_ctl
|
||||||
%doc LICENSE.microcode_amd README.microcode_amd INSTALL.microcode_amd
|
%doc LICENSE.microcode_amd README.microcode_amd INSTALL.microcode_amd
|
||||||
%attr(0644,root,root) %{_mandir}/*/*
|
%attr(0644,root,root) %{_mandir}/*/*
|
||||||
|
|
||||||
|
%triggerun -- microcode_ctl < 1:1.17-2
|
||||||
|
/sbin/chkconfig --del microcode_ctl
|
||||||
%preun
|
|
||||||
if [ "$1" = "0" ] ; then
|
|
||||||
/sbin/chkconfig --del microcode_ctl
|
|
||||||
fi
|
|
||||||
|
|
||||||
%post
|
|
||||||
# Only enable on Intel 686's and above or AMD family 0x10 and above
|
|
||||||
vendor=`cat /proc/cpuinfo | grep "^vendor_id" | sort -u | awk -F ": " '{ print $2 }'`
|
|
||||||
family=`cat /proc/cpuinfo | grep "^cpu family" | sort -u | awk -F ": " '{ print $2 }'`
|
|
||||||
if [ "$vendor" = "GenuineIntel" ]; then
|
|
||||||
[ $family -lt 6 ] && exit 0
|
|
||||||
elif [ "$vendor" = "AuthenticAMD" ]; then
|
|
||||||
[ $family -lt 16 ] && exit 0
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
/sbin/chkconfig --add microcode_ctl
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
%triggerpostun -- kernel-utils
|
|
||||||
# Only enable on Intel 686's and above or AMD family 0x10 and above
|
|
||||||
vendor=`cat /proc/cpuinfo | grep "^vendor_id" | sort -u | awk -F ": " '{ print $2 }'`
|
|
||||||
family=`cat /proc/cpuinfo | grep "^cpu family" | sort -u | awk -F ": " '{ print $2 }'`
|
|
||||||
if [ "$vendor" = "GenuineIntel" ]; then
|
|
||||||
[ $family -lt 6 ] && exit 0
|
|
||||||
elif [ "$vendor" = "AuthenticAMD" ]; then
|
|
||||||
[ $family -lt 16 ] && exit 0
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
/sbin/chkconfig --add microcode_ctl
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Feb 11 2010 Dave Jones <davej@redhat.com>
|
* Mon Mar 22 2010 Anton Arapov <anton@redhat.com> 1.17-2
|
||||||
|
- Make microcode_ctl event driven (Bill Nottingham ) Resolves rhbz#479898
|
||||||
|
|
||||||
|
* Thu Feb 11 2010 Dave Jones <davej@redhat.com> 1.17-1.58
|
||||||
- Update to microcode-20100209.dat
|
- Update to microcode-20100209.dat
|
||||||
|
|
||||||
* Fri Dec 04 2009 Kyle McMartin <kyle@redhat.com> 1.17-1.57
|
* Fri Dec 04 2009 Kyle McMartin <kyle@redhat.com> 1.17-1.57
|
||||||
|
Loading…
Reference in New Issue
Block a user