From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id F1C20139085 for ; Mon, 2 Jan 2017 22:58:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3A249E0D3B; Mon, 2 Jan 2017 22:58:57 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 065B3E0D3B for ; Mon, 2 Jan 2017 22:58:57 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 38F47341016 for ; Mon, 2 Jan 2017 22:58:56 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 01D4B24EF for ; Mon, 2 Jan 2017 22:58:55 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1483397420.dae8d61f014283ef86ead2251f2b355004bc3f42.robbat2@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_initramfs.sh X-VCS-Directories: / X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: dae8d61f014283ef86ead2251f2b355004bc3f42 X-VCS-Branch: master Date: Mon, 2 Jan 2017 22:58:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e7fe5dda-1431-4368-98dc-4e96aa741800 X-Archives-Hash: 94a436927443e74df46528296e5927f9 commit: dae8d61f014283ef86ead2251f2b355004bc3f42 Author: Robin H. Johnson gentoo org> AuthorDate: Mon Jan 2 22:50:20 2017 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Mon Jan 2 22:50:20 2017 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=dae8d61f gen_initramfs: cleaner conditionals for microcode Signed-off-by: Robin H. Johnson gentoo.org> gen_initramfs.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 268bc2d..e968719 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -1053,27 +1053,32 @@ create_initramfs() { fi ## To early load microcode we need to follow some pretty specific steps ## mostly laid out in linux/Documentation/x86/early-microcode.txt - if grep -sq '^CONFIG_MICROCODE=y' "${KERNEL_OUTPUTDIR}"/.config; then + ## It only loads monolithic ucode from an uncompressed cpio, which MUST + ## be before the other cpio archives in the stream. + cfg_CONFIG_MICROCODE=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}"/.config CONFIG_MICROCODE) + if [ "${cfg_CONFIG_MICROCODE}" == "y" ]; then + cfg_CONFIG_MICROCODE_INTEL=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}"/.config CONFIG_MICROCODE_INTEL) + cfg_CONFIG_MICROCODE_AMD=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}"/.config CONFIG_MICROCODE_AMD) print_info 1 "early-microcode: >> Preparing..." UCODEDIR="${TMPDIR}/ucode_tmp/kernel/x86/microcode/" mkdir -p "${UCODEDIR}" - if grep -sq '^CONFIG_MICROCODE_INTEL=y' "${KERNEL_OUTPUTDIR}"/.config; then - if [ "$(ls -A /lib/firmware/intel-ucode)" ]; then + if [ "${cfg_CONFIG_MICROCODE_INTEL}" == "y" ]; then + if [ -d /lib/firmware/intel-ucode ]; then print_info 1 " >> adding GenuineIntel.bin" cat /lib/firmware/intel-ucode/* > "${UCODEDIR}/GenuineIntel.bin" || gen_die "Failed to concat intel cpu ucode" else print_info 1 "CONFIG_MICROCODE_INTEL=y set but no ucode available. Please install sys-firmware/intel-microcode[split-ucode]" fi fi - if grep -sq '^CONFIG_MICROCODE_AMD=y' "${KERNEL_OUTPUTDIR}"/.config; then - if [ "$(ls -A /lib/firmware/amd-ucode)" ]; then + if [ "${cfg_CONFIG_MICROCODE_AMD}" == "y" ]; then + if [ -d /lib/firmware/amd-ucode ]; then print_info 1 " >> adding AuthenticAMD.bin" cat /lib/firmware/amd-ucode/*.bin > "${UCODEDIR}/AuthenticAMD.bin" || gen_dir "Failed to concat amd cpu ucode" else print_info 1 "CONFIG_MICROCODE_AMD=y set but no ucode available. Please install sys-firmware/linux-firmware" fi fi - if [ "$(ls -A ${UCODE})" ]; then + if [ -f "${UCODEDIR}/AuthenticAMD.bin" -o -f "${UCODEDIR}/GenuineIntel.bin" ]; then print_info 1 "early-microcode: >> Creating cpio..." pushd "${TMPDIR}/ucode_tmp" > /dev/null find . | cpio -o -H newc > ../ucode.cpio || gen_die "Failed to create cpu microcode cpio"