auto-import microcode_ctl-1.10-1.1 on branch devel from

microcode_ctl-1.10-1.1.src.rpm
This commit is contained in:
Dave Jones 2005-01-08 08:23:02 +00:00
parent 079465ba7b
commit e4b3410eba
5 changed files with 233 additions and 0 deletions

View File

@ -0,0 +1 @@
microcode_ctl-1.10.tar.gz

86
microcode_ctl.init Executable file
View File

@ -0,0 +1,86 @@
#!/bin/bash
# chkconfig: - 0 99
# description: script to apply cpu microcode
# vars:
#
# START distribution specific way of kicking programs
# END distribution specific way of checking return status
# PROGRAM the executable to run
# ARGUMENTS the argument we're going to call PROGRAM with
DEVICE=/dev/cpu/0/microcode
ARGUMENTS=-Qu
RETVAL=0
PROGRAM=/sbin/microcode_ctl
# Lets just be sure we have a device file...
if [ ! -e $DEVICE ];
then
echo $"$0: microcode device $DEVICE doesn't exist?"
exit 1
elif [ ! -c $DEVICE ];
then
echo $"$0: $DEVICE not a character device?"
exit 1
fi
if [ ! -e /etc/firmware/microcode.dat ];
then
echo $"$0: microcode datafile not present (/etc/firmware/microcode.dat)"
exit 1
fi
. /etc/init.d/functions
# perform the update
function start ()
{
RETVAL=1
# Make sure we are on an intel machine
vendor=`cat /proc/cpuinfo | \
grep "^vendor_id" | sort -u | \
awk -F ": " '{ print $2 }'`
if [ "$vendor" != "GenuineIntel" ]; then
return
fi
# Microcode wasn't available until 686's.
family=`cat /proc/cpuinfo | \
grep "^cpu family" | sort -u | \
awk -F ": " '{ print $2 }'`
if [ $family -lt 6 ]; then
return
fi
echo -n $"Applying Intel Microcode update: "
daemon $PROGRAM $ARGUMENTS
RETVAL=$?
# trap the most common case, errno 19 = no device
if [ $RETVAL -eq 19 ];
then
echo $"$0: kernel does not have microcode device support"
fi
echo
}
case "$1" in
start|reload|force-reload|restart)
start
exit 0
;;
stop)
;;
status)
# I wonder when the driver will let us do this...
# maybe I'll write it ;)
echo $"$0: reading microcode status is not yet supported"
;;
*)
echo $"Usage: $0 {start|restart}"
exit 1
esac

74
microcode_ctl.patch Normal file
View File

