1 |
commit: db0abeb8d0505d7fd48b53bfc8a8e04e816f0142 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 24 19:36:01 2018 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 24 19:38:59 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db0abeb8 |
7 |
|
8 |
sys-firmware/intel-microcode: re-release with new (old) license |
9 |
|
10 |
Package-Manager: Portage-2.3.48, Repoman-2.3.10 |
11 |
|
12 |
sys-firmware/intel-microcode/Manifest | 1 + |
13 |
.../intel-microcode-20180807a_p20180808.ebuild | 254 +++++++++++++++++++++ |
14 |
2 files changed, 255 insertions(+) |
15 |
|
16 |
diff --git a/sys-firmware/intel-microcode/Manifest b/sys-firmware/intel-microcode/Manifest |
17 |
index 727072e8dee..026eb2bfe9d 100644 |
18 |
--- a/sys-firmware/intel-microcode/Manifest |
19 |
+++ b/sys-firmware/intel-microcode/Manifest |
20 |
@@ -1,2 +1,3 @@ |
21 |
DIST intel-microcode-collection-20180808.tar.xz 4463768 BLAKE2B bf04d00db7e11b7ef6da9b4221aa2dfae1a20a39ab2f99ad78e735c9cf0f1d9a949b81ceba740238da98d34a934d8829b6882714ec21a1ffa3c1a7dfcfbfdcc6 SHA512 e5607127464c71e3ed413ca3b66cde0b5b994d837655208997841ec5358c32bb197f4ad0123b19bae4254aa35770cfec32cf2780f2cb5dd5f0a00d1ca14cf93c |
22 |
DIST microcode-20180807.tgz 1629357 BLAKE2B ce60ef5a5ba794cb4a618739a6134e3b0a660d5e2a09c39ff1fcd7312a3d0b5e763674fb8f8cd39899544d1136253b98930a0160db9c937135effbb912823b58 SHA512 a69576afb6c8ec401e9e169ee208be7d57ee3292ec6689c783729d3fa624b1fdaa74803874c2afa09768c8ee955da913c2cbabeb3d7c7a1dc1f7965d950ccdfb |
23 |
+DIST microcode-20180807a.tgz 1628061 BLAKE2B a6b5a07596a0b1687efb95c207b2194865b2f975cc0d761a687d5b9d8fea63e777eb73373113f356a18592fd53651cf37d044d4e98cdfe6b306393b54ac06129 SHA512 3cd6794a5ce26e86f7b644e523ba978699316046e593da215b73b17c4b43049ac4a81636e2ce3e727d06c2efbac98657764aa3ff355edb429127585bb49a9b10 |
24 |
|
25 |
diff --git a/sys-firmware/intel-microcode/intel-microcode-20180807a_p20180808.ebuild b/sys-firmware/intel-microcode/intel-microcode-20180807a_p20180808.ebuild |
26 |
new file mode 100644 |
27 |
index 00000000000..07477ef7fae |
28 |
--- /dev/null |
29 |
+++ b/sys-firmware/intel-microcode/intel-microcode-20180807a_p20180808.ebuild |
30 |
@@ -0,0 +1,254 @@ |
31 |
+# Copyright 1999-2018 Gentoo Foundation |
32 |
+# Distributed under the terms of the GNU General Public License v2 |
33 |
+ |
34 |
+EAPI="6" |
35 |
+ |
36 |
+inherit linux-info toolchain-funcs mount-boot |
37 |
+ |
38 |
+# Find updates by searching and clicking the first link (hopefully it's the one): |
39 |
+# https://www.intel.com/content/www/us/en/search.html?keyword=Processor+Microcode+Data+File |
40 |
+ |
41 |
+COLLECTION_SNAPSHOT="${PV##*_p}" |
42 |
+INTEL_SNAPSHOT="${PV/_p*}" |
43 |
+NUM="28087" |
44 |
+DESCRIPTION="Intel IA32/IA64 microcode update data" |
45 |
+HOMEPAGE="http://inertiawar.com/microcode/ https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=${NUM}" |
46 |
+SRC_URI="https://downloadmirror.intel.com/${NUM}/eng/microcode-${INTEL_SNAPSHOT}.tgz |
47 |
+ https://dev.gentoo.org/~whissi/dist/intel-microcode/intel-microcode-collection-${COLLECTION_SNAPSHOT}.tar.xz" |
48 |
+ |
49 |
+LICENSE="intel-ucode" |
50 |
+SLOT="0" |
51 |
+KEYWORDS="-* ~amd64 ~x86" |
52 |
+IUSE="hostonly initramfs +split-ucode vanilla" |
53 |
+REQUIRED_USE="|| ( initramfs split-ucode )" |
54 |
+ |
55 |
+DEPEND="sys-apps/iucode_tool" |
56 |
+ |
57 |
+# !<sys-apps/microcode-ctl-1.17-r2 due to bug #268586 |
58 |
+RDEPEND="!<sys-apps/microcode-ctl-1.17-r2 |
59 |
+ hostonly? ( sys-apps/iucode_tool )" |
60 |
+ |
61 |
+RESTRICT="binchecks bindist mirror strip" |
62 |
+ |
63 |
+S=${WORKDIR} |
64 |
+ |
65 |
+# Blacklist bad microcode here. |
66 |
+# 0x000406f1 aka 06-4f-01 aka CPUID 406F1 require newer microcode loader |
67 |
+MICROCODE_BLACKLIST_DEFAULT="-s !0x000406f1" |
68 |
+MICROCODE_BLACKLIST="${MICROCODE_BLACKLIST:=${MICROCODE_BLACKLIST_DEFAULT}}" |
69 |
+ |
70 |
+# In case we want to set some defaults ... |
71 |
+MICROCODE_SIGNATURES_DEFAULT="" |
72 |
+ |
73 |
+# Advanced users only: |
74 |
+# merge with: |
75 |
+# only current CPU: MICROCODE_SIGNATURES="-S" |
76 |
+# only specific CPU: MICROCODE_SIGNATURES="-s 0x00000f4a -s 0x00010676" |
77 |
+# exclude specific CPU: MICROCODE_SIGNATURES="-s !0x00000686" |
78 |
+MICROCODE_SIGNATURES="${MICROCODE_SIGNATURES:=${MICROCODE_SIGNATURES_DEFAULT}}" |
79 |
+ |
80 |
+pkg_pretend() { |
81 |
+ use initramfs && mount-boot_pkg_pretend |
82 |
+} |
83 |
+ |
84 |
+src_prepare() { |
85 |
+ default |
86 |
+ |
87 |
+ # Prevent "invalid file format" errors from iucode_tool |
88 |
+ rm -f "${S}"/intel-ucod*/list || die |
89 |
+} |
90 |
+ |
91 |
+src_install() { |
92 |
+ # This will take ALL of the upstream microcode sources: |
93 |
+ # - microcode.dat |
94 |
+ # - intel-ucode/ |
95 |
+ # In some cases, they have not contained the same content (eg the directory has newer stuff). |
96 |
+ MICROCODE_SRC=( |
97 |
+ "${S}"/intel-ucode/ |
98 |
+ "${S}"/intel-ucode-with-caveats/ |
99 |
+ ) |
100 |
+ |
101 |
+ # Allow users who are scared about microcode updates not included in Intel's official |
102 |
+ # microcode tarball to opt-out and comply with Intel marketing |
103 |
+ if ! use vanilla; then |
104 |
+ MICROCODE_SRC+=( "${S}"/intel-microcode-collection-${COLLECTION_SNAPSHOT} ) |
105 |
+ fi |
106 |
+ |
107 |
+ opts=( |
108 |
+ ${MICROCODE_BLACKLIST} |
109 |
+ ${MICROCODE_SIGNATURES} |
110 |
+ # be strict about what we are doing |
111 |
+ --overwrite |
112 |
+ --strict-checks |
113 |
+ --no-ignore-broken |
114 |
+ # we want to install latest version |
115 |
+ --no-downgrade |
116 |
+ # show everything we find |
117 |
+ --list-all |
118 |
+ # show what we selected |
119 |
+ --list |
120 |
+ ) |
121 |
+ |
122 |
+ # The earlyfw cpio needs to be in /boot because it must be loaded before |
123 |
+ # rootfs is mounted. |
124 |
+ use initramfs && dodir /boot && opts+=( --write-earlyfw="${ED%/}"/boot/intel-uc.img ) |
125 |
+ # split location (we use a temporary location so that we are able |
126 |
+ # to re-run iucode_tool in pkg_preinst; use keepdir instead of dodir to carry |
127 |
+ # this folder to pkg_preinst to avoid an error even if no microcode was selected): |
128 |
+ keepdir /tmp/intel-ucode && opts+=( --write-firmware="${ED%/}"/tmp/intel-ucode ) |
129 |
+ |
130 |
+ iucode_tool \ |
131 |
+ "${opts[@]}" \ |
132 |
+ "${MICROCODE_SRC[@]}" \ |
133 |
+ || die "iucode_tool ${opts[@]} ${MICROCODE_SRC[@]}" |
134 |
+ |
135 |
+ dodoc releasenote |
136 |
+ |
137 |
+ # Record how package was created so we can show this in build.log |
138 |
+ # even for binary packages. |
139 |
+ if [[ "${MICROCODE_BLACKLIST}" != "${MICROCODE_BLACKLIST_DEFAULT}" ]]; then |
140 |
+ echo ${MICROCODE_BLACKLIST} > "${ED%/}/tmp/.blacklist_altered" || die "Failed to add marker that MICROCODE_BLACKLIST variable was used" |
141 |
+ fi |
142 |
+ |
143 |
+ if [[ "${MICROCODE_SIGNATURES}" != "${MICROCODE_SIGNATURES_DEFAULT}" ]]; then |
144 |
+ echo ${MICROCODE_SIGNATURES} > "${ED%/}/tmp/.signatures_altered" || die "Failed to add marker that MICROCODE_SIGNATURES variable was used" |
145 |
+ fi |
146 |
+} |
147 |
+ |
148 |
+pkg_preinst() { |
149 |
+ if [[ -f "${ED%/}/tmp/.blacklist_altered" ]]; then |
150 |
+ local _recorded_MICROCODE_BLACKLIST_value=$(cat "${ED%/}/tmp/.blacklist_altered") |
151 |
+ ewarn "MICROCODE_BLACKLIST is set to \"${_recorded_MICROCODE_BLACKLIST_value}\" instead of default \"${MICROCODE_BLACKLIST_DEFAULT}\". You are on your own!" |
152 |
+ fi |
153 |
+ |
154 |
+ if [[ -f "${ED%/}/tmp/.signatures_altered" ]]; then |
155 |
+ local _recorded_MICROCODE_SIGNATURES_value=$(cat "${ED%/}/tmp/.signatures_altered") |
156 |
+ ewarn "Package was created using advanced options:" |
157 |
+ ewarn "MICROCODE_SIGNATURES is set to \"${_recorded_MICROCODE_SIGNATURES_value}\" instead of default \"${MICROCODE_SIGNATURES_DEFAULT}\"!" |
158 |
+ fi |
159 |
+ |
160 |
+ # Make sure /boot is available if needed. |
161 |
+ use initramfs && mount-boot_pkg_preinst |
162 |
+ |
163 |
+ local _initramfs_file="${ED%/}/boot/intel-uc.img" |
164 |
+ local _ucode_dir="${ED%/}/lib/firmware/intel-ucode" |
165 |
+ |
166 |
+ if use hostonly; then |
167 |
+ # While this output looks redundant we do this check to detect |
168 |
+ # rare cases where iucode_tool was unable to detect system's processor(s). |
169 |
+ local _detected_processors=$(iucode_tool --scan-system 2>&1) |
170 |
+ if [[ -z "${_detected_processors}" ]]; then |
171 |
+ ewarn "Looks like iucode_tool was unable to detect any processor!" |
172 |
+ else |
173 |
+ einfo "Only installing ucode(s) for ${_detected_processors#iucode_tool: system has } due to USE=hostonly ..." |
174 |
+ fi |
175 |
+ |
176 |
+ opts=( |
177 |
+ --scan-system |
178 |
+ # be strict about what we are doing |
179 |
+ --overwrite |
180 |
+ --strict-checks |
181 |
+ --no-ignore-broken |
182 |
+ # we want to install latest version |
183 |
+ --no-downgrade |
184 |
+ # show everything we find |
185 |
+ --list-all |
186 |
+ # show what we selected |
187 |
+ --list |
188 |
+ ) |
189 |
+ |
190 |
+ # The earlyfw cpio needs to be in /boot because it must be loaded before |
191 |
+ # rootfs is mounted. |
192 |
+ use initramfs && opts+=( --write-earlyfw=${_initramfs_file} ) |
193 |
+ # split location: |
194 |
+ use split-ucode && dodir /lib/firmware/intel-ucode && opts+=( --write-firmware=${_ucode_dir} ) |
195 |
+ |
196 |
+ iucode_tool \ |
197 |
+ "${opts[@]}" \ |
198 |
+ "${ED%/}"/tmp/intel-ucode \ |
199 |
+ || die "iucode_tool ${opts[@]} ${ED%/}/tmp/intel-ucode" |
200 |
+ |
201 |
+ else |
202 |
+ if use split-ucode; then |
203 |
+ # Temporary /tmp/intel-ucode will become final /lib/firmware/intel-ucode ... |
204 |
+ dodir /lib/firmware |
205 |
+ mv "${ED%/}/tmp/intel-ucode" "${ED%/}/lib/firmware" || die "Failed to install splitted ucodes!" |
206 |
+ fi |
207 |
+ fi |
208 |
+ |
209 |
+ # Because it is possible that this package will install not one single file |
210 |
+ # due to user selection which is still somehow unexpected we add the following |
211 |
+ # check to inform user so that the user has at least a chance to detect |
212 |
+ # a problem/invalid select. |
213 |
+ local _has_installed_something= |
214 |
+ if use initramfs && [[ -s "${_initramfs_file}" ]]; then |
215 |
+ _has_installed_something="yes" |
216 |
+ elif use split-ucode; then |
217 |
+ _has_installed_something=$(find "${_ucode_dir}" -maxdepth 0 -not -empty -exec echo yes \;) |
218 |
+ fi |
219 |
+ |
220 |
+ if use hostonly && [[ -n "${_has_installed_something}" ]]; then |
221 |
+ elog "You only installed ucode(s) for all currently available (=online)" |
222 |
+ elog "processor(s). Remember to re-emerge this package whenever you" |
223 |
+ elog "change the system's processor model." |
224 |
+ elog "" |
225 |
+ elif [[ -z "${_has_installed_something}" ]]; then |
226 |
+ ewarn "WARNING:" |
227 |
+ if [[ -f "${ED%/}/tmp/.signatures_altered" ]]; then |
228 |
+ ewarn "No ucode was installed! Because you have created this package" |
229 |
+ ewarn "using MICROCODE_SIGNATURES variable please double check if you" |
230 |
+ ewarn "have an invalid select." |
231 |
+ ewarn "It's rare but it is also possible that just no ucode update" |
232 |
+ ewarn "is available for your processor(s). In this case it is safe" |
233 |
+ ewarn "to ignore this warning." |
234 |
+ else |
235 |
+ ewarn "No ucode was installed! It's rare but it is also possible" |
236 |
+ ewarn "that just no ucode update is available for your processor(s)." |
237 |
+ ewarn "In this case it is safe to ignore this warning." |
238 |
+ fi |
239 |
+ |
240 |
+ ewarn "" |
241 |
+ |
242 |
+ if use hostonly; then |
243 |
+ ewarn "Unset \"hostonly\" USE flag to install all available ucodes." |
244 |
+ ewarn "" |
245 |
+ fi |
246 |
+ fi |
247 |
+ |
248 |
+ # Cleanup any temporary leftovers so that we don't merge any |
249 |
+ # unneeded files on disk. |
250 |
+ rm -r "${ED%/}/tmp" || die "Failed to cleanup '${ED%/}/tmp'" |
251 |
+} |
252 |
+ |
253 |
+pkg_prerm() { |
254 |
+ # Make sure /boot is mounted so that we can remove /boot/intel-uc.img! |
255 |
+ use initramfs && mount-boot_pkg_prerm |
256 |
+} |
257 |
+ |
258 |
+pkg_postrm() { |
259 |
+ # Don't forget to umount /boot if it was previously mounted by us. |
260 |
+ use initramfs && mount-boot_pkg_postrm |
261 |
+} |
262 |
+ |
263 |
+pkg_postinst() { |
264 |
+ # Don't forget to umount /boot if it was previously mounted by us. |
265 |
+ use initramfs && mount-boot_pkg_postinst |
266 |
+ |
267 |
+ # We cannot give detailed information if user is affected or not: |
268 |
+ # If MICROCODE_BLACKLIST wasn't modified, user can still use MICROCODE_SIGNATURES |
269 |
+ # to to force a specific, otherwise blacklisted, microcode. So we |
270 |
+ # only show a generic warning based on running kernel version: |
271 |
+ if kernel_is -lt 4 14 34; then |
272 |
+ ewarn "${P} contains microcode updates which require" |
273 |
+ ewarn "additional kernel patches which aren't yet included in kernel <4.14.34." |
274 |
+ ewarn "Loading such a microcode through kernel interface from an unpatched kernel" |
275 |
+ ewarn "can crash your system!" |
276 |
+ ewarn "" |
277 |
+ ewarn "Those microcodes are blacklisted per default. However, if you have altered" |
278 |
+ ewarn "MICROCODE_BLACKLIST or MICROCODE_SIGNATURES, you maybe have unintentionally" |
279 |
+ ewarn "re-enabled those microcodes...!" |
280 |
+ ewarn "" |
281 |
+ ewarn "Check \"${EROOT%/}/usr/share/doc/${PN}-*/releasenot*\" if your microcode update" |
282 |
+ ewarn "requires additional kernel patches or not." |
283 |
+ fi |
284 |
+} |