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