aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-03-03 01:38:31 +0100
committerThomas Deutschmann <whissi@gentoo.org>2020-03-04 00:53:06 +0100
commit8768d9f1b9e8d166dbbd3428b221578c7504679c (patch)
treee61d919c7cc642f1ffcf54b914eb9499e3e67f7e
parentdefaults/software.sh: Add coreutils (diff)
downloadgenkernel-8768d9f1b9e8d166dbbd3428b221578c7504679c.tar.gz
genkernel-8768d9f1b9e8d166dbbd3428b221578c7504679c.tar.bz2
genkernel-8768d9f1b9e8d166dbbd3428b221578c7504679c.zip
Make kernel config filename customizable
This commit will make kernel config filename used by --save-config feature customizable like previous commit 769a07fd3e947 did for initramfs and kernel image. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rw-r--r--defaults/config.sh1
-rw-r--r--doc/genkernel.8.txt6
-rwxr-xr-xgen_cmdline.sh6
-rwxr-xr-xgen_configkernel.sh2
-rwxr-xr-xgen_determineargs.sh19
5 files changed, 31 insertions, 3 deletions
diff --git a/defaults/config.sh b/defaults/config.sh
index fed53550..8c7cf7e8 100644
--- a/defaults/config.sh
+++ b/defaults/config.sh
@@ -23,6 +23,7 @@ KERNEL_SUPPORT_MICROCODE=no
#
DEFAULT_INITRAMFS_FILENAME="initramfs-%%KV%%.img"
DEFAULT_INITRAMFS_SYMLINK_NAME="initramfs"
+DEFAULT_KERNEL_CONFIG_FILENAME="kernel-config-%%KV%%"
DEFAULT_KERNEL_FILENAME="vmlinuz-%%KV%%"
DEFAULT_KERNEL_SYMLINK_NAME="kernel"
DEFAULT_SYSTEMMAP_FILENAME="System.map-%%KV%%"
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index e00e0287..7cd65fee 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -506,6 +506,12 @@ NOTE: No modules outside of the initramfs will be included!
Archive file created using tar containing kernel binary, content of
'/lib/modules' and the kernel config after the callbacks have run.
+*--kernel-config-filename*=<...>::
+Set the kernel config filename used by *--save-config*. Please see
+*--kernel-filename* option for available placeholders and restrictions.
++
+By default, kernel config filename will be set to 'kernel-config-%%KV%%'.
+
*--kernel-filename*=<...>::
Set kernel filename which will be used when kernel will be installed
into *BOOTDIR* (implies *--install* option). The following placeholders
diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index aa54c29f..a34a7396 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -193,6 +193,8 @@ longusage() {
echo " --postclear Clear all tmp files and caches after genkernel has run"
echo " --no-postclear Do not clean up after genkernel has run"
echo " Output Settings"
+ echo " --kernel-config-filename=<...>"
+ echo " Set kernel config filename"
echo " --kernel-filename=<...>"
echo " Set kernel filename"
echo " --kernel-symlink-name=<...>"
@@ -701,6 +703,10 @@ parse_cmdline() {
CMD_KERNCACHE="${*#*=}"
print_info 3 "KERNCACHE: ${CMD_KERNCACHE}"
;;
+ --kernel-config-filename=*)
+ CMD_KERNEL_CONFIG_FILENAME="${*#*=}"
+ print_info 3 "CMD_KERNEL_CONFIG_FILENAME: ${CMD_KERNEL_CONFIG_FILENAME}"
+ ;;
--kernel-filename=*)
CMD_KERNEL_FILENAME="${*#*=}"
print_info 3 "CMD_KERNEL_FILENAME: ${CMD_KERNEL_FILENAME}"
diff --git a/gen_configkernel.sh b/gen_configkernel.sh
index 2f9a6a56..78049493 100755
--- a/gen_configkernel.sh
+++ b/gen_configkernel.sh
@@ -44,7 +44,7 @@ determine_kernel_config_file() {
else
local -a user_kconfig_candidates
- # Always prefer kernel config based on actual $KV reading
+ # Always prefer kernel config based on set --kernel-config-filename
user_kconfig_candidates+=( "/etc/kernels/${GK_FILENAME_CONFIG}" )
if [ -n "${KERNEL_LOCALVERSION}" -a "${KERNEL_LOCALVERSION}" != "UNSET" ]
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 14ef757f..6c5d01c4 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -87,7 +87,6 @@ determine_KV() {
determine_output_filenames() {
print_info 5 '' 1 0
- GK_FILENAME_CONFIG="kernel-config-${KV}"
GK_FILENAME_KERNELZ="kernelz-${KV}"
GK_FILENAME_TEMP_CONFIG="config-${ARCH}-${KV}"
GK_FILENAME_TEMP_INITRAMFS="initramfs-${ARCH}-${KV}"
@@ -96,7 +95,10 @@ determine_output_filenames() {
GK_FILENAME_TEMP_SYSTEMMAP="System.map-${ARCH}-${KV}"
# Do we have values?
- if [ -z "${KERNEL_FILENAME}" ]
+ if [ -z "${KERNEL_CONFIG_FILENAME}" ]
+ then
+ gen_die "--kernel-config-filename must be set to a non-empty value!"
+ elif [ -z "${KERNEL_FILENAME}" ]
then
gen_die "--kernel-filename must be set to a non-empty value!"
elif [ -z "${KERNEL_SYMLINK_NAME}" ]
@@ -116,6 +118,17 @@ determine_output_filenames() {
gen_die "--initramfs-filename must be set to a non-empty value!"
fi
+ # Kernel .config
+ GK_FILENAME_CONFIG=$(arch_replace "${KERNEL_CONFIG_FILENAME}")
+ GK_FILENAME_CONFIG=$(kv_replace "${GK_FILENAME_CONFIG}")
+
+ if [ -z "${GK_FILENAME_CONFIG}" ]
+ then
+ gen_die "Internal error: Variable 'GK_FILENAME_CONFIG' is empty!"
+ else
+ print_info 5 "GK_FILENAME_CONFIG set to '${GK_FILENAME_CONFIG}' (was: '${KERNEL_CONFIG_FILENAME}')"
+ fi
+
# Kernel
GK_FILENAME_KERNEL=$(arch_replace "${KERNEL_FILENAME}")
GK_FILENAME_KERNEL=$(kv_replace "${GK_FILENAME_KERNEL}")
@@ -221,6 +234,7 @@ determine_output_filenames() {
fi
local -a filename_vars
+ filename_vars+=( 'GK_FILENAME_CONFIG;--kernel-config-filename' )
filename_vars+=( 'GK_FILENAME_KERNEL;--kernel-filename' )
filename_vars+=( 'GK_FILENAME_KERNEL_SYMLINK;--kernel-symlink-name' )
filename_vars+=( 'GK_FILENAME_INITRAMFS;--initramfs-filename' )
@@ -275,6 +289,7 @@ determine_real_args() {
set_config_with_override BOOL KERNEL_SOURCES CMD_KERNEL_SOURCES "yes"
set_config_with_override STRING INITRAMFS_FILENAME CMD_INITRAMFS_FILENAME "${DEFAULT_INITRAMFS_FILENAME}"
set_config_with_override STRING INITRAMFS_SYMLINK_NAME CMD_INITRAMFS_SYMLINK_NAME "${DEFAULT_INITRAMFS_SYMLINK_NAME}"
+ set_config_with_override STRING KERNEL_CONFIG_FILENAME CMD_KERNEL_CONFIG_FILENAME "${DEFAULT_KERNEL_CONFIG_FILENAME}"
set_config_with_override STRING KERNEL_FILENAME CMD_KERNEL_FILENAME "${DEFAULT_KERNEL_FILENAME}"
set_config_with_override STRING KERNEL_SYMLINK_NAME CMD_KERNEL_SYMLINK_NAME "${DEFAULT_KERNEL_SYMLINK_NAME}"
set_config_with_override STRING SYSTEMMAP_FILENAME CMD_SYSTEMMAP_FILENAME "${DEFAULT_SYSTEMMAP_FILENAME}"