1 |
commit: 3eacfe4274c5d0c8a69911df89525324697c6328 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 29 23:14:42 2018 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 29 23:15:11 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3eacfe42 |
7 |
|
8 |
sys-firmware/intel-microcode: Add "minimal" USE flag |
9 |
|
10 |
Due to previous change (commit eb9036f6f998c91c6bc021f73bc10ca1b5240ae7), |
11 |
this package can become very large (or the resulting initramfs). |
12 |
|
13 |
While the already introduced environment variable "MICROCODE_SIGNATURES" is |
14 |
allowing you to set iucode_tool's "--scan-system" parameter to only |
15 |
install ucode(s) supported by the currently available (=online) processor(s), |
16 |
this doesn't work for binary package user(s). |
17 |
|
18 |
The now added "minimal" USE flag (enabled by default) will set "--scan-system" |
19 |
parameter for you. This will still allow you to select/blacklist ucode(s) |
20 |
for all your hosts on your central build host using the "MICROCODE_SIGNATURES" |
21 |
variable like before while giving each host the opportunity to only install |
22 |
really supported ucode(s) which will reduces the file size of the resulting |
23 |
initramfs. |
24 |
|
25 |
Bug: https://bugs.gentoo.org/654638 |
26 |
Package-Manager: Portage-2.3.40, Repoman-2.3.9 |
27 |
|
28 |
...1.ebuild => intel-microcode-20180426-r2.ebuild} | 58 ++++++++++++++++++++-- |
29 |
sys-firmware/intel-microcode/metadata.xml | 1 + |
30 |
2 files changed, 55 insertions(+), 4 deletions(-) |
31 |
|
32 |
diff --git a/sys-firmware/intel-microcode/intel-microcode-20180426-r1.ebuild b/sys-firmware/intel-microcode/intel-microcode-20180426-r2.ebuild |
33 |
similarity index 70% |
34 |
rename from sys-firmware/intel-microcode/intel-microcode-20180426-r1.ebuild |
35 |
rename to sys-firmware/intel-microcode/intel-microcode-20180426-r2.ebuild |
36 |
index 29a6958681d..b39f2be9bd8 100644 |
37 |
--- a/sys-firmware/intel-microcode/intel-microcode-20180426-r1.ebuild |
38 |
+++ b/sys-firmware/intel-microcode/intel-microcode-20180426-r2.ebuild |
39 |
@@ -19,11 +19,14 @@ SRC_URI="https://downloadmirror.intel.com/${NUM}/eng/microcode-${INTEL_SNAPSHOT} |
40 |
LICENSE="intel-ucode" |
41 |
SLOT="0" |
42 |
KEYWORDS="" |
43 |
-IUSE="initramfs +split-ucode vanilla" |
44 |
+IUSE="initramfs +minimal +split-ucode vanilla" |
45 |
REQUIRED_USE="|| ( initramfs split-ucode )" |
46 |
|
47 |
DEPEND="sys-apps/iucode_tool" |
48 |
-RDEPEND="!<sys-apps/microcode-ctl-1.17-r2" #268586 |
49 |
+ |
50 |
+# !<sys-apps/microcode-ctl-1.17-r2 due to bug #268586 |
51 |
+RDEPEND="!<sys-apps/microcode-ctl-1.17-r2 |
52 |
+ minimal? ( sys-apps/iucode_tool )" |
53 |
|
54 |
S=${WORKDIR} |
55 |
|
56 |
@@ -96,8 +99,9 @@ src_install() { |
57 |
# The earlyfw cpio needs to be in /boot because it must be loaded before |
58 |
# rootfs is mounted. |
59 |
use initramfs && dodir /boot && opts+=( --write-earlyfw="${ED%/}"/boot/intel-uc.img ) |
60 |
- # split location: |
61 |
- use split-ucode && dodir /lib/firmware/intel-ucode && opts+=( --write-firmware="${ED%/}"/lib/firmware/intel-ucode ) |
62 |
+ # split location (we use a temporary location so that we are able |
63 |
+ # to re-run iucode_tool in pkg_preinst): |
64 |
+ dodir /tmp/intel-ucode && opts+=( --write-firmware="${ED%/}"/tmp/intel-ucode ) |
65 |
|
66 |
iucode_tool \ |
67 |
"${opts[@]}" \ |
68 |
@@ -109,6 +113,45 @@ src_install() { |
69 |
|
70 |
pkg_preinst() { |
71 |
use initramfs && mount-boot_pkg_preinst |
72 |
+ |
73 |
+ if use minimal; then |
74 |
+ einfo "Removing ucode(s) not supported by any currently available (=online) processor(s) due to USE=minimal ..." |
75 |
+ opts=( |
76 |
+ --scan-system |
77 |
+ # be strict about what we are doing |
78 |
+ --overwrite |
79 |
+ --strict-checks |
80 |
+ --no-ignore-broken |
81 |
+ # we want to install latest version |
82 |
+ --no-downgrade |
83 |
+ # show everything we find |
84 |
+ --list-all |
85 |
+ # show what we selected |
86 |
+ --list |
87 |
+ ) |
88 |
+ |
89 |
+ # The earlyfw cpio needs to be in /boot because it must be loaded before |
90 |
+ # rootfs is mounted. |
91 |
+ use initramfs && opts+=( --write-earlyfw="${ED%/}"/boot/intel-uc.img ) |
92 |
+ # split location: |
93 |
+ use split-ucode && dodir /lib/firmware/intel-ucode && opts+=( --write-firmware="${ED%/}"/lib/firmware/intel-ucode ) |
94 |
+ |
95 |
+ iucode_tool \ |
96 |
+ "${opts[@]}" \ |
97 |
+ "${ED%/}"/tmp/intel-ucode \ |
98 |
+ || die "iucode_tool ${opts[@]} ${ED%/}/tmp/intel-ucode" |
99 |
+ |
100 |
+ else |
101 |
+ if use split-ucode; then |
102 |
+ # Temporary /tmp/intel-ucode will become final /lib/firmware/intel-ucode ... |
103 |
+ dodir /lib/firmware/intel-ucode |
104 |
+ mv "${ED%/}"/tmp/intel-ucode "${ED%/}"/lib/firmware/intel-ucode || die "Failed to install splitted ucodes!" |
105 |
+ fi |
106 |
+ fi |
107 |
+ |
108 |
+ # Cleanup any temporary leftovers so that we don't merge any |
109 |
+ # unneeded files on disk |
110 |
+ rm -r "${ED%/}"/tmp || die "Failed to cleanup '"${ED%/}"/tmp'" |
111 |
} |
112 |
|
113 |
pkg_prerm() { |
114 |
@@ -122,6 +165,13 @@ pkg_postrm() { |
115 |
pkg_postinst() { |
116 |
use initramfs && mount-boot_pkg_postinst |
117 |
|
118 |
+ if use minimal; then |
119 |
+ elog "You only installed ucodes for all currently available (=online)" |
120 |
+ elog "processor(s). Remember to re-emerge this package whenever you" |
121 |
+ elog "change the system's processor model." |
122 |
+ elog "" |
123 |
+ fi |
124 |
+ |
125 |
# We cannot give detailed information if user is affected or not: |
126 |
# If MICROCODE_BLACKLIST wasn't modified, user can still use MICROCODE_SIGNATURES |
127 |
# to to force a specific, otherwise blacklisted, microcode. So we |
128 |
|
129 |
diff --git a/sys-firmware/intel-microcode/metadata.xml b/sys-firmware/intel-microcode/metadata.xml |
130 |
index 2d96b231657..593b3a92123 100644 |
131 |
--- a/sys-firmware/intel-microcode/metadata.xml |
132 |
+++ b/sys-firmware/intel-microcode/metadata.xml |
133 |
@@ -7,6 +7,7 @@ |
134 |
</maintainer> |
135 |
<use> |
136 |
<flag name="initramfs">install a small initramfs for use with CONFIG_MICROCODE_EARLY</flag> |
137 |
+ <flag name="minimal">only install ucode(s) supported by currently available (=online) processor(s)</flag> |
138 |
<flag name="monolithic">install the large text microcode.dat (used by older kernels via microcode_ctl)</flag> |
139 |
<flag name="split-ucode">install the split binary ucode files (used by the kernel directly)</flag> |
140 |
<flag name="vanilla">install only microcode updates from Intel's official microcode tarball</flag> |