diff options
Diffstat (limited to 'uselessPorts/intel-ucode')
-rw-r--r-- | uselessPorts/intel-ucode/.footprint | 97 | ||||
-rw-r--r-- | uselessPorts/intel-ucode/.md5sum | 1 | ||||
-rw-r--r-- | uselessPorts/intel-ucode/.signature | 5 | ||||
-rw-r--r-- | uselessPorts/intel-ucode/Pkgfile | 21 | ||||
-rw-r--r-- | uselessPorts/intel-ucode/intel-microcode2ucode.c | 154 | ||||
-rwxr-xr-x | uselessPorts/intel-ucode/lastVersion.sh | 8 |
6 files changed, 286 insertions, 0 deletions
diff --git a/uselessPorts/intel-ucode/.footprint b/uselessPorts/intel-ucode/.footprint new file mode 100644 index 0000000..5925d67 --- /dev/null +++ b/uselessPorts/intel-ucode/.footprint @@ -0,0 +1,97 @@ +drwxr-xr-x root/root lib/ +drwxr-xr-x root/root lib/firmware/ +drwxr-xr-x root/root lib/firmware/intel-ucode/ +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-03-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-05-00 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-05-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-05-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-05-03 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-06-00 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-06-05 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-06-0a +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-06-0d +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-07-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-07-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-07-03 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-08-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-08-03 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-08-06 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-08-0a +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-09-05 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0a-00 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0a-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0b-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0b-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0d-06 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0e-08 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0e-0c +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0f-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0f-06 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0f-07 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0f-0a +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0f-0b +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-0f-0d +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-16-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-17-06 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-17-07 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-17-0a +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-1a-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-1a-05 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-1c-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-1c-0a +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-1d-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-1e-05 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-25-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-25-05 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-26-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-2a-07 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-2d-06 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-2d-07 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-2f-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-3a-09 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-3c-03 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-3d-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-3e-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-3e-06 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-3e-07 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-3f-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-3f-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-45-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-46-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-47-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-4e-03 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-4f-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-55-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-56-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-56-03 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-56-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-5c-09 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-5e-03 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-7a-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-8e-09 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-8e-0a +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-9e-09 +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-9e-0a +-rwxr-xr-x root/root lib/firmware/intel-ucode/06-9e-0b +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-00-07 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-00-0a +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-01-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-02-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-02-05 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-02-06 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-02-07 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-02-09 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-03-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-03-03 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-03-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-04-01 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-04-03 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-04-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-04-07 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-04-08 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-04-09 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-04-0a +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-06-02 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-06-04 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-06-05 +-rwxr-xr-x root/root lib/firmware/intel-ucode/0f-06-08 diff --git a/uselessPorts/intel-ucode/.md5sum b/uselessPorts/intel-ucode/.md5sum new file mode 100644 index 0000000..2deb98e --- /dev/null +++ b/uselessPorts/intel-ucode/.md5sum @@ -0,0 +1 @@ +86eaa62cc558adc7c1613e6cf846e105 microcode_ctl-2.1-15.tar.xz diff --git a/uselessPorts/intel-ucode/.signature b/uselessPorts/intel-ucode/.signature new file mode 100644 index 0000000..01ff61c --- /dev/null +++ b/uselessPorts/intel-ucode/.signature @@ -0,0 +1,5 @@ +untrusted comment: verify with /etc/ports/deepthought.pub +RWQxCptPusLGGiQJ2iwQ0Z0ohczIAlXjXPO9RvHrnAyTBjmUHjgwzCuez8g5dh/YsTCYmDoBrcpmqRgEhoUboCGzNojNSepCZQw= +SHA256 (Pkgfile) = 2968f0b94029289a74ff313f0e05db1669db5eea5d268daba20ff8b5a3f81e05 +SHA256 (.footprint) = 0b367d1ea15cc7056f72f539b02ade49e6a6af47c09bf5d00112b5a1b3e5b2c0 +SHA256 (microcode_ctl-2.1-15.tar.xz) = 143db41045024bfb7cd409c44b4bef91dd47f7233f3e853d6cef5af9295c7677 diff --git a/uselessPorts/intel-ucode/Pkgfile b/uselessPorts/intel-ucode/Pkgfile new file mode 100644 index 0000000..6d9c23c --- /dev/null +++ b/uselessPorts/intel-ucode/Pkgfile @@ -0,0 +1,21 @@ +# Description: Microcode update for Intel CPUs +# URL: http://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22 +# Packager: Alan Mizrahi, alan at mizrahi dot com dot ve +# Maintainer: Erich Eckner, crux at eckner dot net +# Depends on: + +name=intel-ucode +version=2.1.15 +release=1 +dlVersion=${version%.*}-${version##*.} +source=( +https://src.fedoraproject.org/repo/pkgs/microcode_ctl/microcode_ctl-${dlVersion}.tar.xz/sha512/2c1c65b62de80ca958068f18b54c3c635415c45f83095d5dbf07c5c94776b0297c8ae8cf82271cc96d6ded9bf6e22c511f6a50523b307fd9e995d723621d63e7/microcode_ctl-${dlVersion}.tar.xz +) + +build() { +pwd +ls -la + cd microcode_ctl-${dlVersion} + make all + install -Dt $PKG/lib/firmware/intel-ucode/ intel-ucode/* +} diff --git a/uselessPorts/intel-ucode/intel-microcode2ucode.c b/uselessPorts/intel-ucode/intel-microcode2ucode.c new file mode 100644 index 0000000..c1660fa --- /dev/null +++ b/uselessPorts/intel-ucode/intel-microcode2ucode.c @@ -0,0 +1,154 @@ +/* + * Convert Intel microcode.dat into a single binary microcode.bin file + * + * Based on code by Kay Sievers <kay.sievers@vrfy.org> + * Changed to create a single file by Thomas Bächler <thomas@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; + 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; + + printf("\n"); + 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); + + 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; +} diff --git a/uselessPorts/intel-ucode/lastVersion.sh b/uselessPorts/intel-ucode/lastVersion.sh new file mode 100755 index 0000000..95846d3 --- /dev/null +++ b/uselessPorts/intel-ucode/lastVersion.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +curl "https://src.fedoraproject.org//repo/pkgs/microcode_ctl/" 2> /dev/null | \ + tr "\"" "\n" | \ + grep "^microcode_ctl-[0-9.]\+-[0-9]\+\.tar\.xz/\$" | \ + sed "s|^microcode_ctl-\([0-9.]\+\)-\([0-9]\+\)\.tar\.xz/\$|\1.\2|" | \ + sort -V | \ + tail -n1 |