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