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, 14 Jan 2019 02:39:13
Message-Id: 1547433491.200158e49aa112bd65d32c24981ea8219dc3234c.whissi@gentoo
1 commit: 200158e49aa112bd65d32c24981ea8219dc3234c
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 14 02:37:59 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 14 02:38:11 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=200158e4
7
8 sys-firmware/intel-microcode: bump
9
10 - New microcodes:
11
12 sig 0x00050656, pf_mask 0xbf, 2018-12-03, rev 0x4000013
13 sig 0x00050657, pf_mask 0xbf, 2018-12-03, rev 0x5000013
14 sig 0x000706e0, pf_mask 0xc0, 2018-05-28, rev 0x002a
15 sig 0x000706e1, pf_mask 0x80, 2018-11-19, rev 0x002e
16 sig 0x000706e2, pf_mask 0x80, 2018-11-19, rev 0x002e
17
18 - Updated microcodes:
19
20 sig 0x00050654, pf_mask 0xb7, 2018-10-08, rev 0x2000055 -> 2018-10-22, rev 0x2000057
21 sig 0x00050655, pf_mask 0xb7, 2018-06-15, rev 0x300000d -> 2018-11-16, rev 0x3000010
22
23 Package-Manager: Portage-2.3.55, 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_p20190112.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 6a6999c7dfd..c35614983ee 100644
32 --- a/sys-firmware/intel-microcode/Manifest
33 +++ b/sys-firmware/intel-microcode/Manifest
34 @@ -1,3 +1,4 @@
35 DIST intel-microcode-collection-20181117.tar.xz 4454740 BLAKE2B c9f106a6c6477966d535faef6a6a6a547218b0162ed6405dd9ab47967a87b2c4d9d2d33e8caf716720179bb0035df8c4a38d06c654584396f2af82828fcabd5e SHA512 cdff0e9d88c7848746487710c17cbcdf2adb0940072d71d6f32651a7e2fb66751409856e28d36e7e156e1bae08ad6575098972572bf809db5f07023870b2b9c6
36 DIST intel-microcode-collection-20181215.tar.xz 4455584 BLAKE2B 7535283f38ce82cc7e90f45e3201665e46b3c00becd3f6432843c3d960f0a8f11b8c394bc736e7c02e9e34ea31832bd7335603f8727f114f5d3eafa7fb6ea630 SHA512 ec32ef3c625426c98902b7716abc400001c440b8136f13ba89e0dd707690f82dd5afd8849b61f86507b3a78ef7a96b8750dca24fdf4c42b53275fa87e50ed561
37 +DIST intel-microcode-collection-20190112.tar.xz 4748576 BLAKE2B a6db3a1b357bdd1db65885b0de0d8a871573b6ec025eaff6c8991ef03eed6f32f298ecb736b42e09a94ca880ace984b276672245f5651982093d405abd588712 SHA512 6602772bd44aa9fad27275d515f73db041c3e18964fdfbea8d5f7917d456e5a5ca343999b7a9b48245b115290490c525e24cd575532ba8b2169a8229a69b9fa4
38 DIST microcode-20180807a.tgz 1628061 BLAKE2B a6b5a07596a0b1687efb95c207b2194865b2f975cc0d761a687d5b9d8fea63e777eb73373113f356a18592fd53651cf37d044d4e98cdfe6b306393b54ac06129 SHA512 3cd6794a5ce26e86f7b644e523ba978699316046e593da215b73b17c4b43049ac4a81636e2ce3e727d06c2efbac98657764aa3ff355edb429127585bb49a9b10
39
40 diff --git a/sys-firmware/intel-microcode/intel-microcode-20180807a_p20190112.ebuild b/sys-firmware/intel-microcode/intel-microcode-20180807a_p20190112.ebuild
41 new file mode 100644
42 index 00000000000..06557d9fb74
43 --- /dev/null
44 +++ b/sys-firmware/intel-microcode/intel-microcode-20180807a_p20190112.ebuild
45 @@ -0,0 +1,239 @@
46 +# Copyright 1999-2019 Gentoo Authors
47 +# Distributed under the terms of the GNU General Public License v2
48 +
49 +EAPI="6"
50 +
51 +inherit linux-info toolchain-funcs mount-boot
52 +
53 +# Find updates by searching and clicking the first link (hopefully it's the one):
54 +# https://www.intel.com/content/www/us/en/search.html?keyword=Processor+Microcode+Data+File
55 +
56 +COLLECTION_SNAPSHOT="${PV##*_p}"
57 +INTEL_SNAPSHOT="${PV/_p*}"
58 +NUM="28087"
59 +DESCRIPTION="Intel IA32/IA64 microcode update data"
60 +HOMEPAGE="http://inertiawar.com/microcode/ https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=${NUM}"
61 +SRC_URI="https://downloadmirror.intel.com/${NUM}/eng/microcode-${INTEL_SNAPSHOT}.tgz
62 + https://dev.gentoo.org/~whissi/dist/intel-microcode/intel-microcode-collection-${COLLECTION_SNAPSHOT}.tar.xz"
63 +
64 +LICENSE="intel-ucode"
65 +SLOT="0"
66 +KEYWORDS="-* amd64 x86"
67 +IUSE="hostonly initramfs +split-ucode vanilla"
68 +REQUIRED_USE="|| ( initramfs split-ucode )"
69 +
70 +DEPEND="sys-apps/iucode_tool"
71 +
72 +# !<sys-apps/microcode-ctl-1.17-r2 due to bug #268586
73 +RDEPEND="hostonly? ( sys-apps/iucode_tool )"
74 +
75 +RESTRICT="binchecks bindist mirror strip"
76 +
77 +S=${WORKDIR}
78 +
79 +# Blacklist bad microcode here.
80 +# 0x000406f1 aka 06-4f-01 aka CPUID 406F1 require newer microcode loader
81 +MICROCODE_BLACKLIST_DEFAULT="-s !0x000406f1"
82 +
83 +# In case we want to set some defaults ...
84 +MICROCODE_SIGNATURES_DEFAULT=""
85 +
86 +# Advanced users only!
87 +# Set MIRCOCODE_SIGNATURES to merge with:
88 +# only current CPU: MICROCODE_SIGNATURES="-S"
89 +# only specific CPU: MICROCODE_SIGNATURES="-s 0x00000f4a -s 0x00010676"
90 +# exclude specific CPU: MICROCODE_SIGNATURES="-s !0x00000686"
91 +
92 +pkg_pretend() {
93 + use initramfs && mount-boot_pkg_pretend
94 +}
95 +
96 +src_prepare() {
97 + default
98 +
99 + # Prevent "invalid file format" errors from iucode_tool
100 + rm -f "${S}"/intel-ucod*/list || die
101 +}
102 +
103 +src_install() {
104 + # This will take ALL of the upstream microcode sources:
105 + # - microcode.dat
106 + # - intel-ucode/
107 + # In some cases, they have not contained the same content (eg the directory has newer stuff).
108 + MICROCODE_SRC=(
109 + "${S}"/intel-ucode/
110 + "${S}"/intel-ucode-with-caveats/
111 + )
112 +
113 + # Allow users who are scared about microcode updates not included in Intel's official
114 + # microcode tarball to opt-out and comply with Intel marketing
115 + if ! use vanilla; then
116 + MICROCODE_SRC+=( "${S}"/intel-microcode-collection-${COLLECTION_SNAPSHOT} )
117 + fi
118 +
119 + # These will carry into pkg_preinst via env saving.
120 + : ${MICROCODE_BLACKLIST=${MICROCODE_BLACKLIST_DEFAULT}}
121 + : ${MICROCODE_SIGNATURES=${MICROCODE_SIGNATUES_DEFAULT}}
122 +
123 + opts=(
124 + ${MICROCODE_BLACKLIST}
125 + ${MICROCODE_SIGNATURES}
126 + # be strict about what we are doing
127 + --overwrite
128 + --strict-checks
129 + --no-ignore-broken
130 + # we want to install latest version
131 + --no-downgrade
132 + # show everything we find
133 + --list-all
134 + # show what we selected
135 + --list
136 + )
137 +
138 + # The earlyfw cpio needs to be in /boot because it must be loaded before
139 + # rootfs is mounted.
140 + use initramfs && dodir /boot && opts+=( --write-earlyfw="${ED%/}"/boot/intel-uc.img )
141 +
142 + keepdir /lib/firmware/intel-ucode
143 + opts+=( --write-firmware="${ED%/}/lib/firmware/intel-ucode" )
144 +
145 + iucode_tool \
146 + "${opts[@]}" \
147 + "${MICROCODE_SRC[@]}" \
148 + || die "iucode_tool ${opts[@]} ${MICROCODE_SRC[@]}"
149 +
150 + dodoc releasenote
151 +}
152 +
153 +pkg_preinst() {
154 + if [[ ${MICROCODE_BLACKLIST} != ${MICROCODE_BLACKLIST_DEFAULT} ]]; then
155 + ewarn "MICROCODE_BLACKLIST is set to \"${MICROCODE_BLACKLIST}\" instead of default \"${MICROCODE_BLACKLIST_DEFAULT}\". You are on your own!"
156 + fi
157 +
158 + if [[ ${MICROCODE_SIGNATURES} != ${MICROCODE_SIGNATURES_DEFAULT} ]]; then
159 + ewarn "Package was created using advanced options:"
160 + ewarn "MICROCODE_SIGNATURES is set to \"${MICROCODE_SIGNATURES}\" instead of default \"${MICROCODE_SIGNATURES_DEFAULT}\"!"
161 + fi
162 +
163 + # Make sure /boot is available if needed.
164 + use initramfs && mount-boot_pkg_preinst
165 +
166 + local _initramfs_file="${ED%/}/boot/intel-uc.img"
167 +
168 + if use hostonly; then
169 + # While this output looks redundant we do this check to detect
170 + # rare cases where iucode_tool was unable to detect system's processor(s).
171 + local _detected_processors=$(iucode_tool --scan-system 2>&1)
172 + if [[ -z "${_detected_processors}" ]]; then
173 + ewarn "Looks like iucode_tool was unable to detect any processor!"
174 + else
175 + einfo "Only installing ucode(s) for ${_detected_processors#iucode_tool: system has } due to USE=hostonly ..."
176 + fi
177 +
178 + opts=(
179 + --scan-system
180 + # be strict about what we are doing
181 + --overwrite
182 + --strict-checks
183 + --no-ignore-broken
184 + # we want to install latest version
185 + --no-downgrade
186 + # show everything we find
187 + --list-all
188 + # show what we selected
189 + --list
190 + )
191 +
192 + # The earlyfw cpio needs to be in /boot because it must be loaded before
193 + # rootfs is mounted.
194 + use initramfs && opts+=( --write-earlyfw=${_initramfs_file} )
195 +
196 + if use split-ucode; then
197 + opts+=( --write-firmware="${ED%/}/lib/firmware/intel-ucode" )
198 + fi
199 +
200 + opts+=( "${ED%/}"/lib/firmware/intel-ucode-temp )
201 +
202 + mv "${ED%/}"/lib/firmware/intel-ucode{,-temp} || die
203 + keepdir /lib/firmware/intel-ucode
204 +
205 + iucode_tool "${opts[@]}" || die "iucode_tool ${opts[@]}"
206 +
207 + rm -r "${ED%/}"/lib/firmware/intel-ucode-temp || die
208 +
209 + elif ! use split-ucode; then # hostonly disabled
210 + rm -r "${ED%/}"/lib/firmware/intel-ucode || die
211 + fi
212 +
213 + # Because it is possible that this package will install not one single file
214 + # due to user selection which is still somehow unexpected we add the following
215 + # check to inform user so that the user has at least a chance to detect
216 + # a problem/invalid select.
217 + local _has_installed_something=
218 + if use initramfs && [[ -s "${_initramfs_file}" ]]; then
219 + _has_installed_something="yes"
220 + elif use split-ucode; then
221 + _has_installed_something=$(find "${ED%/}/lib/firmware/intel-ucode" -maxdepth 0 -not -empty -exec echo yes \;)
222 + fi
223 +
224 + if use hostonly && [[ -n "${_has_installed_something}" ]]; then
225 + elog "You only installed ucode(s) for all currently available (=online)"
226 + elog "processor(s). Remember to re-emerge this package whenever you"
227 + elog "change the system's processor model."
228 + elog ""
229 + elif [[ -z "${_has_installed_something}" ]]; then
230 + ewarn "WARNING:"
231 + if [[ ${MICROCODE_SIGNATURES} != ${MICROCODE_SIGNATURES_DEFAULT} ]]; then
232 + ewarn "No ucode was installed! Because you have created this package"
233 + ewarn "using MICROCODE_SIGNATURES variable please double check if you"
234 + ewarn "have an invalid select."
235 + ewarn "It's rare but it is also possible that just no ucode update"
236 + ewarn "is available for your processor(s). In this case it is safe"
237 + ewarn "to ignore this warning."
238 + else
239 + ewarn "No ucode was installed! It's rare but it is also possible"
240 + ewarn "that just no ucode update is available for your processor(s)."
241 + ewarn "In this case it is safe to ignore this warning."
242 + fi
243 +
244 + ewarn ""
245 +
246 + if use hostonly; then
247 + ewarn "Unset \"hostonly\" USE flag to install all available ucodes."
248 + ewarn ""
249 + fi
250 + fi
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 +}