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: Sat, 04 Aug 2018 23:03:32
Message-Id: 1533423720.3dfea4b405c8f96828215c6f0617c0bac469fcdc.whissi@gentoo
1 commit: 3dfea4b405c8f96828215c6f0617c0bac469fcdc
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 4 23:02:00 2018 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 4 23:02:00 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3dfea4b4
7
8 sys-firmware/intel-microcode: bump
9
10 - Updated Microcodes:
11
12 sig 0x000106e5, pf_mask 0x13, 2018-01-24, rev 0x0009 -> 2018-05-08, rev 0x000a
13 sig 0x00020652, pf_mask 0x12, 2018-02-04, rev 0x0010 -> 2018-05-08, rev 0x0011
14 sig 0x00020655, pf_mask 0x92, 2018-01-23, rev 0x0006 -> 2018-04-23, rev 0x0007
15 sig 0x000506ca, pf_mask 0x03, 2017-11-22, rev 0x0008 -> 2018-05-11, rev 0x000c
16 sig 0x000906ec, pf_mask 0x22, 2018-05-08, rev 0x0096 -> 2018-05-31, rev 0x0098
17
18 Package-Manager: Portage-2.3.44, Repoman-2.3.10
19
20 sys-firmware/intel-microcode/Manifest | 1 +
21 .../intel-microcode-20180804.ebuild | 214 +++++++++++++++++++++
22 2 files changed, 215 insertions(+)
23
24 diff --git a/sys-firmware/intel-microcode/Manifest b/sys-firmware/intel-microcode/Manifest
25 index 17e400a0b73..e6a39726edd 100644
26 --- a/sys-firmware/intel-microcode/Manifest
27 +++ b/sys-firmware/intel-microcode/Manifest
28 @@ -1,2 +1,3 @@
29 DIST intel-microcode-collection-20180728.tar.xz 4463372 BLAKE2B ae0f6fa46944cf159762c4b5eeaf4094c6b05fea3668c90a38587d673ec95dcbcbd15ec3f0834a6bec6f2172d89598562ef89d82960bea5e73602a6ed28d3392 SHA512 457f666ba643746159295711ec5c4d2cde47b7a609df1b3d3f528f0dab4aef54641ecf32977f723bd70090da9485c2583413b2673a65e0d6ab078523c5186e45
30 +DIST intel-microcode-collection-20180804.tar.xz 4389012 BLAKE2B f77a226107f7529b12b95ed312e79338d20697378769f8cfcd91e7ed63e3d2044371fd9305ba4b7068a9467b7910150d6b288742ca5393c428cb2c167c4dfb62 SHA512 4cd2c5d2237fcf63727d6b2fc111e0b4d798ffb134e13b7e2a4b7373a09ae879237f8406358d09e724ab632bffadf08b528bf76530a25446f0ba60fb4ae490e1
31 DIST microcode-20180703.tgz 1550181 BLAKE2B edf86dcc8dedeffd22a9b608cc11e5b043d36617ae6325e14326d402388f42ead29c8483a0312ab9ea2015604803cc07506d6f119b314b922639a71f9d65a39d SHA512 25af4158f97fba2fb88f05a44f42ed7d2415001ccc58f573d366f405ff198472517468f619628f4f6e5a371793c41ea8faf5a932d2362b2a51726bb5c84e0eed
32
33 diff --git a/sys-firmware/intel-microcode/intel-microcode-20180804.ebuild b/sys-firmware/intel-microcode/intel-microcode-20180804.ebuild
34 new file mode 100644
35 index 00000000000..4ab38dc2823
36 --- /dev/null
37 +++ b/sys-firmware/intel-microcode/intel-microcode-20180804.ebuild
38 @@ -0,0 +1,214 @@
39 +# Copyright 1999-2018 Gentoo Foundation
40 +# Distributed under the terms of the GNU General Public License v2
41 +
42 +EAPI="6"
43 +
44 +inherit linux-info toolchain-funcs 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="20180804"
50 +INTEL_SNAPSHOT="20180703"
51 +NUM="27945"
52 +DESCRIPTION="Intel IA32/IA64 microcode update data"
53 +HOMEPAGE="http://inertiawar.com/microcode/ https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=${NUM}"
54 +SRC_URI="https://downloadmirror.intel.com/${NUM}/eng/microcode-${INTEL_SNAPSHOT}.tgz
55 + https://dev.gentoo.org/~whissi/dist/intel-microcode/intel-microcode-collection-${COLLECTION_SNAPSHOT}.tar.xz"
56 +
57 +LICENSE="intel-ucode"
58 +SLOT="0"
59 +KEYWORDS="-* ~amd64 ~x86"
60 +IUSE="hostonly initramfs +split-ucode vanilla"
61 +REQUIRED_USE="|| ( initramfs split-ucode )"
62 +
63 +DEPEND="sys-apps/iucode_tool"
64 +
65 +# !<sys-apps/microcode-ctl-1.17-r2 due to bug #268586
66 +RDEPEND="!<sys-apps/microcode-ctl-1.17-r2
67 + hostonly? ( sys-apps/iucode_tool )"
68 +
69 +RESTRICT="binchecks strip"
70 +
71 +S=${WORKDIR}
72 +
73 +# Blacklist bad microcode here.
74 +# 0x000406f1 aka 06-4f-01 aka CPUID 406F1 require newer microcode loader
75 +MICROCODE_BLACKLIST_DEFAULT="-s !0x000406f1"
76 +MICROCODE_BLACKLIST="${MICROCODE_BLACKLIST:=${MICROCODE_BLACKLIST_DEFAULT}}"
77 +
78 +# In case we want to set some defaults ...
79 +MICROCODE_SIGNATURES_DEFAULT=""
80 +
81 +# Advanced users only:
82 +# merge with:
83 +# only current CPU: MICROCODE_SIGNATURES="-S"
84 +# only specific CPU: MICROCODE_SIGNATURES="-s 0x00000f4a -s 0x00010676"
85 +# exclude specific CPU: MICROCODE_SIGNATURES="-s !0x00000686"
86 +MICROCODE_SIGNATURES="${MICROCODE_SIGNATURES:=${MICROCODE_SIGNATURES_DEFAULT}}"
87 +
88 +pkg_pretend() {
89 + if [[ "${MICROCODE_BLACKLIST}" != "${MICROCODE_BLACKLIST_DEFAULT}" ]]; then
90 + ewarn "MICROCODE_BLACKLIST is set to \"${MICROCODE_BLACKLIST}\" instead of default \"${MICROCODE_BLACKLIST_DEFAULT}\". You are on your own!"
91 + fi
92 +
93 + if [[ "${MICROCODE_SIGNATURES}" != "${MICROCODE_SIGNATURES_DEFAULT}" ]]; then
94 + ewarn "The user has opted in for advanced use:"
95 + ewarn "MICROCODE_SIGNATURES is set to \"${MICROCODE_SIGNATURES}\" instead of default \"${MICROCODE_SIGNATURES_DEFAULT}\"!"
96 + fi
97 +
98 + use initramfs && mount-boot_pkg_pretend
99 +}
100 +
101 +src_prepare() {
102 + default
103 +
104 + # Prevent "invalid file format" errors from iucode_tool
105 + rm -f "${S}"/intel-ucod*/list || die
106 +}
107 +
108 +src_install() {
109 + # This will take ALL of the upstream microcode sources:
110 + # - microcode.dat
111 + # - intel-ucode/
112 + # In some cases, they have not contained the same content (eg the directory has newer stuff).
113 + MICROCODE_SRC=(
114 + "${S}"/intel-ucode/
115 + "${S}"/intel-ucode-with-caveats/
116 + )
117 +
118 + # Allow users who are scared about microcode updates not included in Intel's official
119 + # microcode tarball to opt-out and comply with Intel marketing
120 + if ! use vanilla; then
121 + MICROCODE_SRC+=( "${S}"/intel-microcode-collection-${COLLECTION_SNAPSHOT} )
122 + fi
123 +
124 + opts=(
125 + ${MICROCODE_BLACKLIST}
126 + ${MICROCODE_SIGNATURES}
127 + # be strict about what we are doing
128 + --overwrite
129 + --strict-checks
130 + --no-ignore-broken
131 + # we want to install latest version
132 + --no-downgrade
133 + # show everything we find
134 + --list-all
135 + # show what we selected
136 + --list
137 + )
138 +
139 + # The earlyfw cpio needs to be in /boot because it must be loaded before
140 + # rootfs is mounted.
141 + use initramfs && dodir /boot && opts+=( --write-earlyfw="${ED%/}"/boot/intel-uc.img )
142 + # split location (we use a temporary location so that we are able
143 + # to re-run iucode_tool in pkg_preinst; use keepdir instead of dodir to carry
144 + # this folder to pkg_preinst to avoid an error even if no microcode was selected):
145 + keepdir /tmp/intel-ucode && opts+=( --write-firmware="${ED%/}"/tmp/intel-ucode )
146 +
147 + iucode_tool \
148 + "${opts[@]}" \
149 + "${MICROCODE_SRC[@]}" \
150 + || die "iucode_tool ${opts[@]} ${MICROCODE_SRC[@]}"
151 +
152 + dodoc releasenote
153 +}
154 +
155 +pkg_preinst() {
156 + use initramfs && mount-boot_pkg_preinst
157 +
158 + if use hostonly; then
159 + einfo "Removing ucode(s) not supported by any currently available (=online) processor(s) due to USE=hostonly ..."
160 + opts=(
161 + --scan-system
162 + # be strict about what we are doing
163 + --overwrite
164 + --strict-checks
165 + --no-ignore-broken
166 + # we want to install latest version
167 + --no-downgrade
168 + # show everything we find
169 + --list-all
170 + # show what we selected
171 + --list
172 + )
173 +
174 + # The earlyfw cpio needs to be in /boot because it must be loaded before
175 + # rootfs is mounted.
176 + use initramfs && opts+=( --write-earlyfw="${ED%/}"/boot/intel-uc.img )
177 + # split location:
178 + use split-ucode && dodir /lib/firmware/intel-ucode && opts+=( --write-firmware="${ED%/}"/lib/firmware/intel-ucode )
179 +
180 + iucode_tool \
181 + "${opts[@]}" \
182 + "${ED%/}"/tmp/intel-ucode \
183 + || die "iucode_tool ${opts[@]} ${ED%/}/tmp/intel-ucode"
184 +
185 + else
186 + if use split-ucode; then
187 + # Temporary /tmp/intel-ucode will become final /lib/firmware/intel-ucode ...
188 + dodir /lib/firmware
189 + mv "${ED%/}/tmp/intel-ucode" "${ED%/}/lib/firmware" || die "Failed to install splitted ucodes!"
190 + fi
191 + fi
192 +
193 + # Cleanup any temporary leftovers so that we don't merge any
194 + # unneeded files on disk
195 + rm -r "${ED%/}/tmp" || die "Failed to cleanup '${ED%/}/tmp'"
196 +}
197 +
198 +pkg_prerm() {
199 + use initramfs && mount-boot_pkg_prerm
200 +}
201 +
202 +pkg_postrm() {
203 + use initramfs && mount-boot_pkg_postrm
204 +}
205 +
206 +pkg_postinst() {
207 + use initramfs && mount-boot_pkg_postinst
208 +
209 + local _has_installed_something=
210 + if use initramfs && [[ -s "${EROOT%/}/boot/intel-uc.img" ]]; then
211 + _has_installed_something="yes"
212 + elif use split-ucode; then
213 + _has_installed_something=$(find "${EROOT%/}/lib/firmware/intel-ucode" -maxdepth 0 -not -empty -exec echo yes \;)
214 + fi
215 +
216 + if use hostonly && [[ -n "${_has_installed_something}" ]]; then
217 + elog "You only installed ucode(s) for all currently available (=online)"
218 + elog "processor(s). Remember to re-emerge this package whenever you"
219 + elog "change the system's processor model."
220 + elog ""
221 + elif [[ -z "${_has_installed_something}" ]]; then
222 + ewarn "WARNING:"
223 + ewarn "No ucode was installed! You can ignore this warning if there"
224 + ewarn "aren't any microcode updates available for your processor(s)."
225 + ewarn "But if you use MICROCODE_SIGNATURES variable please double check"
226 + ewarn "if you have an invalid select."
227 + ewarn ""
228 +
229 + if use hostonly; then
230 + ewarn "Unset \"hostonly\" USE flag to install all available ucodes."
231 + ewarn ""
232 + fi
233 + fi
234 +
235 + # We cannot give detailed information if user is affected or not:
236 + # If MICROCODE_BLACKLIST wasn't modified, user can still use MICROCODE_SIGNATURES
237 + # to to force a specific, otherwise blacklisted, microcode. So we
238 + # only show a generic warning based on running kernel version:
239 + if kernel_is -lt 4 14 34; then
240 + ewarn "${P} contains microcode updates which require"
241 + ewarn "additional kernel patches which aren't yet included in kernel <4.14.34."
242 + ewarn "Loading such a microcode through kernel interface from an unpatched kernel"
243 + ewarn "can crash your system!"
244 + ewarn ""
245 + ewarn "Those microcodes are blacklisted per default. However, if you have altered"
246 + ewarn "MICROCODE_BLACKLIST or MICROCODE_SIGNATURES, you maybe have unintentionally"
247 + ewarn "re-enabled those microcodes...!"
248 + ewarn ""
249 + ewarn "Check \"${EROOT%/}/usr/share/doc/${PN}-*/releasenot*\" if your microcode update"
250 + ewarn "requires additional kernel patches or not."
251 + fi
252 +}