From fde91236cc7b45ecffa5c48a7cd8b30ff75752cf Mon Sep 17 00:00:00 2001 From: Anton Arapov Date: May 23 2017 16:46:09 +0000 Subject: Release. Intel CPU microcode update. 20170511 Signed-off-by: Anton Arapov --- diff --git a/Changelog b/Changelog index f89066e..a1edbdd 100644 --- a/Changelog +++ b/Changelog @@ -1,8 +1,11 @@ +2.1-12 23 May 2017, Anton Arapov + Intel CPU microcode update. 20170511 + 2.1-11 02 December 2016, Anton Arapov - Intel CPU microcode update. 20161104 + Intel CPU microcode update. 20161104 2.1-10 21 July 2016, Anton Arapov - Intel CPU microcode update. 20160714 + Intel CPU microcode update. 20160714 2.1-9 24 June 2016, Anton Arapov Intel CPU microcode update. 20160607 diff --git a/Makefile b/Makefile index d8a80cb..5a0285c 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,7 @@ # as published by the Free Software Foundation; either version # 2 of the License, or (at your option) any later version. -PROGRAM = intel-microcode2ucode -MICROCODE_INTEL = microcode-20161104.tgz +MICROCODE_INTEL = microcode-20170511.tgz INS = install CC = gcc @@ -17,29 +16,23 @@ CFLAGS = -g -Wall -O2 DESTDIR = PREFIX = /usr/local -INSDIR = $(PREFIX)/sbin DOCDIR = $(PREFIX)/share/doc/microcode_ctl MICDIR = /lib/firmware MICDIRINTEL = $(MICDIR)/intel-ucode -all: microcode_ctl - -microcode_ctl: intel-microcode2ucode.c - $(CC) $(CFLAGS) -o $(PROGRAM) intel-microcode2ucode.c - tar -xOf $(MICROCODE_INTEL) | ./intel-microcode2ucode - >/dev/null +all: + tar -xf $(MICROCODE_INTEL) intel-ucode clean: - rm -rf $(PROGRAM) intel-ucode + rm -rf intel-ucode install: - $(INS) -d $(DESTDIR)$(INSDIR) $(DESTDIR)$(DOCDIR) \ + $(INS) -d $(DESTDIR)$(DOCDIR) \ $(DESTDIR)$(MICDIRINTEL) - $(INS) -m 755 $(PROGRAM) $(DESTDIR)$(INSDIR) $(INS) -m 644 README $(DESTDIR)$(DOCDIR) $(INS) -m 644 intel-ucode/* $(DESTDIR)$(MICDIRINTEL) uninstall: - rm -rf $(DESTDIR)$(INSDIR)/$(PROGRAM) \ - $(DESTDIR)$(MICDIRINTEL) \ + rm -rf $(DESTDIR)$(MICDIRINTEL) \ $(DESTDIR)$(DOCDIR) diff --git a/intel-microcode2ucode.c b/intel-microcode2ucode.c deleted file mode 100644 index 2da30ca..0000000 --- a/intel-microcode2ucode.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Convert Intel microcode.dat into individual ucode files - * named: intel-ucode/$family-$model-$stepping - * - * The subdir intel-ucode/ is created in the current working - * directory. We get multiple ucodes in the same file, so they - * are appended to an existing file. Make sure the directory - * is empty before every run of the converter. - * - * Kay Sievers - * Anton Arapov - */ - - -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct microcode_header_intel { - unsigned int hdrver; - unsigned int rev; - unsigned int date; - unsigned int sig; - unsigned int cksum; - unsigned int ldrver; - unsigned int pf; - unsigned int datasize; - unsigned int totalsize; - unsigned int reserved[3]; -}; - -union mcbuf { - struct microcode_header_intel hdr; - unsigned int i[0]; - char c[0]; -}; - -int main(int argc, char *argv[]) -{ - char *filename = "/lib/firmware/microcode.dat"; - FILE *input, *f; - char line[LINE_MAX]; - char buf[4000000]; - union mcbuf *mc; - size_t bufsize, count, start; - int rc = EXIT_SUCCESS; - - if (argv[1] != NULL) - filename = argv[1]; - - if (!strcmp(filename, "-")) { - input = stdin; - } else { - input = fopen(filename, "re"); - if (input == NULL) { - printf("open %s: %m\n", filename); - rc = EXIT_FAILURE; - goto out; - } - } - - count = 0; - mc = (union mcbuf *) buf; - while (fgets(line, sizeof(line), input) != NULL) { - if (sscanf(line, "%x, %x, %x, %x", - &mc->i[count], - &mc->i[count + 1], - &mc->i[count + 2], - &mc->i[count + 3]) != 4) - continue; - count += 4; - } - fclose(input); - - bufsize = count * sizeof(int); - printf("%s: %lu(%luk) bytes, %zu integers\n", - filename, - bufsize, - bufsize / 1024, - count); - - if (bufsize < sizeof(struct microcode_header_intel)) - goto out; - - mkdir("intel-ucode", 0750); - - start = 0; - for (;;) { - size_t size; - unsigned int family, model, stepping; - unsigned int year, month, day; - - mc = (union mcbuf *) &buf[start]; - - if (mc->hdr.totalsize) - size = mc->hdr.totalsize; - else - size = 2000 + sizeof(struct microcode_header_intel); - - if (mc->hdr.ldrver != 1 || mc->hdr.hdrver != 1) { - printf("unknown version/format:\n"); - rc = EXIT_FAILURE; - break; - } - - /* - * 0- 3 stepping - * 4- 7 model - * 8-11 family - * 12-13 type - * 16-19 extended model - * 20-27 extended family - */ - family = (mc->hdr.sig >> 8) & 0xf; - if (family == 0xf) - family += (mc->hdr.sig >> 20) & 0xff; - model = (mc->hdr.sig >> 4) & 0x0f; - if (family == 0x06) - model += ((mc->hdr.sig >> 16) & 0x0f) << 4; - stepping = mc->hdr.sig & 0x0f; - - year = mc->hdr.date & 0xffff; - month = mc->hdr.date >> 24; - day = (mc->hdr.date >> 16) & 0xff; - - asprintf(&filename, "intel-ucode/%02x-%02x-%02x", family, model, stepping); - printf("\n"); - printf("%s\n", filename); - printf("signature: 0x%02x\n", mc->hdr.sig); - printf("flags: 0x%02x\n", mc->hdr.pf); - printf("revision: 0x%02x\n", mc->hdr.rev); - printf("date: %04x-%02x-%02x\n", year, month, day); - printf("size: %zu\n", size); - - f = fopen(filename, "ae"); - if (f == NULL) { - printf("open %s: %m\n", filename); - rc = EXIT_FAILURE; - goto out; - } - if (fwrite(mc, size, 1, f) != 1) { - printf("write %s: %m\n", filename); - rc = EXIT_FAILURE; - goto out; - } - fclose(f); - free(filename); - - start += size; - if (start >= bufsize) - break; - } - printf("\n"); - - out: - return rc; -} diff --git a/microcode-20161104.tgz b/microcode-20161104.tgz deleted file mode 100644 index 387ce26..0000000 Binary files a/microcode-20161104.tgz and /dev/null differ diff --git a/microcode-20170511.tgz b/microcode-20170511.tgz new file mode 100644 index 0000000..b5a5247 Binary files /dev/null and b/microcode-20170511.tgz differ diff --git a/microcode_ctl.spec b/microcode_ctl.spec index 0e94c78..6d6487e 100644 --- a/microcode_ctl.spec +++ b/microcode_ctl.spec @@ -1,7 +1,7 @@ Summary: Tool to transform and deploy CPU microcode update for x86. Name: microcode_ctl Version: 2.1 -Release: 11 +Release: 12 Group: System Environment/Base License: GPLv2+ and Redistributable, no modification permitted URL: http://fedorahosted.org/microcode_ctl