@ -0,0 +1,74 @@
--- microcode_ctl-1.10/microcode_ctl.c~ Sat Apr 14 23:18:13 2001
+++ microcode_ctl-1.10/microcode_ctl.c Fri Dec 7 10:31:08 2001
@@ -36,8 +36,8 @@
#define BUFFER_SIZE 4096
#define MAX_MICROCODE 2000000
-#define MICROCODE_DEVICE_DEFAULT "/dev/cpu/microcode"
-#define MICROCODE_FILE_DEFAULT "/etc/microcode.dat"
+#define MICROCODE_DEVICE_DEFAULT "/dev/cpu/0/microcode"
+#define MICROCODE_FILE_DEFAULT "/etc/firmware/microcode.dat"
/* yuck */
#ifndef MICROCODE_IOCFREE
--- microcode_ctl-1.10/Makefile~ Mon Jun 11 16:57:42 2001
+++ microcode_ctl-1.10/Makefile Tue Jan 8 20:20:58 2002
@@ -20,7 +20,7 @@
PREFIX = /usr/local
INSDIR = $(PREFIX)/sbin
-MANDIR = $(PREFIX)/man/man8
+MANDIR = $(PREFIX)/share/man/man8
MICDIR = /etc
RCFILE = microcode_ctl.start
@@ -45,7 +45,7 @@
$(DESTDIR)$(RCLINKTO)
- $(INS) -s -m 755 $(PROGRAM) $(DESTDIR)$(INSDIR)
+ $(INS) -m 755 $(PROGRAM) $(DESTDIR)$(INSDIR)
- $(INS) -m 644 $(MICROCODE) $(DESTDIR)$(MICDIR)/microcode.dat
+ $(INS) -m 644 $(MICROCODE) $(DESTDIR)/etc/firmware/microcode.dat
$(INS) -m 644 $(MANPAGE) $(DESTDIR)$(MANDIR)
gzip -9f $(DESTDIR)$(MANDIR)/$(MANPAGE)
--- microcode_ctl-1.10/microcode_ctl.c~ 2004-10-28 20:37:08.000000000 -0400
+++ microcode_ctl-1.10/microcode_ctl.c 2004-10-28 20:37:35.000000000 -0400
@@ -168,7 +168,7 @@ int main(int argc, char *argv[])
if (upload) {
if((return_code = do_update(device, filename)))
- exit(return_code);
+ exit(0);
} else
usage();
--- microcode_ctl-1.10/microcode_ctl.c.org 2003-05-28 19:56:22.000000000 +0200
+++ microcode_ctl-1.10/microcode_ctl.c 2003-05-28 19:57:01.000000000 +0200
@@ -95,11 +95,13 @@
{
FILE *fd;
char line_buffer[BUFFER_SIZE];
- int microcode[MAX_MICROCODE];
+ int *microcode;
int *pos;
int outfd;
int wrote, length;
+ microcode=malloc(sizeof(int)* MAX_MICROCODE);
+ if (!microcode) return ENOMEM;
if( (fd=fopen(filename, "r")) == NULL){
if(print_error_messages)
--- microcode_ctl-1.10/microcode_ctl.c~ 2003-12-13 15:05:56.000000000 +0100
+++ microcode_ctl-1.10/microcode_ctl.c 2003-12-13 15:05:56.000000000 +0100
@@ -146,7 +146,7 @@
return errno;
}
- if( (wrote = write(outfd, &microcode, length)) < 0){
+ if( (wrote = write(outfd, microcode, length)) < 0){
if(print_error_messages)
fprintf(stderr, "%s: error writing to '%s' errno=%d (%s)\n"
"%s: there may be messages from the driver in your system log.\n",

71
microcode_ctl.spec Normal file
View File

@ -0,0 +1,71 @@
Summary: Tool to update x86/x86-64 CPU microcode.
Name: microcode_ctl
Version: 1.10
Release: %(R="$Revision$"; RR="${R##: }"; echo ${RR%%?})
Serial: 1
Group: System Environment/Base
License: GPL
Source0: microcode_ctl-1.10.tar.gz
Source1: microcode_ctl.init
Buildroot: %{_tmppath}/%{name}-%{version}-root
Prereq: /sbin/chkconfig /sbin/service
Requires: fileutils kudzu
Obsoletes: kernel-utils
ExclusiveArch: i386 x86_64
Patch1: microcode_ctl.patch
%description
microcode_ctl - updates the microcode on Intel x86/x86-64 CPU's
%prep
%setup -q -c
%patch1 -p0
%build
rm -rf $RPM_BUILD_ROOT
mkdir -p %{buildroot}/usr/sbin
mkdir -p %{buildroot}/usr/man
mkdir -p %{buildroot}/etc/rc.d/init.d
mkdir -p %{buildroot}/etc/sysconfig
cd microcode_ctl-1.10
make CFLAGS="$RPM_OPT_FLAGS"
cd ..
%install
mkdir -p %{buildroot}/usr/share/man/man{1,8}
cd microcode_ctl-1.10
make DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} \
INSDIR=/sbin MANDIR=%{_mandir}/man8 RCDIR=/etc MICDIR=/etc/firmware install clean
install %{SOURCE1} %{buildroot}/etc/rc.d/init.d/microcode_ctl
rm %{buildroot}/etc/init.d/microcode_ctl
cd ..
chmod -R a-s %{buildroot}
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
%files
%defattr(-,root,root)
/etc/rc.d/init.d/microcode_ctl
/etc/firmware/*
/sbin/microcode_ctl
%attr(0644,root,root) %{_mandir}/*/*
%preun
if [ "$1" = "0" ] ; then
/sbin/chkconfig --del microcode_ctl
fi
%post
/sbin/chkconfig --add microcode_ctl
%changelog
* Sat Dec 18 2004 Dave Jones <davej@redhat.com>
- Initial packaging, based upon kernel-utils.

View File

@ -0,0 +1 @@
ff8be753e5d5d7275495b7c99bdd55f3 microcode_ctl-1.10.tar.gz