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