Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-firmware/intel-microcode/
Date: Tue, 10 May 2022 20:25:01
Message-Id: 1652214278.62f84e98cfb995b3780aed1ff217131a4b299b30.mpagano@gentoo
1 commit: 62f84e98cfb995b3780aed1ff217131a4b299b30
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 10 20:24:38 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue May 10 20:24:38 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62f84e98
7
8 sys-firmware/intel-microcode: add 20220510_p20220508
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 sys-firmware/intel-microcode/Manifest | 2 +
13 .../intel-microcode-20220510_p20220508.ebuild | 263 +++++++++++++++++++++
14 2 files changed, 265 insertions(+)
15
16 diff --git a/sys-firmware/intel-microcode/Manifest b/sys-firmware/intel-microcode/Manifest
17 index 95a4de19db6b..8aca790448ed 100644
18 --- a/sys-firmware/intel-microcode/Manifest
19 +++ b/sys-firmware/intel-microcode/Manifest
20 @@ -5,9 +5,11 @@ DIST intel-microcode-collection-20210608.tar.xz 8012692 BLAKE2B 98df9d18658bfdf0
21 DIST intel-microcode-collection-20210830.tar.xz 8681768 BLAKE2B 84f098285ed0b79b953e1f54b9ca077e42e7a2b6b28e862dddcb23a546ebebdd5afb9e54215b6c6493b72bf82121ace4b06f759413d3745571ff8156db52d6b1 SHA512 8a6a7376524888b0e89f9fd9a592d52a3859f4ddf1d961484b60d77098faa6984c5e8efc9cf4258a943cfc2c3503dbb87989868962a7ad8028c391d897e212b6
22 DIST intel-microcode-collection-20220207.tar.xz 9362888 BLAKE2B 9efb2a943bffc1d702675c4ca5d17b6bc7f5bf5688fb1979caadbf96c516c31c3e1894823aaa16dbdb8c778c933eaf49dec6f2d416483d11e58ed1e75823cef8 SHA512 72458aa64c05ceb8bb21b296da5ad15230af3e6ac63240a10370fadec09523cf7ebefaaddce2b31e2c16570c2700a875cccf86fd1770046ff36cc30eb594f041
23 DIST intel-microcode-collection-20220421.tar.xz 9442704 BLAKE2B 9c0d682d4ae07c6c40b7638cd53e559f0d5b672f40676a3fc478d07ac5772f350da777c20f821ed5a0907ba31800874cd15553fcdbdae319e77e17961cf49f9f SHA512 a7b5ef78618a27c6065a78d5302d19f846feb71bc09cc0359342d1f31f1f793242982bc384227b0e59a4b7f246cb9f4aaa2350ad0a4fe1a23ce3504e59b0d2c2
24 +DIST intel-microcode-collection-20220508.tar.xz 9444060 BLAKE2B 1737143f5227d95590f325f7205c04816d7791bebb27573dc30774fe5f40f74c1e0506d41774474a8b2495b0dc210528fac1362545d670a085c5c502aa903b24 SHA512 b9d7f2d5db0f625a219959f52822c8d6fba2e0bc682257a204c9b33cd19ed2101f5f661e7f2e2b98a8ad8d105fcb3309699d193469ee4d67d99ae188dc7034d9
25 DIST intel-ucode-sig_0x406e3-rev_0xd6.bin 101376 BLAKE2B 66d55867954d69dda1425febd93bb8c89f7aa836d504f8b5fee127f8505bcf2246f4fcc55cc245bc5e532528d60cca2eee278de7ab5174dc2862db7982a2b36f SHA512 248066b521bf512b5d8e4a8c7e921464ce52169c954d6e4ca580d8c172cd789519e22b4cf56c212e452b4191741f0202019f7061d322c9433b5af9ce5413b567
26 DIST microcode-20201112.tar.gz 3610834 BLAKE2B 4212924f1673afded961266a25fe6063ec6cdafaa26c8bee1c42372eb8ab5f278dc2501615b23e09e2f9809bf2792a8db317c98c170bf0c5e1dd62b7dc80a084 SHA512 0875675d065a83ee14fa34a31022ee34e46aee579d1ff192414e79861af157ae269ca7c2c462f03b3accbd45590c76e5cbf4f53d7a6ed237e410213a96459211
27 DIST microcode-20210216.tar.gz 3506111 BLAKE2B e09ab59dcccc77c15545b119dcf5309e626d53649a601c49fc7d6a65d774b8016d9ad44783f75ceb4bf384a03b909bc28693ed2be9f047029342dca9beae9cae SHA512 211ed90a248c891224bb8c569e24c04410d3f67ecc6daee41dc025042bd51c257baaba0da1ac5327df76352d2b53d812e81f06cc8726e43b95ea2f8898bc00bf
28 DIST microcode-20210608.tar.gz 4782451 BLAKE2B 2eac43aaa7832365e428bf2de20797ef42293a53087545920d205bd3b11a3d8ca2afb33931af5d36b8f3a224b9c22ed89ff828acc8afdcfa1b8220884c55ae89 SHA512 61acd2e76aa019fa0002fbf56c503791080a937ff93d81e020f8f0cc089dc08928b4c7e9884f713b886e2f9d4a8409fea59e39f628ef534a588515e1c3fc861d
29 DIST microcode-20220207.tar.gz 4590237 BLAKE2B 8c47a330794615b6684084976b6bb9e8800cd2869f81ecc33b28b54441b220a645502c0ade0cbd58e91879a652ff6bca181800004de477fc74033413ea4b1c8f SHA512 efa9f80815947cf2be371e7da7185634cbacefe779d1d6dfef0c15b78ccae7d2740ea6681b967a19dfbcc3014edce5bcdcdba87c9dea1f19d0415a03fca9e936
30 DIST microcode-20220419.tar.gz 4590171 BLAKE2B 69d296efad5329324a47640eace5d1a10e38b85cb8b7ac5baa9f14c40391ff809ae17cb7814f99f2e43910fe4c4b02dc77ffea7bb5f2b58069b2c17029e9f76a SHA512 abfe3942c204e42ed121bcea47c366469013a6751ef5d28d9c0d59a3a660bd1ad7010441e000367c052ee1ead00285a252d2b3c3ca86314eaea9f7d0de3f05c6
31 +DIST microcode-20220510.tar.gz 5912115 BLAKE2B 5f8c238b00970ddda132dbcf9059df759bb768e1eb2fe0b9912ffe69cf9a6104b32ea816e7574660ea74e3d08af1aa45cc46b5f38d0b315e6e466d8ca466f37d SHA512 00329ce62a6d9cc66fb8594d132ef67951086ab1250ceaf908d5a357753ed62557275f55c5eb7b3ad55d1fdd312b5d1a436b214cdcbf6e3e1a840c8bf6f4795d
32
33 diff --git a/sys-firmware/intel-microcode/intel-microcode-20220510_p20220508.ebuild b/sys-firmware/intel-microcode/intel-microcode-20220510_p20220508.ebuild
34 new file mode 100644
35 index 000000000000..4171888a5826
36 --- /dev/null
37 +++ b/sys-firmware/intel-microcode/intel-microcode-20220510_p20220508.ebuild
38 @@ -0,0 +1,263 @@
39 +# Copyright 1999-2022 Gentoo Authors
40 +# Distributed under the terms of the GNU General Public License v2
41 +
42 +EAPI="7"
43 +
44 +inherit linux-info mount-boot
45 +
46 +# Find updates by searching and clicking the first link (hopefully it's the one):
47 +# https://www.intel.com/content/www/us/en/search.html?keyword=Processor+Microcode+Data+File
48 +
49 +COLLECTION_SNAPSHOT="${PV##*_p}"
50 +INTEL_SNAPSHOT="${PV/_p*}"
51 +#NUM="28087"
52 +#https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=${NUM}
53 +#https://downloadmirror.intel.com/${NUM}/eng/microcode-${INTEL_SNAPSHOT}.tgz
54 +DESCRIPTION="Intel IA32/IA64 microcode update data"
55 +HOMEPAGE="https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files http://inertiawar.com/microcode/"
56 +SRC_URI="https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/microcode-${INTEL_SNAPSHOT}.tar.gz
57 + https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/raw/437f382b1be4412b9d03e2bbdcda46d83d581242/intel-ucode/06-4e-03 -> intel-ucode-sig_0x406e3-rev_0xd6.bin
58 + https://dev.gentoo.org/~mpagano/dist/intel-microcode/intel-microcode-collection-${COLLECTION_SNAPSHOT}.tar.xz"
59 +
60 +LICENSE="intel-ucode"
61 +SLOT="0"
62 +KEYWORDS="-* amd64 x86"
63 +IUSE="hostonly initramfs +split-ucode vanilla"
64 +REQUIRED_USE="|| ( initramfs split-ucode )"
65 +
66 +BDEPEND=">=sys-apps/iucode_tool-2.3"
67 +
68 +# !<sys-apps/microcode-ctl-1.17-r2 due to bug #268586
69 +RDEPEND="hostonly? ( sys-apps/iucode_tool )"
70 +
71 +RESTRICT="binchecks strip"
72 +
73 +S=${WORKDIR}
74 +
75 +# Blacklist bad microcode here.
76 +# 0x000406f1 aka 06-4f-01 aka CPUID 406F1 require newer microcode loader
77 +MICROCODE_BLACKLIST_DEFAULT="-s !0x000406f1"
78 +
79 +# https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/issues/31
80 +MICROCODE_BLACKLIST_DEFAULT+=" -s !0x000406e3,0xc0,eq:0x00dc"
81 +
82 +# https://bugs.gentoo.org/722768
83 +MICROCODE_BLACKLIST_DEFAULT+=" -s !0x000406e3,0xc0,eq:0x00da"
84 +
85 +# https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/commit/49bb67f32a2e3e631ba1a9a73da1c52e1cac7fd9
86 +MICROCODE_BLACKLIST_DEFAULT+=" -s !0x000806c1,0x80,eq:0x0068"
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 + mkdir intel-ucode-old || die
112 + cp "${DISTDIR}"/intel-ucode-sig_0x406e3-rev_0xd6.bin "${S}"/intel-ucode-old/ || die
113 +
114 + # Prevent "invalid file format" errors from iucode_tool
115 + rm -f "${S}"/intel-ucod*/list || die
116 +
117 +}
118 +
119 +src_install() {
120 + # This will take ALL of the upstream microcode sources:
121 + # - microcode.dat
122 + # - intel-ucode/
123 + # In some cases, they have not contained the same content (eg the directory has newer stuff).
124 + MICROCODE_SRC=(
125 + "${S}"/intel-ucode/
126 + "${S}"/intel-ucode-with-caveats/
127 + "${S}"/intel-ucode-old/
128 + )
129 +
130 + # Allow users who are scared about microcode updates not included in Intel's official
131 + # microcode tarball to opt-out and comply with Intel marketing
132 + if ! use vanilla; then
133 + MICROCODE_SRC+=( "${S}"/intel-microcode-collection-${COLLECTION_SNAPSHOT} )
134 + fi
135 +
136 + # These will carry into pkg_preinst via env saving.
137 + : ${MICROCODE_BLACKLIST=${MICROCODE_BLACKLIST_DEFAULT}}
138 + : ${MICROCODE_SIGNATURES=${MICROCODE_SIGNATUES_DEFAULT}}
139 +
140 + opts=(
141 + ${MICROCODE_BLACKLIST}
142 + ${MICROCODE_SIGNATURES}
143 + # be strict about what we are doing
144 + --overwrite
145 + --strict-checks
146 + --no-ignore-broken
147 + # we want to install latest version
148 + --no-downgrade
149 + # show everything we find
150 + --list-all
151 + # show what we selected
152 + --list
153 + )
154 +
155 + # The earlyfw cpio needs to be in /boot because it must be loaded before
156 + # rootfs is mounted.
157 + use initramfs && dodir /boot && opts+=( --write-earlyfw="${ED}/boot/intel-uc.img" )
158 +
159 + keepdir /lib/firmware/intel-ucode
160 + opts+=( --write-firmware="${ED}/lib/firmware/intel-ucode" )
161 +
162 + iucode_tool \
163 + "${opts[@]}" \
164 + "${MICROCODE_SRC[@]}" \
165 + || die "iucode_tool ${opts[@]} ${MICROCODE_SRC[@]}"
166 +
167 + dodoc releasenote.md
168 +}
169 +
170 +pkg_preinst() {
171 + if [[ ${MICROCODE_BLACKLIST} != ${MICROCODE_BLACKLIST_DEFAULT} ]]; then
172 + ewarn "MICROCODE_BLACKLIST is set to \"${MICROCODE_BLACKLIST}\" instead of default \"${MICROCODE_BLACKLIST_DEFAULT}\". You are on your own!"
173 + fi
174 +
175 + if [[ ${MICROCODE_SIGNATURES} != ${MICROCODE_SIGNATURES_DEFAULT} ]]; then
176 + ewarn "Package was created using advanced options:"
177 + ewarn "MICROCODE_SIGNATURES is set to \"${MICROCODE_SIGNATURES}\" instead of default \"${MICROCODE_SIGNATURES_DEFAULT}\"!"
178 + fi
179 +
180 + # Make sure /boot is available if needed.
181 + use initramfs && mount-boot_pkg_preinst
182 +
183 + local _initramfs_file="${ED}/boot/intel-uc.img"
184 +
185 + if use hostonly; then
186 + # While this output looks redundant we do this check to detect
187 + # rare cases where iucode_tool was unable to detect system's processor(s).
188 + local _detected_processors=$(iucode_tool --scan-system 2>&1)
189 + if [[ -z "${_detected_processors}" ]]; then
190 + ewarn "Looks like iucode_tool was unable to detect any processor!"
191 + else
192 + einfo "Only installing ucode(s) for ${_detected_processors#iucode_tool: system has } due to USE=hostonly ..."
193 + fi
194 +
195 + opts=(
196 + --scan-system
197 + # be strict about what we are doing
198 + --overwrite
199 + --strict-checks
200 + --no-ignore-broken
201 + # we want to install latest version
202 + --no-downgrade
203 + # show everything we find
204 + --list-all
205 + # show what we selected
206 + --list
207 + )
208 +
209 + # The earlyfw cpio needs to be in /boot because it must be loaded before
210 + # rootfs is mounted.
211 + use initramfs && opts+=( --write-earlyfw=${_initramfs_file} )
212 +
213 + if use split-ucode; then
214 + opts+=( --write-firmware="${ED}/lib/firmware/intel-ucode" )
215 + fi
216 +
217 + opts+=( "${ED}/lib/firmware/intel-ucode-temp" )
218 +
219 + mv "${ED}"/lib/firmware/intel-ucode{,-temp} || die
220 + keepdir /lib/firmware/intel-ucode
221 +
222 + iucode_tool "${opts[@]}" || die "iucode_tool ${opts[@]}"
223 +
224 + rm -r "${ED}"/lib/firmware/intel-ucode-temp || die
225 +
226 + elif ! use split-ucode; then # hostonly disabled
227 + rm -r "${ED}"/lib/firmware/intel-ucode || die
228 + fi
229 +
230 + # Because it is possible that this package will install not one single file
231 + # due to user selection which is still somehow unexpected we add the following
232 + # check to inform user so that the user has at least a chance to detect
233 + # a problem/invalid select.
234 + local _has_installed_something=
235 + if use initramfs && [[ -s "${_initramfs_file}" ]]; then
236 + _has_installed_something="yes"
237 + elif use split-ucode; then
238 + _has_installed_something=$(find "${ED}/lib/firmware/intel-ucode" -maxdepth 0 -not -empty -exec echo yes \;)
239 + fi
240 +
241 + if use hostonly && [[ -n "${_has_installed_something}" ]]; then
242 + elog "You only installed ucode(s) for all currently available (=online)"
243 + elog "processor(s). Remember to re-emerge this package whenever you"
244 + elog "change the system's processor model."
245 + elog ""
246 + elif [[ -z "${_has_installed_something}" ]]; then
247 + ewarn "WARNING:"
248 + if [[ ${MICROCODE_SIGNATURES} != ${MICROCODE_SIGNATURES_DEFAULT} ]]; then
249 + ewarn "No ucode was installed! Because you have created this package"
250 + ewarn "using MICROCODE_SIGNATURES variable please double check if you"
251 + ewarn "have an invalid select."
252 + ewarn "It's rare but it is also possible that just no ucode update"
253 + ewarn "is available for your processor(s). In this case it is safe"
254 + ewarn "to ignore this warning."
255 + else
256 + ewarn "No ucode was installed! It's rare but it is also possible"
257 + ewarn "that just no ucode update is available for your processor(s)."
258 + ewarn "In this case it is safe to ignore this warning."
259 + fi
260 +
261 + ewarn ""
262 +
263 + if use hostonly; then
264 + ewarn "Unset \"hostonly\" USE flag to install all available ucodes."
265 + ewarn ""
266 + fi
267 + fi
268 +}
269 +
270 +pkg_prerm() {
271 + # Make sure /boot is mounted so that we can remove /boot/intel-uc.img!
272 + use initramfs && mount-boot_pkg_prerm
273 +}
274 +
275 +pkg_postrm() {
276 + # Don't forget to umount /boot if it was previously mounted by us.
277 + use initramfs && mount-boot_pkg_postrm
278 +}
279 +
280 +pkg_postinst() {
281 + # Don't forget to umount /boot if it was previously mounted by us.
282 + use initramfs && mount-boot_pkg_postinst
283 +
284 + # We cannot give detailed information if user is affected or not:
285 + # If MICROCODE_BLACKLIST wasn't modified, user can still use MICROCODE_SIGNATURES
286 + # to to force a specific, otherwise blacklisted, microcode. So we
287 + # only show a generic warning based on running kernel version:
288 + if kernel_is -lt 4 14 34; then
289 + ewarn "${P} contains microcode updates which require"
290 + ewarn "additional kernel patches which aren't yet included in kernel <4.14.34."
291 + ewarn "Loading such a microcode through kernel interface from an unpatched kernel"
292 + ewarn "can crash your system!"
293 + ewarn ""
294 + ewarn "Those microcodes are blacklisted per default. However, if you have altered"
295 + ewarn "MICROCODE_BLACKLIST or MICROCODE_SIGNATURES, you maybe have unintentionally"
296 + ewarn "re-enabled those microcodes...!"
297 + ewarn ""
298 + ewarn "Check \"${EROOT}/usr/share/doc/${PN}-*/releasenot*\" if your microcode update"
299 + ewarn "requires additional kernel patches or not."
300 + fi
301 +}