Gentoo Archives: gentoo-commits

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