aboutsummaryrefslogtreecommitdiff
path: root/non-free
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-12-05 11:27:54 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2018-12-05 19:34:17 +0100
commit8204be095a670386f7464f27f067d843db3330bd (patch)
treec19649f132d30255dbe6b758409e1392dc0b4712 /non-free
parent5b59b876d70c3ede55476f91c9c05ec51a160fca (diff)
downloadalpine_aports-8204be095a670386f7464f27f067d843db3330bd.tar.bz2
alpine_aports-8204be095a670386f7464f27f067d843db3330bd.tar.xz
alpine_aports-8204be095a670386f7464f27f067d843db3330bd.zip
non-free/intel-ucode: fix build and clean up license
Diffstat (limited to 'non-free')
-rw-r--r--non-free/intel-ucode/APKBUILD28
-rw-r--r--non-free/intel-ucode/LICENSE123
-rw-r--r--non-free/intel-ucode/intel-microcode2ucode.c156
3 files changed, 11 insertions, 296 deletions
diff --git a/non-free/intel-ucode/APKBUILD b/non-free/intel-ucode/APKBUILD
index 488a35e777..82c0cef369 100644
--- a/non-free/intel-ucode/APKBUILD
+++ b/non-free/intel-ucode/APKBUILD
@@ -6,30 +6,24 @@ pkgdesc="Microcode update files for Intel CPUs"
6arch=noarch 6arch=noarch
7url="https://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22" 7url="https://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22"
8license="custom" 8license="custom"
9source="https://downloadmirror.intel.com/28087/eng/microcode-$pkgver.tgz 9makedepens="iucode-tool"
10 LICENSE 10source="https://downloadmirror.intel.com/28087/eng/microcode-$pkgver.tgz"
11 intel-microcode2ucode.c"
12options="!check" 11options="!check"
13 12
14build() { 13build() {
15 cd "$srcdir" 14 cd "$srcdir"
16 gcc -Wall ${CFLAGS} -o intel-microcode2ucode intel-microcode2ucode.c 15 rm -f intel-ucode/list intel-ucode-with-caveats/list
17 ./intel-microcode2ucode ./microcode.dat 16 mkdir -p kernel/x86/microcode
17 iucode_tool -w kernel/x86/microcode/GenuineIntel.bin \
18 intel-ucode/ intel-ucode-with-caveats/
19 echo kernel/x86/microcode/GenuineIntel.bin | \
20 cpio -o -H newc -R 0:0 > intel-ucode.img
18} 21}
19 22
20package() { 23package() {
21 cd "$srcdir" 24 cd "$srcdir"
22 25 install -D -m0644 intel-ucode.img "$pkgdir"/boot/intel-ucode.img
23 install -d -m755 "$pkgdir"/boot 26 install -Dm644 license "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
24 mkdir -p kernel/x86/microcode
25 mv microcode.bin kernel/x86/microcode/GenuineIntel.bin
26
27 echo kernel/x86/microcode/GenuineIntel.bin | \
28 cpio -o -H newc -R 0:0 > "$pkgdir"/boot/intel-ucode.img
29
30 install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
31} 27}
32 28
33sha512sums="3cd6794a5ce26e86f7b644e523ba978699316046e593da215b73b17c4b43049ac4a81636e2ce3e727d06c2efbac98657764aa3ff355edb429127585bb49a9b10 microcode-20180807a.tgz 29sha512sums="3cd6794a5ce26e86f7b644e523ba978699316046e593da215b73b17c4b43049ac4a81636e2ce3e727d06c2efbac98657764aa3ff355edb429127585bb49a9b10 microcode-20180807a.tgz"
34d80ce9087e2ffd0168600a34de195d6514d3a496bc233294cd838498e1ce668b9ad4463bbbe7958feec0421b5aed3ade1633432ce086241e03ed06bbd53b83a5 LICENSE
35ee60f968acab4067f5660449eabae533b5d3996cd59fd4b69d0e23e0b264da216ab6e6ccd554222cf355fc14dbd348562a2d36a87a60f1f54433603e04998cd1 intel-microcode2ucode.c"
diff --git a/non-free/intel-ucode/LICENSE b/non-free/intel-ucode/LICENSE
deleted file mode 100644
index c05358c0f8..0000000000
--- a/non-free/intel-ucode/LICENSE
+++ /dev/null
@@ -1,123 +0,0 @@
1INTEL SOFTWARE LICENSE AGREEMENT
2
3IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING.
4Do not use or load this software and any associated materials (collectively,
5the "Software") until you have carefully read the following terms and
6conditions. By loading or using the Software, you agree to the terms of this
7Agreement. If you do not wish to so agree, do not install or use the Software.
8
9LICENSES: Please Note:
10- If you are a network administrator, the "Site License" below shall
11apply to you.
12- If you are an end user, the "Single User License" shall apply to you.
13- If you are an original equipment manufacturer (OEM), the "OEM License"
14shall apply to you.
15
16SITE LICENSE. You may copy the Software onto your organization's computers
17for your organization's use, and you may make a reasonable number of
18back-up copies of the Software, subject to these conditions:
19
201. This Software is licensed for use only in conjunction with Intel
21component products. Use of the Software in conjunction with non-Intel
22component products is not licensed hereunder.
232. You may not copy, modify, rent, sell, distribute or transfer any part
24of the Software except as provided in this Agreement, and you agree to
25prevent unauthorized copying of the Software.
263. You may not reverse engineer, decompile, or disassemble the Software.
274. You may not sublicense or permit simultaneous use of the Software by
28more than one user.
295. The Software may include portions offered on terms in addition to those
30set out here, as set out in a license accompanying those portions.
31
32SINGLE USER LICENSE. You may copy the Software onto a single computer for
33your personal, noncommercial use, and you may make one back-up copy of the
34Software, subject to these conditions:
35
361. This Software is licensed for use only in conjunction with Intel
37component products. Use of the Software in conjunction with non-Intel
38component products is not licensed hereunder.
392. You may not copy, modify, rent, sell, distribute or transfer any part
40of the Software except as provided in this Agreement, and you agree to
41prevent unauthorized copying of the Software.
423. You may not reverse engineer, decompile, or disassemble the Software.
434. You may not sublicense or permit simultaneous use of the Software by
44more than one user.
455. The Software may include portions offered on terms in addition to those
46set out here, as set out in a license accompanying those portions.
47
48OEM LICENSE: You may reproduce and distribute the Software only as an
49integral part of or incorporated in Your product or as a standalone
50Software maintenance update for existing end users of Your products,
51excluding any other standalone products, subject to these conditions:
52
531. This Software is licensed for use only in conjunction with Intel
54component products. Use of the Software in conjunction with non-Intel
55component products is not licensed hereunder.
562. You may not copy, modify, rent, sell, distribute or transfer any part
57of the Software except as provided in this Agreement, and you agree to
58prevent unauthorized copying of the Software.
593. You may not reverse engineer, decompile, or disassemble the Software.
604. You may only distribute the Software to your customers pursuant to a
61written license agreement. Such license agreement may be a "break-the-
62seal" license agreement. At a minimum such license shall safeguard
63Intel's ownership rights to the Software.
645. The Software may include portions offered on terms in addition to those
65set out here, as set out in a license accompanying those portions.
66
67NO OTHER RIGHTS. No rights or licenses are granted by Intel to You, expressly
68or by implication, with respect to any proprietary information or patent,
69copyright, mask work, trademark, trade secret, or other intellectual property
70right owned or controlled by Intel, except as expressly provided in this
71Agreement.
72
73OWNERSHIP OF SOFTWARE AND COPYRIGHTS. Title to all copies of the Software
74remains with Intel or its suppliers. The Software is copyrighted and
75protected by the laws of the United States and other countries, and
76international treaty provisions. You may not remove any copyright notices
77from the Software. Intel may make changes to the Software, or to items
78referenced therein, at any time without notice, but is not obligated to
79support or update the Software. Except as otherwise expressly provided, Intel
80grants no express or implied right under Intel patents, copyrights,
81trademarks, or other intellectual property rights. You may transfer the
82Software only if the recipient agrees to be fully bound by these terms and if
83you retain no copies of the Software.
84
85LIMITED MEDIA WARRANTY. If the Software has been delivered by Intel on
86physical media, Intel warrants the media to be free from material physical
87defects for a period of ninety days after delivery by Intel. If such a defect
88is found, return the media to Intel for replacement or alternate delivery of
89the Software as Intel may select.
90
91EXCLUSION OF OTHER WARRANTIES. EXCEPT AS PROVIDED ABOVE, THE SOFTWARE IS
92PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND
93INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A
94PARTICULAR PURPOSE. Intel does not warrant or assume responsibility for the
95accuracy or completeness of any information, text, graphics, links or other
96items contained within the Software.
97
98LIMITATION OF LIABILITY. IN NO EVENT SHALL INTEL OR ITS SUPPLIERS BE LIABLE
99FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, LOST PROFITS,
100BUSINESS INTERRUPTION, OR LOST INFORMATION) ARISING OUT OF THE USE OF OR
101INABILITY TO USE THE SOFTWARE, EVEN IF INTEL HAS BEEN ADVISED OF THE
102POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS PROHIBIT EXCLUSION OR
103LIMITATION OF LIABILITY FOR IMPLIED WARRANTIES OR CONSEQUENTIAL OR INCIDENTAL
104DAMAGES, SO THE ABOVE LIMITATION MAY NOT APPLY TO YOU. YOU MAY ALSO HAVE
105OTHER LEGAL RIGHTS THAT VARY FROM JURISDICTION TO JURISDICTION.
106
107TERMINATION OF THIS AGREEMENT. Intel may terminate this Agreement at any time
108if you violate its terms. Upon termination, you will immediately destroy the
109Software or return all copies of the Software to Intel.
110
111APPLICABLE LAWS. Claims arising under this Agreement shall be governed by the
112laws of California, excluding its principles of conflict of laws and the
113United Nations Convention on Contracts for the Sale of Goods. You may not
114export the Software in violation of applicable export laws and regulations.
115Intel is not obligated under any other agreements unless they are in writing
116and signed by an authorized representative of Intel.
117
118GOVERNMENT RESTRICTED RIGHTS. The Software is provided with "RESTRICTED
119RIGHTS." Use, duplication, or disclosure by the Government is subject to
120restrictions as set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or its
121successor. Use of the Software by the Government constitutes acknowledgment
122of Intel's proprietary rights therein. Contractor or Manufacturer is Intel
1232200 Mission College Blvd., Santa Clara, CA 95052.
diff --git a/non-free/intel-ucode/intel-microcode2ucode.c b/non-free/intel-ucode/intel-microcode2ucode.c
deleted file mode 100644
index fe410ac86e..0000000000
--- a/non-free/intel-ucode/intel-microcode2ucode.c
+++ /dev/null
@@ -1,156 +0,0 @@
1/*
2 * Convert Intel microcode.dat into a single binary microcode.bin file
3 *
4 * Based on code by Kay Sievers <kay.sievers@vrfy.org>
5 * Changed to create a single file by Thomas Bächler <thomas@archlinux.org>
6 */
7
8
9#ifndef _GNU_SOURCE
10# define _GNU_SOURCE 1
11#endif
12
13#include <stdio.h>
14#include <unistd.h>
15#include <stdlib.h>
16#include <string.h>
17#include <time.h>
18#include <limits.h>
19#include <stdbool.h>
20#include <inttypes.h>
21#include <fcntl.h>
22#include <errno.h>
23#include <sys/stat.h>
24
25struct microcode_header_intel {
26 unsigned int hdrver;
27 unsigned int rev;
28 unsigned int date;
29 unsigned int sig;
30 unsigned int cksum;
31 unsigned int ldrver;
32 unsigned int pf;
33 unsigned int datasize;
34 unsigned int totalsize;
35 unsigned int reserved[3];
36};
37
38union mcbuf {
39 struct microcode_header_intel hdr;
40 unsigned int i[0];
41 char c[0];
42};
43
44int main(int argc, char *argv[])
45{
46 const char *filename = "/lib/firmware/microcode.dat";
47 FILE *f;
48 char line[LINE_MAX];
49 char buf[4000000];
50 union mcbuf *mc;
51 size_t bufsize, count, start;
52 int rc = EXIT_SUCCESS;
53
54 if (argv[1] != NULL)
55 filename = argv[1];
56
57 count = 0;
58 mc = (union mcbuf *) buf;
59 f = fopen(filename, "re");
60 if (f == NULL) {
61 printf("open %s: %m\n", filename);
62 rc = EXIT_FAILURE;
63 goto out;
64 }
65
66 while (fgets(line, sizeof(line), f) != NULL) {
67 if (sscanf(line, "%x, %x, %x, %x",
68 &mc->i[count],
69 &mc->i[count + 1],
70 &mc->i[count + 2],
71 &mc->i[count + 3]) != 4)
72 continue;
73 count += 4;
74 }
75 fclose(f);
76
77 bufsize = count * sizeof(int);
78 printf("%s: %lu(%luk) bytes, %zu integers\n",
79 filename,
80 bufsize,
81 bufsize / 1024,
82 count);
83
84 if (bufsize < sizeof(struct microcode_header_intel))
85 goto out;
86
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
94 start = 0;
95 for (;;) {
96 size_t size;
97 unsigned int family, model, stepping, type;
98 unsigned int year, month, day;
99
100 mc = (union mcbuf *) &buf[start];
101
102 if (mc->hdr.totalsize)
103 size = mc->hdr.totalsize;
104 else
105 size = 2000 + sizeof(struct microcode_header_intel);
106
107 if (mc->hdr.ldrver != 1 || mc->hdr.hdrver != 1) {
108 printf("unknown version/format:\n");
109 rc = EXIT_FAILURE;
110 break;
111 }
112
113 /*
114 * 0- 3 stepping
115 * 4- 7 model
116 * 8-11 family
117 * 12-13 type
118 * 16-19 extended model
119 * 20-27 extended family
120 */
121 stepping = mc->hdr.sig & 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)
126 model += ((mc->hdr.sig >> 16) & 0x0f) << 4;
127 if (family == 0x0f)
128 family += (mc->hdr.sig >> 20) & 0xff;
129
130 year = mc->hdr.date & 0xffff;
131 month = mc->hdr.date >> 24;
132 day = (mc->hdr.date >> 16) & 0xff;
133
134 printf("\n");
135 printf("signature: 0x%02x (stepping %d, model %d, family %d, type %d)\n",
136 mc->hdr.sig, stepping, model, family, type);
137 printf("flags: 0x%02x\n", mc->hdr.pf);
138 printf("revision: 0x%02x\n", mc->hdr.rev);
139 printf("date: %04x-%02x-%02x\n", year, month, day);
140 printf("size: %zu\n", size);
141
142 if (fwrite(mc, size, 1, f) != 1) {
143 printf("write microcode.bin: %m\n");
144 rc = EXIT_FAILURE;
145 goto out;
146 }
147
148 start += size;
149 if (start >= bufsize)
150 break;
151 }
152 fclose(f);
153 printf("\n");
154out:
155 return rc;
156}