diff options
author | Marian Buschsieweke <marian.buschsieweke@ovgu.de> | 2017-06-26 15:13:27 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2017-06-27 06:49:17 +0000 |
commit | 641e27116b9f61c8f86aa62108d607cd6c514a89 (patch) | |
tree | 7fd7325c5c86de5e8b78fb76a6974b4180fb09c9 /non-free | |
parent | fe2d4fd44dda9dfe064a31f29986de87ea080da8 (diff) | |
download | alpine_aports-641e27116b9f61c8f86aa62108d607cd6c514a89.tar.bz2 alpine_aports-641e27116b9f61c8f86aa62108d607cd6c514a89.tar.xz alpine_aports-641e27116b9f61c8f86aa62108d607cd6c514a89.zip |
non-free/intel-ucode: Update to 20170511
In the context of the recent Skylake/Kaby Lake hyper-threading bug [1], an
update of the intel microcode seems to be quite relevant. The resulting
package will contain "/boot/intel-ucode.img", which needs to be added as
first initial ram drive. This is achieved in extlinux by chaining the line
INITRD=linux-$tag
to
INITRD=intel-ucode.img,linux-$tag
See [2] for more details. If this packet is accepted, changing
/sbin/update-extlinux to check for "/boot/init-ucode.img" and adding it
as first INITRD on detection seems to be a good idea.
All credit goes to Thomas Bächler [3], from whom I shamelessly stole the build
recipe.
[1] https://lists.debian.org/debian-devel/2017/06/msg00308.html
[2] https://wiki.archlinux.org/index.php/Microcode#Syslinux
[3] https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/intel-ucode
Diffstat (limited to 'non-free')
-rw-r--r-- | non-free/intel-ucode/APKBUILD | 30 | ||||
-rw-r--r-- | non-free/intel-ucode/intel-microcode2ucode.c | 47 |
2 files changed, 35 insertions, 42 deletions
diff --git a/non-free/intel-ucode/APKBUILD b/non-free/intel-ucode/APKBUILD index 82ec5d1204..5652fa6590 100644 --- a/non-free/intel-ucode/APKBUILD +++ b/non-free/intel-ucode/APKBUILD | |||
@@ -1,34 +1,34 @@ | |||
1 | # Maintainer: Marian Buschsieweke <marian.buschsieweke@ovgu.de> | ||
1 | pkgname=intel-ucode | 2 | pkgname=intel-ucode |
2 | pkgver=20130222 | 3 | pkgver=20170511 |
3 | pkgrel=0 | 4 | pkgrel=0 |
4 | pkgdesc="Microcode update files for Intel CPUs" | 5 | pkgdesc="Microcode update files for Intel CPUs" |
5 | arch=noarch | 6 | arch=noarch |
6 | url="http://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22" | 7 | url="http://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22" |
7 | license='custom' | 8 | license='custom' |
8 | source="http://downloadmirror.intel.com/22508/eng/microcode-${pkgver}.tgz | 9 | source="http://downloadmirror.intel.com/26798/eng/microcode-${pkgver}.tgz |
9 | LICENSE | 10 | LICENSE |
10 | intel-microcode2ucode.c" | 11 | intel-microcode2ucode.c" |
12 | options="!check" | ||
11 | 13 | ||
12 | build() { | 14 | build() { |
13 | cd "$srcdir" | 15 | cd "$srcdir" |
14 | gcc -Wall ${CFLAGS} -o intel-microcode2ucode \ | 16 | gcc -Wall ${CFLAGS} -o intel-microcode2ucode intel-microcode2ucode.c |
15 | intel-microcode2ucode.c || return 1 | 17 | ./intel-microcode2ucode ./microcode.dat |
16 | ./intel-microcode2ucode ./microcode.dat || return 1 | ||
17 | } | 18 | } |
18 | 19 | ||
19 | package() { | 20 | package() { |
20 | cd "$srcdir" | 21 | cd "$srcdir" |
21 | install -d -m755 "${pkgdir}"/usr/lib/firmware/intel-ucode/ || return 1 | 22 | |
22 | cp intel-ucode/* "${pkgdir}"/usr/lib/firmware/intel-ucode/ || return 1 | 23 | install -d -m755 "${pkgdir}"/boot |
24 | |||
25 | mkdir -p kernel/x86/microcode | ||
26 | mv microcode.bin kernel/x86/microcode/GenuineIntel.bin | ||
27 | echo kernel/x86/microcode/GenuineIntel.bin | cpio -o -H newc -R 0:0 > "${pkgdir}"/boot/intel-ucode.img | ||
28 | |||
23 | install -D -m644 LICENSE \ | 29 | install -D -m644 LICENSE \ |
24 | "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE || return 1 | 30 | "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE || return 1 |
25 | } | 31 | } |
26 | md5sums="e2dd0f73dc9882aa26aaade76139aee1 microcode-20130222.tgz | 32 | sha512sums="4e2066096d56430c2df73631f15cf16f2317c1d8ff745d7b7cdd784ebccc2b797565eb52703cce9b4238774dbfdcaecacd892d729b7869fdfd7644008ce74a60 microcode-20170511.tgz |
27 | b0f489ae4b3e36dc8827dc53a76047aa LICENSE | ||
28 | 0efc5f6c74a4d7e61ca22683c93c98cf intel-microcode2ucode.c" | ||
29 | sha256sums="fd25bd9777fc3c3b11f01e9090a2d24f7650023c9ec74bbf9f43bffe1d9d01cc microcode-20130222.tgz | ||
30 | 6983e83ec10c6467fb9101ea496e0443f0574c805907155118e2c9f0bbea97b6 LICENSE | ||
31 | c51b1b1d8b4b28e7d5d007917c1e444af1a2ff04a9408aa9067c0e57d70164de intel-microcode2ucode.c" | ||
32 | sha512sums="7ba41a8e0f79beeb046750e30b6a9a181ed53a524f80db78cb9fe3e09bb9fdce664bf5a99882aa139d12e3a98aa5ecae316c950003bab3c69d890a5f223308f0 microcode-20130222.tgz | ||
33 | d80ce9087e2ffd0168600a34de195d6514d3a496bc233294cd838498e1ce668b9ad4463bbbe7958feec0421b5aed3ade1633432ce086241e03ed06bbd53b83a5 LICENSE | 33 | d80ce9087e2ffd0168600a34de195d6514d3a496bc233294cd838498e1ce668b9ad4463bbbe7958feec0421b5aed3ade1633432ce086241e03ed06bbd53b83a5 LICENSE |
34 | 0e29f995dee47707026cfb6224580c2166d000e91af7b1afe12f00158be8606093d07cdbc0d583a0af79370cf1d9c16b5f35a306bae7f545a5c774ea253509b7 intel-microcode2ucode.c" | 34 | ee60f968acab4067f5660449eabae533b5d3996cd59fd4b69d0e23e0b264da216ab6e6ccd554222cf355fc14dbd348562a2d36a87a60f1f54433603e04998cd1 intel-microcode2ucode.c" |
diff --git a/non-free/intel-ucode/intel-microcode2ucode.c b/non-free/intel-ucode/intel-microcode2ucode.c index caad0323e8..fe410ac86e 100644 --- a/non-free/intel-ucode/intel-microcode2ucode.c +++ b/non-free/intel-ucode/intel-microcode2ucode.c | |||
@@ -1,13 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Convert Intel microcode.dat into individual ucode files | 2 | * Convert Intel microcode.dat into a single binary microcode.bin file |
3 | * named: intel-ucode/$family-$model-$stepping | ||
4 | * | 3 | * |
5 | * The subdir intel-ucode/ is created in the current working | 4 | * Based on code by Kay Sievers <kay.sievers@vrfy.org> |
6 | * directory. We get multiple ucodes in the same file, so they | 5 | * Changed to create a single file by Thomas Bächler <thomas@archlinux.org> |
7 | * are appended to an existing file. Make sure the directory | ||
8 | * is empty before every run of the converter. | ||
9 | * | ||
10 | * Kay Sievers <kay.sievers@vrfy.org> | ||
11 | */ | 6 | */ |
12 | 7 | ||
13 | 8 | ||
@@ -48,7 +43,7 @@ union mcbuf { | |||
48 | 43 | ||
49 | int main(int argc, char *argv[]) | 44 | int main(int argc, char *argv[]) |
50 | { | 45 | { |
51 | char *filename = "/lib/firmware/microcode.dat"; | 46 | const char *filename = "/lib/firmware/microcode.dat"; |
52 | FILE *f; | 47 | FILE *f; |
53 | char line[LINE_MAX]; | 48 | char line[LINE_MAX]; |
54 | char buf[4000000]; | 49 | char buf[4000000]; |
@@ -89,12 +84,17 @@ int main(int argc, char *argv[]) | |||
89 | if (bufsize < sizeof(struct microcode_header_intel)) | 84 | if (bufsize < sizeof(struct microcode_header_intel)) |
90 | goto out; | 85 | goto out; |
91 | 86 | ||
92 | mkdir("intel-ucode", 0750); | 87 | f = fopen("microcode.bin", "we"); |
88 | if (f == NULL) { | ||
89 | printf("open microcode.bin: %m\n"); | ||
90 | rc = EXIT_FAILURE; | ||
91 | goto out; | ||
92 | } | ||
93 | 93 | ||
94 | start = 0; | 94 | start = 0; |
95 | for (;;) { | 95 | for (;;) { |
96 | size_t size; | 96 | size_t size; |
97 | unsigned int family, model, stepping; | 97 | unsigned int family, model, stepping, type; |
98 | unsigned int year, month, day; | 98 | unsigned int year, month, day; |
99 | 99 | ||
100 | mc = (union mcbuf *) &buf[start]; | 100 | mc = (union mcbuf *) &buf[start]; |
@@ -118,45 +118,38 @@ int main(int argc, char *argv[]) | |||
118 | * 16-19 extended model | 118 | * 16-19 extended model |
119 | * 20-27 extended family | 119 | * 20-27 extended family |
120 | */ | 120 | */ |
121 | family = (mc->hdr.sig >> 8) & 0xf; | 121 | stepping = mc->hdr.sig & 0x0f; |
122 | if (family == 0xf) | ||
123 | family += (mc->hdr.sig >> 20) & 0xff; | ||
124 | model = (mc->hdr.sig >> 4) & 0x0f; | 122 | model = (mc->hdr.sig >> 4) & 0x0f; |
123 | family = (mc->hdr.sig >> 8) & 0x0f; | ||
124 | type = (mc->hdr.sig >> 12) & 0x0f; | ||
125 | if (family == 0x06) | 125 | if (family == 0x06) |
126 | model += ((mc->hdr.sig >> 16) & 0x0f) << 4; | 126 | model += ((mc->hdr.sig >> 16) & 0x0f) << 4; |
127 | stepping = mc->hdr.sig & 0x0f; | 127 | if (family == 0x0f) |
128 | family += (mc->hdr.sig >> 20) & 0xff; | ||
128 | 129 | ||
129 | year = mc->hdr.date & 0xffff; | 130 | year = mc->hdr.date & 0xffff; |
130 | month = mc->hdr.date >> 24; | 131 | month = mc->hdr.date >> 24; |
131 | day = (mc->hdr.date >> 16) & 0xff; | 132 | day = (mc->hdr.date >> 16) & 0xff; |
132 | 133 | ||
133 | asprintf(&filename, "intel-ucode/%02x-%02x-%02x", family, model, stepping); | ||
134 | printf("\n"); | 134 | printf("\n"); |
135 | printf("%s\n", filename); | 135 | printf("signature: 0x%02x (stepping %d, model %d, family %d, type %d)\n", |
136 | printf("signature: 0x%02x\n", mc->hdr.sig); | 136 | mc->hdr.sig, stepping, model, family, type); |
137 | printf("flags: 0x%02x\n", mc->hdr.pf); | 137 | printf("flags: 0x%02x\n", mc->hdr.pf); |
138 | printf("revision: 0x%02x\n", mc->hdr.rev); | 138 | printf("revision: 0x%02x\n", mc->hdr.rev); |
139 | printf("date: %04x-%02x-%02x\n", year, month, day); | 139 | printf("date: %04x-%02x-%02x\n", year, month, day); |
140 | printf("size: %zu\n", size); | 140 | printf("size: %zu\n", size); |
141 | 141 | ||
142 | f = fopen(filename, "ae"); | ||
143 | if (f == NULL) { | ||
144 | printf("open %s: %m\n", filename); | ||
145 | rc = EXIT_FAILURE; | ||
146 | goto out; | ||
147 | } | ||
148 | if (fwrite(mc, size, 1, f) != 1) { | 142 | if (fwrite(mc, size, 1, f) != 1) { |
149 | printf("write %s: %m\n", filename); | 143 | printf("write microcode.bin: %m\n"); |
150 | rc = EXIT_FAILURE; | 144 | rc = EXIT_FAILURE; |
151 | goto out; | 145 | goto out; |
152 | } | 146 | } |
153 | fclose(f); | ||
154 | free(filename); | ||
155 | 147 | ||
156 | start += size; | 148 | start += size; |
157 | if (start >= bufsize) | 149 | if (start >= bufsize) |
158 | break; | 150 | break; |
159 | } | 151 | } |
152 | fclose(f); | ||
160 | printf("\n"); | 153 | printf("\n"); |
161 | out: | 154 | out: |
162 | return rc; | 155 | return rc; |