1 |
commit: 8768d9f1b9e8d166dbbd3428b221578c7504679c |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Mar 3 00:38:31 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 3 23:53:06 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=8768d9f1 |
7 |
|
8 |
Make kernel config filename customizable |
9 |
|
10 |
This commit will make kernel config filename used by --save-config |
11 |
feature customizable like previous commit 769a07fd3e947 did for |
12 |
initramfs and kernel image. |
13 |
|
14 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
15 |
|
16 |
defaults/config.sh | 1 + |
17 |
doc/genkernel.8.txt | 6 ++++++ |
18 |
gen_cmdline.sh | 6 ++++++ |
19 |
gen_configkernel.sh | 2 +- |
20 |
gen_determineargs.sh | 19 +++++++++++++++++-- |
21 |
5 files changed, 31 insertions(+), 3 deletions(-) |
22 |
|
23 |
diff --git a/defaults/config.sh b/defaults/config.sh |
24 |
index fed5355..8c7cf7e 100644 |
25 |
--- a/defaults/config.sh |
26 |
+++ b/defaults/config.sh |
27 |
@@ -23,6 +23,7 @@ KERNEL_SUPPORT_MICROCODE=no |
28 |
# |
29 |
DEFAULT_INITRAMFS_FILENAME="initramfs-%%KV%%.img" |
30 |
DEFAULT_INITRAMFS_SYMLINK_NAME="initramfs" |
31 |
+DEFAULT_KERNEL_CONFIG_FILENAME="kernel-config-%%KV%%" |
32 |
DEFAULT_KERNEL_FILENAME="vmlinuz-%%KV%%" |
33 |
DEFAULT_KERNEL_SYMLINK_NAME="kernel" |
34 |
DEFAULT_SYSTEMMAP_FILENAME="System.map-%%KV%%" |
35 |
|
36 |
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt |
37 |
index e00e028..7cd65fe 100644 |
38 |
--- a/doc/genkernel.8.txt |
39 |
+++ b/doc/genkernel.8.txt |
40 |
@@ -506,6 +506,12 @@ NOTE: No modules outside of the initramfs will be included! |
41 |
Archive file created using tar containing kernel binary, content of |
42 |
'/lib/modules' and the kernel config after the callbacks have run. |
43 |
|
44 |
+*--kernel-config-filename*=<...>:: |
45 |
+Set the kernel config filename used by *--save-config*. Please see |
46 |
+*--kernel-filename* option for available placeholders and restrictions. |
47 |
++ |
48 |
+By default, kernel config filename will be set to 'kernel-config-%%KV%%'. |
49 |
+ |
50 |
*--kernel-filename*=<...>:: |
51 |
Set kernel filename which will be used when kernel will be installed |
52 |
into *BOOTDIR* (implies *--install* option). The following placeholders |
53 |
|
54 |
diff --git a/gen_cmdline.sh b/gen_cmdline.sh |
55 |
index aa54c29..a34a739 100755 |
56 |
--- a/gen_cmdline.sh |
57 |
+++ b/gen_cmdline.sh |
58 |
@@ -193,6 +193,8 @@ longusage() { |
59 |
echo " --postclear Clear all tmp files and caches after genkernel has run" |
60 |
echo " --no-postclear Do not clean up after genkernel has run" |
61 |
echo " Output Settings" |
62 |
+ echo " --kernel-config-filename=<...>" |
63 |
+ echo " Set kernel config filename" |
64 |
echo " --kernel-filename=<...>" |
65 |
echo " Set kernel filename" |
66 |
echo " --kernel-symlink-name=<...>" |
67 |
@@ -701,6 +703,10 @@ parse_cmdline() { |
68 |
CMD_KERNCACHE="${*#*=}" |
69 |
print_info 3 "KERNCACHE: ${CMD_KERNCACHE}" |
70 |
;; |
71 |
+ --kernel-config-filename=*) |
72 |
+ CMD_KERNEL_CONFIG_FILENAME="${*#*=}" |
73 |
+ print_info 3 "CMD_KERNEL_CONFIG_FILENAME: ${CMD_KERNEL_CONFIG_FILENAME}" |
74 |
+ ;; |
75 |
--kernel-filename=*) |
76 |
CMD_KERNEL_FILENAME="${*#*=}" |
77 |
print_info 3 "CMD_KERNEL_FILENAME: ${CMD_KERNEL_FILENAME}" |
78 |
|
79 |
diff --git a/gen_configkernel.sh b/gen_configkernel.sh |
80 |
index 2f9a6a5..7804949 100755 |
81 |
--- a/gen_configkernel.sh |
82 |
+++ b/gen_configkernel.sh |
83 |
@@ -44,7 +44,7 @@ determine_kernel_config_file() { |
84 |
else |
85 |
local -a user_kconfig_candidates |
86 |
|
87 |
- # Always prefer kernel config based on actual $KV reading |
88 |
+ # Always prefer kernel config based on set --kernel-config-filename |
89 |
user_kconfig_candidates+=( "/etc/kernels/${GK_FILENAME_CONFIG}" ) |
90 |
|
91 |
if [ -n "${KERNEL_LOCALVERSION}" -a "${KERNEL_LOCALVERSION}" != "UNSET" ] |
92 |
|
93 |
diff --git a/gen_determineargs.sh b/gen_determineargs.sh |
94 |
index 14ef757..6c5d01c 100755 |
95 |
--- a/gen_determineargs.sh |
96 |
+++ b/gen_determineargs.sh |
97 |
@@ -87,7 +87,6 @@ determine_KV() { |
98 |
determine_output_filenames() { |
99 |
print_info 5 '' 1 0 |
100 |
|
101 |
- GK_FILENAME_CONFIG="kernel-config-${KV}" |
102 |
GK_FILENAME_KERNELZ="kernelz-${KV}" |
103 |
GK_FILENAME_TEMP_CONFIG="config-${ARCH}-${KV}" |
104 |
GK_FILENAME_TEMP_INITRAMFS="initramfs-${ARCH}-${KV}" |
105 |
@@ -96,7 +95,10 @@ determine_output_filenames() { |
106 |
GK_FILENAME_TEMP_SYSTEMMAP="System.map-${ARCH}-${KV}" |
107 |
|
108 |
# Do we have values? |
109 |
- if [ -z "${KERNEL_FILENAME}" ] |
110 |
+ if [ -z "${KERNEL_CONFIG_FILENAME}" ] |
111 |
+ then |
112 |
+ gen_die "--kernel-config-filename must be set to a non-empty value!" |
113 |
+ elif [ -z "${KERNEL_FILENAME}" ] |
114 |
then |
115 |
gen_die "--kernel-filename must be set to a non-empty value!" |
116 |
elif [ -z "${KERNEL_SYMLINK_NAME}" ] |
117 |
@@ -116,6 +118,17 @@ determine_output_filenames() { |
118 |
gen_die "--initramfs-filename must be set to a non-empty value!" |
119 |
fi |
120 |
|
121 |
+ # Kernel .config |
122 |
+ GK_FILENAME_CONFIG=$(arch_replace "${KERNEL_CONFIG_FILENAME}") |
123 |
+ GK_FILENAME_CONFIG=$(kv_replace "${GK_FILENAME_CONFIG}") |
124 |
+ |
125 |
+ if [ -z "${GK_FILENAME_CONFIG}" ] |
126 |
+ then |
127 |
+ gen_die "Internal error: Variable 'GK_FILENAME_CONFIG' is empty!" |
128 |
+ else |
129 |
+ print_info 5 "GK_FILENAME_CONFIG set to '${GK_FILENAME_CONFIG}' (was: '${KERNEL_CONFIG_FILENAME}')" |
130 |
+ fi |
131 |
+ |
132 |
# Kernel |
133 |
GK_FILENAME_KERNEL=$(arch_replace "${KERNEL_FILENAME}") |
134 |
GK_FILENAME_KERNEL=$(kv_replace "${GK_FILENAME_KERNEL}") |
135 |
@@ -221,6 +234,7 @@ determine_output_filenames() { |
136 |
fi |
137 |
|
138 |
local -a filename_vars |
139 |
+ filename_vars+=( 'GK_FILENAME_CONFIG;--kernel-config-filename' ) |
140 |
filename_vars+=( 'GK_FILENAME_KERNEL;--kernel-filename' ) |
141 |
filename_vars+=( 'GK_FILENAME_KERNEL_SYMLINK;--kernel-symlink-name' ) |
142 |
filename_vars+=( 'GK_FILENAME_INITRAMFS;--initramfs-filename' ) |
143 |
@@ -275,6 +289,7 @@ determine_real_args() { |
144 |
set_config_with_override BOOL KERNEL_SOURCES CMD_KERNEL_SOURCES "yes" |
145 |
set_config_with_override STRING INITRAMFS_FILENAME CMD_INITRAMFS_FILENAME "${DEFAULT_INITRAMFS_FILENAME}" |
146 |
set_config_with_override STRING INITRAMFS_SYMLINK_NAME CMD_INITRAMFS_SYMLINK_NAME "${DEFAULT_INITRAMFS_SYMLINK_NAME}" |
147 |
+ set_config_with_override STRING KERNEL_CONFIG_FILENAME CMD_KERNEL_CONFIG_FILENAME "${DEFAULT_KERNEL_CONFIG_FILENAME}" |
148 |
set_config_with_override STRING KERNEL_FILENAME CMD_KERNEL_FILENAME "${DEFAULT_KERNEL_FILENAME}" |
149 |
set_config_with_override STRING KERNEL_SYMLINK_NAME CMD_KERNEL_SYMLINK_NAME "${DEFAULT_KERNEL_SYMLINK_NAME}" |
150 |
set_config_with_override STRING SYSTEMMAP_FILENAME CMD_SYSTEMMAP_FILENAME "${DEFAULT_SYSTEMMAP_FILENAME}" |