public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Thomas Deutschmann" <whissi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:master commit in: doc/, /
Date: Fri, 29 Mar 2019 04:13:51 +0000 (UTC)	[thread overview]
Message-ID: <1553832785.66be1d9d8f1fc241de0e8d033f616735e5cb5d1e.whissi@gentoo> (raw)

commit:     66be1d9d8f1fc241de0e8d033f616735e5cb5d1e
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 29 04:03:57 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Mar 29 04:13:05 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=66be1d9d

Add special value "default" for --kernel-config parameter

--kernel-config=default will make genkernel to ignoring all user
kernel configurations so that genkernel will use default kernel
configuration shipped with genkernel to build a kernel.

Useful to start from scratch if needed or for debugging.

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

 doc/genkernel.8.txt |  4 +++-
 gen_cmdline.sh      |  5 ++++-
 gen_configkernel.sh | 38 +++++++++++++++++++++++++++-----------
 3 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 04633cf..15d5454 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -181,11 +181,13 @@ KERNEL LOCATIONS
     This specifies the location of the kernel sources;  the default
     is '/usr/src/linux'.
 
-*--kernel-config*=<file>::
+*--kernel-config*=<file|default>::
     This specifies a kernel configuration file to use for compilation;
     by default genkernel uses the config from the previous
     build of the same kernel version or a default kernel config if
     there isn't a previous config.
+    Use the special value 'default' to force usage of default kernel
+    config.
 
 *--module-prefix*=<dir>::
     Prefix to kernel module destination, modules will be installed in

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 8971c51..795c2c6 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -63,7 +63,10 @@ longusage() {
   echo "	--no-static		Do not build a static (monolithic kernel)."
   echo "  Kernel settings"
   echo "	--kerneldir=<dir>	Location of the kernel sources"
-  echo "	--kernel-config=<file>	Kernel configuration file to use for compilation"
+  echo "	--kernel-config=<file|default>"
+  echo "				Kernel configuration file to use for compilation."
+  echo "				Use 'default' to explicitly start from scratch"
+  echo "				using genkernel defaults."
   echo "	--module-prefix=<dir>	Prefix to kernel module destination, modules"
   echo "				will be installed in <prefix>/lib/modules"
   echo "  Low-Level Compile settings"

diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index 34fdbe1..063c9ac 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -4,7 +4,8 @@
 # Fills variable KERNEL_CONFIG
 determine_config_file() {
 	print_info 2 "Checking for suitable kernel configuration..."
-	if [ -n "${CMD_KERNEL_CONFIG}" ]
+
+	if [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" != "default" ]
 	then
 		KERNEL_CONFIG=$(expand_file "${CMD_KERNEL_CONFIG}")
 		if [ -z "${KERNEL_CONFIG}" ]
@@ -15,13 +16,21 @@ determine_config_file() {
 			gen_die "${error_msg}"
 		fi
 	else
-		for f in \
-			"/etc/kernels/kernel-config-${ARCH}-${KV}" \
-			"${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" \
-			"${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" \
-			"${GK_SHARE}/arch/${ARCH}/generated-config" \
-			"${GK_SHARE}/arch/${ARCH}/kernel-config" \
-			"${DEFAULT_KERNEL_CONFIG}"
+		local -a kconfig_candidates
+		kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" )
+		kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" )
+		kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/generated-config" )
+		kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/kernel-config" )
+		kconfig_candidates+=( "${DEFAULT_KERNEL_CONFIG}" )
+
+		if [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" = "default" ]
+		then
+			print_info 1 "Default configuration was forced. Will ignore any user kernel configuration!"
+		else
+			kconfig_candidates=( "/etc/kernels/kernel-config-${ARCH}-${KV}" ${kconfig_candidates[@]} )
+		fi
+
+		for f in "${kconfig_candidates[@]}"
 		do
 			[ -z "${f}" ] && continue
 
@@ -49,7 +58,7 @@ determine_config_file() {
 	# Validate the symlink result if any
 	if [ -z "${KERNEL_CONFIG}" -o ! -f "${KERNEL_CONFIG}" ]
 	then
-		if [ -n "${CMD_KERNEL_CONFIG}" ]
+		if [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" != "default" ]
 		then
 			error_msg="No kernel .config: File '${CMD_KERNEL_CONFIG}' not found! "
 			error_msg+="Check --kernel-config value or unset "
@@ -77,21 +86,28 @@ config_kernel() {
 		print_info 1 "$(getIndent 1)>> --clean is disabled; not running 'make clean'."
 	fi
 
-	if isTrue "${MRPROPER}"
+	if isTrue "${MRPROPER}" || [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" = "default" ]
 	then
 		# Backup current kernel .config
 		if [ -f "${KERNEL_OUTPUTDIR}/.config" ]
 		then
 			# Current .config is different then one we are going to use
-			if ! diff -q "${KERNEL_OUTPUTDIR}"/.config "${KERNEL_CONFIG}" > /dev/null
+			if [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" = "default" ] || \
+				! diff -q "${KERNEL_OUTPUTDIR}"/.config "${KERNEL_CONFIG}" > /dev/null
 			then
 				NOW=`date +--%Y-%m-%d--%H-%M-%S`
 				cp "${KERNEL_OUTPUTDIR}/.config" "${KERNEL_OUTPUTDIR}/.config${NOW}.bak" \
 					|| gen_die "Could not backup kernel config (${KERNEL_OUTPUTDIR}/.config)"
 				print_info 1 "$(getIndent 1)>> Previous config backed up to .config${NOW}.bak"
+
+				[ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" = "default" ] &&
+					rm "${KERNEL_OUTPUTDIR}/.config" > /dev/null
 			fi
 		fi
+	fi
 
+	if isTrue "${MRPROPER}"
+	then
 		print_info 1 "$(getIndent 1)>> Running mrproper..."
 		compile_generic mrproper kernel
 	else


             reply	other threads:[~2019-03-29  4:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29  4:13 Thomas Deutschmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-08  5:33 [gentoo-commits] proj/genkernel:master commit in: doc/, / Sam James
2023-07-05 17:41 Sam James
2021-07-06 21:27 Thomas Deutschmann
2020-08-02 22:42 Thomas Deutschmann
2019-07-21 18:38 Thomas Deutschmann
2019-07-21 16:26 Thomas Deutschmann
2019-07-21 16:26 Thomas Deutschmann
2019-07-15 18:06 Thomas Deutschmann
2019-03-28 23:43 Thomas Deutschmann
2019-03-28 23:43 Thomas Deutschmann
2019-03-25  2:08 Thomas Deutschmann
2017-01-08  0:40 Robin H. Johnson
2017-01-03  5:16 Robin H. Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1553832785.66be1d9d8f1fc241de0e8d033f616735e5cb5d1e.whissi@gentoo \
    --to=whissi@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox