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 CC8B2138334 for ; Sat, 4 Aug 2018 23:27:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BCEC3E07DF; Sat, 4 Aug 2018 23:27:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 790F8E07DF for ; Sat, 4 Aug 2018 23:27:00 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 01A67335CA3 for ; Sat, 4 Aug 2018 23:26:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A03A5348 for ; Sat, 4 Aug 2018 23:26:56 +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: <1533425131.febc1b12b5b393e918da94b9f1c029f2adcea215.robbat2@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_cmdline.sh gen_configkernel.sh gen_determineargs.sh gen_initramfs.sh genkernel.conf X-VCS-Directories: / X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: febc1b12b5b393e918da94b9f1c029f2adcea215 X-VCS-Branch: master Date: Sat, 4 Aug 2018 23:26:56 +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: d260aa49-9207-4b36-b405-366db3438db9 X-Archives-Hash: a2545eb743f5460414709b271617ff82 commit: febc1b12b5b393e918da94b9f1c029f2adcea215 Author: Robin H. Johnson gentoo org> AuthorDate: Sat Aug 4 23:19:46 2018 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Sat Aug 4 23:25:31 2018 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=febc1b12 microcode: add flexability: type & initramfs control Bug reported that the MICROCODE option did not provide enough flexability, as it enabled both AMD & Intel options by default, and placed both sets of microcode into the initramfs. Existing boolean option MICROCODE is now a string, which takes no/all/amd/intel as inputs, describing which variant of kernel options to enable. Boolean inputs are converted to no/all settings. This option no longer include microcode in initramfs. New option MICROCODE_INITRAMFS, enabled by default, includes the microcode for matching kernel config options (INTEL/AMD) into the initramfs. For users using sys-boot/grub-2.02-r1 or another bootloader that supports multiple initramfs options, this option can be safely disabled. Fixes: https://bugs.gentoo.org/662492 Reported-by: Joerg Schaible gmx.de> Signed-off-by: Robin H. Johnson gentoo.org> gen_cmdline.sh | 18 +++++++++++++++--- gen_configkernel.sh | 18 ++++++++---------- gen_determineargs.sh | 11 ++++++++++- gen_initramfs.sh | 3 ++- genkernel.conf | 10 ++++++++-- 5 files changed, 43 insertions(+), 17 deletions(-) diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 3d9611f..853723b 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -98,8 +98,9 @@ longusage() { echo " --mdadm Include MDADM/MDMON support" echo " --no-mdadm Exclude MDADM/MDMON support" echo " --mdadm-config= Use file as mdadm.conf in initramfs" - echo " --microcode Include early microcode support" - echo " --no-microcode Exclude early microcode support" + echo " --microcode[=] Include early microcode support, for 'all'/'amd'/'intel' CPU types" + echo " --no-microcode Exclude early microcode support" + echo " --microcode-initramfs Include early microcode in initramfs" echo " --nfs Include NFS support" echo " --no-nfs Exclude NFS support" echo " --dmraid Include DMRAID support" @@ -330,9 +331,20 @@ parse_cmdline() { print_info 2 "CMD_BUSYBOX: ${CMD_BUSYBOX}" ;; --microcode|--no-microcode) - CMD_MICROCODE=`parse_optbool "$*"` + case `parse_optbool "$*"` in + 0) CMD_MICROCODE='no' ;; + 1) CMD_MICROCODE='all' ;; + esac print_info 2 "CMD_MICROCODE: ${CMD_MICROCODE}" ;; + --microcode=*) + CMD_MICROCODE="${*#*=}" + print_info 2 "CMD_MICROCODE: $CMD_MICROCODE" + ;; + --microcode-initramfs|--no-microcode-initramfs) + CMD_MICROCODE_INITRAMFS=`parse_optbool "$*"` + print_info 2 "CMD_MICROCODE_INITRAMFS: ${CMD_MICROCODE_INITRAMFS}" + ;; --nfs|--no-nfs) CMD_NFS=`parse_optbool "$*"` print_info 2 "CMD_NFS: ${CMD_NFS}" diff --git a/gen_configkernel.sh b/gen_configkernel.sh index 697c478..475526a 100755 --- a/gen_configkernel.sh +++ b/gen_configkernel.sh @@ -277,17 +277,15 @@ config_kernel() { # Microcode setting, intended for early microcode loading # needs to be compiled in. - if isTrue ${MICROCODE} + kconfig_microcode_intel=(CONFIG_MICROCODE_INTEL CONFIG_MICROCODE_INTEL_EARLY) + kconfig_microcode_amd=(CONFIG_MICROCODE_AMD CONFIG_MICROCODE_AMD_EARLY) + if [[ -n "${MICROCODE}" ]] then - for k in \ - CONFIG_MICROCODE \ - CONFIG_MICROCODE_INTEL \ - CONFIG_MICROCODE_AMD \ - CONFIG_MICROCODE_OLD_INTERFACE \ - CONFIG_MICROCODE_INTEL_EARLY \ - CONFIG_MICROCODE_AMD_EARLY \ - CONFIG_MICROCODE_EARLY \ - ; do + kconfigs=(CONFIG_MICROCODE CONFIG_MICROCODE_OLD_INTERFACE CONFIG_MICROCODE_EARLY) + [[ "$MICROCODE" == all ]] && kconfigs+=( ${kconfig_microcode_amd[@]} ${kconfig_microcode_intel[@]} ) + [[ "$MICROCODE" == amd ]] && kconfigs+=( ${kconfig_microcode_amd[@]} ) + [[ "$MICROCODE" == intel ]] && kconfigs+=( ${kconfig_microcode_intel[@]} ) + for k in "${kconfigs[@]}" ; do cfg=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "$k") case "$cfg" in y) ;; # Do nothing diff --git a/gen_determineargs.sh b/gen_determineargs.sh index b686fca..bd0150a 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -121,7 +121,8 @@ determine_real_args() { set_config_with_override BOOL HYPERV CMD_HYPERV set_config_with_override BOOL BUSYBOX CMD_BUSYBOX "yes" set_config_with_override BOOL NFS CMD_NFS "yes" - set_config_with_override BOOL MICROCODE CMD_MICROCODE + set_config_with_override STRING MICROCODE CMD_MICROCODE "all" + set_config_with_override BOOL MICROCODE_INITRAMFS CMD_MICROCODE_INITRAMFS "yes" set_config_with_override BOOL UNIONFS CMD_UNIONFS set_config_with_override BOOL NETBOOT CMD_NETBOOT set_config_with_override STRING REAL_ROOT CMD_REAL_ROOT @@ -234,5 +235,13 @@ determine_real_args() { INTEGRATED_INITRAMFS=0 fi + MICROCODE=${MICROCODE,,} + case ${MICROCODE} in + all|amd|intel) ;; + y|yes|1|true|t) MICROCODE='all' ;; + n|no|none|0|false|f) MICROCODE='' ;; + *) gen_die "Invalid microcode '${MICROCODE}', --microcode= requires one of: no, all, intel, amd" ;; + esac + get_KV } diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 768f291..a2c55c6 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -1149,7 +1149,8 @@ create_initramfs() { ## 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 isTrue "${MICROCODE}" && [ "${cfg_CONFIG_MICROCODE}" == "y" ]; then + if isTrue "${MICROCODE_INITRAMFS}" && [ "${cfg_CONFIG_MICROCODE}" == "y" ]; then + print_info 1 "--microcode-initramfs is enabled by default for compatability but made obsolete by sys-boot/grub-2.02-r1" 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..." diff --git a/genkernel.conf b/genkernel.conf index 5e5a67b..57cb2b0 100644 --- a/genkernel.conf +++ b/genkernel.conf @@ -74,8 +74,14 @@ USECOLOR="yes" # Add in GnuPG support #GPG="no" -# Add in early microcode support -#MICROCODE="no" +# Add in early microcode support: this sets the kernel options for early microcode loading +# Acceptible values: empty/"no", "all", "intel", "amd" +#MICROCODE="all" + +# Include early microcode in generated initramfs +# This is enabled by default for upgrade compatability, however is obsoleted by +# sys-boot/grub-2.02-r1, which supports multiple initramfs in the bootloader. +#MICROCODE_INITRAMFS="no" # Add in NFS support #NFS="no"