From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1114236-garchives=archives.gentoo.org@lists.gentoo.org>
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 EBC91138334
	for <garchives@archives.gentoo.org>; Wed,  2 Oct 2019 22:45:30 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 9A651E0891;
	Wed,  2 Oct 2019 22:45:29 +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 66B51E0891
	for <gentoo-commits@lists.gentoo.org>; Wed,  2 Oct 2019 22:45:29 +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 4B65C34B7C5
	for <gentoo-commits@lists.gentoo.org>; Wed,  2 Oct 2019 22:45:28 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id CC74376A
	for <gentoo-commits@lists.gentoo.org>; Wed,  2 Oct 2019 22:45:26 +0000 (UTC)
From: "Thomas Deutschmann" <whissi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" <whissi@gentoo.org>
Message-ID: <1569771263.ef914100a474196ddb27049fd95ce573ebc4805d.whissi@gentoo>
Subject: [gentoo-commits] proj/genkernel:master commit in: /
X-VCS-Repository: proj/genkernel
X-VCS-Files: gen_configkernel.sh
X-VCS-Directories: /
X-VCS-Committer: whissi
X-VCS-Committer-Name: Thomas Deutschmann
X-VCS-Revision: ef914100a474196ddb27049fd95ce573ebc4805d
X-VCS-Branch: master
Date: Wed,  2 Oct 2019 22:45:26 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: dc741607-1313-4970-9e87-481f15c91502
X-Archives-Hash: 74fd5349ec7a047cf2374cfad0e63edf

commit:     ef914100a474196ddb27049fd95ce573ebc4805d
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 29 15:07:14 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Sep 29 15:34:23 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=ef914100

gen_configkernel.sh: config_kernel(): Update --microcode kernel options handling

- Don't try to set CONFIG_MICROCODE_*EARLY for >= linux-4.4

- Check for CONFIG_MICROCODE_{AMD,INTEL} in sanity check

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_configkernel.sh | 39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index 2ff983f..5a4b5ce 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -753,20 +753,29 @@ config_kernel() {
 	then
 		if isTrue "${KERNEL_SUPPORT_MICROCODE}"
 		then
+			local -a kconfigs_microcode
+			local -a kconfigs_microcode_amd
+			local -a kconfigs_microcode_intel
+
 			print_info 2 "$(get_indent 1)>> Ensure that required kernel options for early microcode loading support are set ..."
-			kconfig_microcode_intel=(CONFIG_MICROCODE_INTEL CONFIG_MICROCODE_INTEL_EARLY)
+			kconfigs_microcode+=( 'CONFIG_MICROCODE' )
+			kconfigs_microcode+=( 'CONFIG_MICROCODE_OLD_INTERFACE' )
+			[ $(($KV_MAJOR * 1000 + ${KV_MINOR})) -le 4003 ] && kconfigs_microcode+=( 'CONFIG_MICROCODE_EARLY' )
 
-			kconfig_microcode_amd=(CONFIG_MICROCODE_AMD)
-			[ $(($KV_MAJOR * 1000 + ${KV_MINOR})) -le 4003 ] && kconfig_microcode_amd+=(CONFIG_MICROCODE_AMD_EARLY)
+			# Intel
+			kconfigs_microcode_intel+=( 'CONFIG_MICROCODE_INTEL' )
+			[ $(($KV_MAJOR * 1000 + ${KV_MINOR})) -le 4003 ] && kconfigs_microcode_intel+=( 'CONFIG_MICROCODE_INTEL_EARLY' )
 
-			kconfigs=(CONFIG_MICROCODE CONFIG_MICROCODE_OLD_INTERFACE)
-			[ $(($KV_MAJOR * 1000 + ${KV_MINOR})) -le 4003 ] && kconfigs+=(CONFIG_MICROCODE_EARLY)
+			# AMD
+			kconfigs_microcode_amd=( 'CONFIG_MICROCODE_AMD' )
+			[ $(($KV_MAJOR * 1000 + ${KV_MINOR})) -le 4003 ] && kconfigs_microcode_amd+=( 'CONFIG_MICROCODE_AMD_EARLY' )
 
-			[[ "$MICROCODE" == all ]] && kconfigs+=( ${kconfig_microcode_amd[@]} ${kconfig_microcode_intel[@]} )
-			[[ "$MICROCODE" == amd ]] && kconfigs+=( ${kconfig_microcode_amd[@]} )
-			[[ "$MICROCODE" == intel ]] && kconfigs+=( ${kconfig_microcode_intel[@]} )
+			[[ "${MICROCODE}" == all ]]   && kconfigs_microcode+=( ${kconfigs_microcode_amd[@]} ${kconfigs_microcode_intel[@]} )
+			[[ "${MICROCODE}" == amd ]]   && kconfigs_microcode+=( ${kconfigs_microcode_amd[@]} )
+			[[ "${MICROCODE}" == intel ]] && kconfigs_microcode+=( ${kconfigs_microcode_intel[@]} )
 
-			for k in "${kconfigs[@]}"
+			local k
+			for k in "${kconfigs_microcode[@]}"
 			do
 				local cfg=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}/.config" "$k")
 				case "${cfg}" in
@@ -777,6 +786,18 @@ config_kernel() {
 			done
 
 			required_kernel_options+=( 'CONFIG_MICROCODE' )
+			case "${MICROCODE}" in
+				amd)
+					required_kernel_options+=( 'CONFIG_MICROCODE_AMD' )
+					;;
+				intel)
+					required_kernel_options+=( 'CONFIG_MICROCODE_INTEL' )
+					;;
+				all)
+					required_kernel_options+=( 'CONFIG_MICROCODE_AMD' )
+					required_kernel_options+=( 'CONFIG_MICROCODE_INTEL' )
+					;;
+			esac
 		else
 			print_info 1 "$(get_indent 1)>> Ignoring --microcode parameter; Architecture does not support microcode loading ..."
 		fi