96 lines
2.8 KiB
Diff
96 lines
2.8 KiB
Diff
diff -urpN microcode_ctl-1.17.orig/Makefile microcode_ctl-1.17/Makefile
|
|
--- microcode_ctl-1.17.orig/Makefile 2011-03-24 10:28:12.553269014 +0100
|
|
+++ microcode_ctl-1.17/Makefile 2011-03-24 10:28:26.644387088 +0100
|
|
@@ -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 -urpN microcode_ctl-1.17.orig/microcode_ctl.c microcode_ctl-1.17/microcode_ctl.c
|
|
--- microcode_ctl-1.17.orig/microcode_ctl.c 2011-03-24 10:28:12.553269014 +0100
|
|
+++ microcode_ctl-1.17/microcode_ctl.c 2011-03-24 10:28:29.244262053 +0100
|
|
@@ -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,17 +52,19 @@ 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)
|
|
fprintf(stderr, "%s: cannot open source file '%s' errno=%d (%s)\n",
|
|
progname, filename, errno, strerror(errno));
|
|
- return errno;
|
|
+ goto end;
|
|
}
|
|
|
|
pos = microcode;
|
|
@@ -84,7 +86,7 @@ static int do_update(char *device, char
|
|
fprintf(stderr, "%s: file too large for utility microcode buffer\n"
|
|
"%s: change MAX_MICROCODE yourself :)\n", progname, progname);
|
|
fclose(fp);
|
|
- return errno;
|
|
+ goto end;
|
|
}
|
|
|
|
}
|
|
@@ -98,16 +100,16 @@ static int do_update(char *device, char
|
|
if(print_error_messages)
|
|
fprintf(stderr, "%s: cannot open %s for writing errno=%d (%s)\n",
|
|
progname, device, errno, strerror(errno));
|
|
- return errno;
|
|
+ goto end;
|
|
}
|
|
|
|
- if( (wrote = write(outfd, µcode, 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",
|
|
progname, device, errno, strerror(errno), progname);
|
|
close(outfd);
|
|
- return errno;
|
|
+ goto end;
|
|
}
|
|
|
|
if((wrote == length) && print_normal_messages)
|
|
@@ -116,6 +118,8 @@ static int do_update(char *device, char
|
|
|
|
close(outfd);
|
|
|
|
+end:
|
|
+ free(microcode);
|
|
return errno;
|
|
}
|
|
|