Date: Monday, May 7, 2018 @ 21:14:00 Author: eworm Revision: 323460 upgpkg: intel-ucode 20180425-1
* new upstream release * use iucode-tool to build binary bundle * remove ancient upgrade instructions * general cleanups Modified: intel-ucode/trunk/PKGBUILD Deleted: intel-ucode/trunk/intel-microcode2ucode.c intel-ucode/trunk/intel-ucode.install -------------------------+ PKGBUILD | 34 ++++------ intel-microcode2ucode.c | 156 ---------------------------------------------- intel-ucode.install | 13 --- 3 files changed, 14 insertions(+), 189 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2018-05-07 21:10:30 UTC (rev 323459) +++ PKGBUILD 2018-05-07 21:14:00 UTC (rev 323460) @@ -2,39 +2,33 @@ # Maintainer: Thomas Bächler <tho...@archlinux.org> pkgname=intel-ucode -pkgver=20180312 +pkgver=20180425 # Some random "download id" that intel has in their downloadcenter -_dlid=27591 +_dlid=27776 pkgrel=1 -pkgdesc="Microcode update files for Intel CPUs" +pkgdesc='Microcode update files for Intel CPUs' arch=('any') -install=$pkgname.install -url="https://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=processor%20microcode%20data%20file" +url='https://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=processor%20microcode%20data%20file' replaces=('microcode_ctl') +makedepends=('iucode-tool') license=('custom') source=("https://downloadmirror.intel.com/${_dlid}/eng/microcode-${pkgver}.tgz" - 'LICENSE' - 'intel-microcode2ucode.c') -sha256sums=('0b381face2df1b0a829dc4fa8fa93f47f39e11b1c9c22ebd44f8614657c1e779' - '6983e83ec10c6467fb9101ea496e0443f0574c805907155118e2c9f0bbea97b6' - '5af76d7e23768c94ab03fbf0d280b30fccd9c1ce697111c9999f6d51955c5a98') + 'LICENSE') +sha256sums=('f0d2492f4561e2559f6c9471b231cb8262d45762c0e7cccf787be5c189b4e2d6' + '6983e83ec10c6467fb9101ea496e0443f0574c805907155118e2c9f0bbea97b6') build() { cd "$srcdir" - gcc -Wall ${CFLAGS} -o intel-microcode2ucode intel-microcode2ucode.c - - ./intel-microcode2ucode ./microcode.dat + rm -f intel-ucode{,-with-caveats}/list + mkdir -p kernel/x86/microcode + iucode_tool -w kernel/x86/microcode/GenuineIntel.bin intel-ucode{,-with-caveats}/ + echo kernel/x86/microcode/GenuineIntel.bin | bsdcpio -o -H newc -R 0:0 > intel-ucode.img } package() { cd "$srcdir" - install -d -m755 "${pkgdir}"/boot - - mkdir -p kernel/x86/microcode - mv microcode.bin kernel/x86/microcode/GenuineIntel.bin - echo kernel/x86/microcode/GenuineIntel.bin | bsdcpio -o -H newc -R 0:0 > "${pkgdir}"/boot/intel-ucode.img - - install -D -m644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE + install -D -m0644 intel-ucode.img "${pkgdir}"/boot/intel-ucode.img + install -D -m0644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE } Deleted: intel-microcode2ucode.c =================================================================== --- intel-microcode2ucode.c 2018-05-07 21:10:30 UTC (rev 323459) +++ intel-microcode2ucode.c 2018-05-07 21:14:00 UTC (rev 323460) @@ -1,156 +0,0 @@ -/* - * Convert Intel microcode.dat into a single binary microcode.bin file - * - * Based on code by Kay Sievers <kay.siev...@vrfy.org> - * Changed to create a single file by Thomas Bächler <tho...@archlinux.org> - */ - - -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#include <limits.h> -#include <stdbool.h> -#include <inttypes.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/stat.h> - -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[]) -{ - const char *filename = "/lib/firmware/microcode.dat"; - FILE *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]; - - count = 0; - mc = (union mcbuf *) buf; - f = fopen(filename, "re"); - if (f == NULL) { - printf("open %s: %m\n", filename); - rc = EXIT_FAILURE; - goto out; - } - - while (fgets(line, sizeof(line), f) != 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(f); - - 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; - - f = fopen("microcode.bin", "we"); - if (f == NULL) { - printf("open microcode.bin: %m\n"); - rc = EXIT_FAILURE; - goto out; - } - - start = 0; - for (;;) { - size_t size; - unsigned int family, model, stepping, type; - 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 - */ - stepping = mc->hdr.sig & 0x0f; - model = (mc->hdr.sig >> 4) & 0x0f; - family = (mc->hdr.sig >> 8) & 0x0f; - type = (mc->hdr.sig >> 12) & 0x0f; - if (family == 0x06) - model += ((mc->hdr.sig >> 16) & 0x0f) << 4; - if (family == 0x0f) - family += (mc->hdr.sig >> 20) & 0xff; - - year = mc->hdr.date & 0xffff; - month = mc->hdr.date >> 24; - day = (mc->hdr.date >> 16) & 0xff; - - printf("\n"); - printf("signature: 0x%02x (stepping %d, model %d, family %d, type %d)\n", - mc->hdr.sig, stepping, model, family, type); - 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); - - if (fwrite(mc, size, 1, f) != 1) { - printf("write microcode.bin: %m\n"); - rc = EXIT_FAILURE; - goto out; - } - - start += size; - if (start >= bufsize) - break; - } - fclose(f); - printf("\n"); -out: - return rc; -} Deleted: intel-ucode.install =================================================================== --- intel-ucode.install 2018-05-07 21:10:30 UTC (rev 323459) +++ intel-ucode.install 2018-05-07 21:14:00 UTC (rev 323460) @@ -1,13 +0,0 @@ -## arg 1: the new package version -## arg 2: the old package version -post_upgrade() { - if [ $(vercmp $2 20140913) -lt 0 ]; then - echo "Intel CPU ucode upgrades are no longer performed by the firmware loader." - echo "If you want to update the Intel CPU ucode on boot, add the file" - echo " /boot/intel-ucode.img" - echo "as the first initrd to your bootloader." - echo - echo "For more information, see:" - echo "https://wiki.archlinux.org/index.php/Microcode#Enabling_Intel_Microcode_Updates" - fi -}