commit:     de233b906ee278949e0e140d42d44f087f76d395
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 10 21:57:09 2018 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Jan 10 22:13:35 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de233b90

sys-firmware/intel-microcode: rewrite to use iucode_tool.

- Use the Intel upstream 'iucode_tool' to process all of the input
  microcode, from both the text-format microcode.dat file and other
  inputs, then generate a clean set of split outputs & optionally also
  initramfs output.
- Allows easy inclusion of any future split-ucode releases for single
  CPUs.
- No longer uses intel-microcode2ucode.c from $FILESDIR.
- Expert users can use the new MICROCODE_SIGNATURES variable to install
  only a subset of microcodes on their system, as requested by bug
  643786.
- Avoids accidently bloated split-ucode files per bug #644100.
- USE=monolithic is no longer supported, please see iucode_tool for any
  fallback.
- USE=initramfs now writes to /boot/intel-uc.img (8.3-safe naming).

Fixes: https://bugs.gentoo.org/643786
Fixes: https://bugs.gentoo.org/644100
Package-Manager: Portage-2.3.16, Repoman-2.3.6
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 .../intel-microcode-20180108-r1.ebuild             | 78 ++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/sys-firmware/intel-microcode/intel-microcode-20180108-r1.ebuild 
b/sys-firmware/intel-microcode/intel-microcode-20180108-r1.ebuild
new file mode 100644
index 00000000000..60ae099579f
--- /dev/null
+++ b/sys-firmware/intel-microcode/intel-microcode-20180108-r1.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit toolchain-funcs mount-boot
+
+# Find updates by searching and clicking the first link (hopefully it's the 
one):
+# 
http://www.intel.com/content/www/us/en/search.html?keyword=Processor+Microcode+Data+File
+
+NUM="27431"
+DESCRIPTION="Intel IA32/IA64 microcode update data"
+HOMEPAGE="http://inertiawar.com/microcode/ 
https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=${NUM}";
+SRC_URI="http://downloadmirror.intel.com/${NUM}/eng/microcode-${PV}.tgz";
+
+LICENSE="intel-ucode"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="initramfs +split-ucode"
+REQUIRED_USE="|| ( initramfs split-ucode )"
+
+DEPEND="sys-apps/iucode_tool"
+RDEPEND="!<sys-apps/microcode-ctl-1.17-r2" #268586
+
+S=${WORKDIR}
+
+# TODO: 
+# Blacklist bad microcode here.
+DEFAULT_MICROCODE_SIGNATURES=""
+
+# Advanced users only:
+# merge with:
+# only current CPU: MICROCODE_SIGNATURES="-S"
+# only specific CPU: MICROCODE_SIGNATURES="-s 0x00000f4a -s 0x00010676"
+# exclude specific CPU: MICROCODE_SIGNATURES="-s !0x00000686"
+MICROCODE_SIGNATURES="${MICROCODE_SIGNATURES:=${DEFAULT_MICROCODE_SIGNATURES}}"
+
+pkg_pretend() {
+       if [[ "${MICROCODE_SIGNATURES}" != "${DEFAULT_MICROCODE_SIGNATURES}" 
]]; then
+               ewarn "MICROCODE_SIGNATURES is set!"
+               ewarn "The user has decided to install only a SUBSET of 
microcode."
+       fi
+}
+
+src_install() {
+       # This will take ALL of the upstream microcode sources:
+       # - microcode.dat
+       # - intel-ucode/
+       # In some cases, they have not contained the same content (eg the 
directory has newer stuff).
+       MICROCODE_SRC=(
+               "${S}"/microcode.dat
+               "${S}"/intel-ucode/
+       )
+       opts=(
+               ${MICROCODE_SIGNATURES}
+               # be strict about what we are doing
+               --overwrite
+               --strict-checks
+               --no-ignore-broken
+               # show everything we find
+               --list-all
+               # show what we selected
+               --list
+       )
+
+       # The earlyfw cpio needs to be in /boot because it must be loaded before
+       # rootfs is mounted.
+       use initramfs && dodir /boot && opts+=( 
--write-earlyfw="${ED%/}"/boot/intel-uc.img )
+       # split location:
+       use split-ucode && dodir /lib/firmware/intel-ucode && opts+=( 
--write-firmware="${ED%/}"/lib/firmware/intel-ucode )
+
+       iucode_tool \
+               "${opts[@]}" \
+               "${MICROCODE_SRC[@]}" \
+               || die "iucode_tool ${opts[@]} ${MICROCODE_SRC[@]}"
+
+       dodoc releasenote
+}

Reply via email to