microcode_ctl/microcode_ctl.patch
2008-02-22 20:01:12 +00:00

60 lines
2.0 KiB
Diff

diff -Naurp microcode_ctl-1.17.orig/Makefile microcode_ctl-1.17/Makefile
--- microcode_ctl-1.17.orig/Makefile 2007-04-26 06:59:44.000000000 -0400
+++ microcode_ctl-1.17/Makefile 2008-02-05 11:22:23.000000000 -0500
@@ -20,8 +20,8 @@ DESTDIR =
PREFIX = /usr/local
INSDIR = $(PREFIX)/sbin
-MANDIR = $(PREFIX)/man/man8
-MICDIR = /etc
+MANDIR = $(PREFIX)/share/man/man8
+MICDIR = /lib/firmware
RCFILE = microcode_ctl.start
RCFILEFINAL = microcode_ctl
@@ -44,7 +44,7 @@ install:
$(DESTDIR)$(MANDIR) $(DESTDIR)$(RCFILETO) \
$(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 $(MANPAGE) $(DESTDIR)$(MANDIR)
diff -Naurp microcode_ctl-1.17.orig/microcode_ctl.c microcode_ctl-1.17/microcode_ctl.c
--- microcode_ctl-1.17.orig/microcode_ctl.c 2006-06-28 10:51:31.000000000 -0400
+++ microcode_ctl-1.17/microcode_ctl.c 2008-02-05 11:21:31.000000000 -0500
@@ -25,7 +25,7 @@ int print_error_messages=1;
#define MAX_MICROCODE 2000000
#define MICROCODE_DEVICE_DEFAULT "/dev/cpu/microcode"
-#define MICROCODE_FILE_DEFAULT "/etc/microcode.dat"
+#define MICROCODE_FILE_DEFAULT "/lib/firmware/microcode.dat"
static void usage(void)
{
@@ -52,11 +52,13 @@ static int do_update(char *device, char
{
FILE *fp;
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( (fp=fopen(filename, "r")) == NULL){
if(print_error_messages)
@@ -101,7 +103,7 @@ static int do_update(char *device, char
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",