1 |
commit: 66be1d9d8f1fc241de0e8d033f616735e5cb5d1e |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Mar 29 04:03:57 2019 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 29 04:13:05 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=66be1d9d |
7 |
|
8 |
Add special value "default" for --kernel-config parameter |
9 |
|
10 |
--kernel-config=default will make genkernel to ignoring all user |
11 |
kernel configurations so that genkernel will use default kernel |
12 |
configuration shipped with genkernel to build a kernel. |
13 |
|
14 |
Useful to start from scratch if needed or for debugging. |
15 |
|
16 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
17 |
|
18 |
doc/genkernel.8.txt | 4 +++- |
19 |
gen_cmdline.sh | 5 ++++- |
20 |
gen_configkernel.sh | 38 +++++++++++++++++++++++++++----------- |
21 |
3 files changed, 34 insertions(+), 13 deletions(-) |
22 |
|
23 |
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt |
24 |
index 04633cf..15d5454 100644 |
25 |
--- a/doc/genkernel.8.txt |
26 |
+++ b/doc/genkernel.8.txt |
27 |
@@ -181,11 +181,13 @@ KERNEL LOCATIONS |
28 |
This specifies the location of the kernel sources; the default |
29 |
is '/usr/src/linux'. |
30 |
|
31 |
-*--kernel-config*=<file>:: |
32 |
+*--kernel-config*=<file|default>:: |
33 |
This specifies a kernel configuration file to use for compilation; |
34 |
by default genkernel uses the config from the previous |
35 |
build of the same kernel version or a default kernel config if |
36 |
there isn't a previous config. |
37 |
+ Use the special value 'default' to force usage of default kernel |
38 |
+ config. |
39 |
|
40 |
*--module-prefix*=<dir>:: |
41 |
Prefix to kernel module destination, modules will be installed in |
42 |
|
43 |
diff --git a/gen_cmdline.sh b/gen_cmdline.sh |
44 |
index 8971c51..795c2c6 100755 |
45 |
--- a/gen_cmdline.sh |
46 |
+++ b/gen_cmdline.sh |
47 |
@@ -63,7 +63,10 @@ longusage() { |
48 |
echo " --no-static Do not build a static (monolithic kernel)." |
49 |
echo " Kernel settings" |
50 |
echo " --kerneldir=<dir> Location of the kernel sources" |
51 |
- echo " --kernel-config=<file> Kernel configuration file to use for compilation" |
52 |
+ echo " --kernel-config=<file|default>" |
53 |
+ echo " Kernel configuration file to use for compilation." |
54 |
+ echo " Use 'default' to explicitly start from scratch" |
55 |
+ echo " using genkernel defaults." |
56 |
echo " --module-prefix=<dir> Prefix to kernel module destination, modules" |
57 |
echo " will be installed in <prefix>/lib/modules" |
58 |
echo " Low-Level Compile settings" |
59 |
|
60 |
diff --git a/gen_configkernel.sh b/gen_configkernel.sh |
61 |
index 34fdbe1..063c9ac 100755 |
62 |
--- a/gen_configkernel.sh |
63 |
+++ b/gen_configkernel.sh |
64 |
@@ -4,7 +4,8 @@ |
65 |
# Fills variable KERNEL_CONFIG |
66 |
determine_config_file() { |
67 |
print_info 2 "Checking for suitable kernel configuration..." |
68 |
- if [ -n "${CMD_KERNEL_CONFIG}" ] |
69 |
+ |
70 |
+ if [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" != "default" ] |
71 |
then |
72 |
KERNEL_CONFIG=$(expand_file "${CMD_KERNEL_CONFIG}") |
73 |
if [ -z "${KERNEL_CONFIG}" ] |
74 |
@@ -15,13 +16,21 @@ determine_config_file() { |
75 |
gen_die "${error_msg}" |
76 |
fi |
77 |
else |
78 |
- for f in \ |
79 |
- "/etc/kernels/kernel-config-${ARCH}-${KV}" \ |
80 |
- "${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" \ |
81 |
- "${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" \ |
82 |
- "${GK_SHARE}/arch/${ARCH}/generated-config" \ |
83 |
- "${GK_SHARE}/arch/${ARCH}/kernel-config" \ |
84 |
- "${DEFAULT_KERNEL_CONFIG}" |
85 |
+ local -a kconfig_candidates |
86 |
+ kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" ) |
87 |
+ kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" ) |
88 |
+ kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/generated-config" ) |
89 |
+ kconfig_candidates+=( "${GK_SHARE}/arch/${ARCH}/kernel-config" ) |
90 |
+ kconfig_candidates+=( "${DEFAULT_KERNEL_CONFIG}" ) |
91 |
+ |
92 |
+ if [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" = "default" ] |
93 |
+ then |
94 |
+ print_info 1 "Default configuration was forced. Will ignore any user kernel configuration!" |
95 |
+ else |
96 |
+ kconfig_candidates=( "/etc/kernels/kernel-config-${ARCH}-${KV}" ${kconfig_candidates[@]} ) |
97 |
+ fi |
98 |
+ |
99 |
+ for f in "${kconfig_candidates[@]}" |
100 |
do |
101 |
[ -z "${f}" ] && continue |
102 |
|
103 |
@@ -49,7 +58,7 @@ determine_config_file() { |
104 |
# Validate the symlink result if any |
105 |
if [ -z "${KERNEL_CONFIG}" -o ! -f "${KERNEL_CONFIG}" ] |
106 |
then |
107 |
- if [ -n "${CMD_KERNEL_CONFIG}" ] |
108 |
+ if [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" != "default" ] |
109 |
then |
110 |
error_msg="No kernel .config: File '${CMD_KERNEL_CONFIG}' not found! " |
111 |
error_msg+="Check --kernel-config value or unset " |
112 |
@@ -77,21 +86,28 @@ config_kernel() { |
113 |
print_info 1 "$(getIndent 1)>> --clean is disabled; not running 'make clean'." |
114 |
fi |
115 |
|
116 |
- if isTrue "${MRPROPER}" |
117 |
+ if isTrue "${MRPROPER}" || [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" = "default" ] |
118 |
then |
119 |
# Backup current kernel .config |
120 |
if [ -f "${KERNEL_OUTPUTDIR}/.config" ] |
121 |
then |
122 |
# Current .config is different then one we are going to use |
123 |
- if ! diff -q "${KERNEL_OUTPUTDIR}"/.config "${KERNEL_CONFIG}" > /dev/null |
124 |
+ if [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" = "default" ] || \ |
125 |
+ ! diff -q "${KERNEL_OUTPUTDIR}"/.config "${KERNEL_CONFIG}" > /dev/null |
126 |
then |
127 |
NOW=`date +--%Y-%m-%d--%H-%M-%S` |
128 |
cp "${KERNEL_OUTPUTDIR}/.config" "${KERNEL_OUTPUTDIR}/.config${NOW}.bak" \ |
129 |
|| gen_die "Could not backup kernel config (${KERNEL_OUTPUTDIR}/.config)" |
130 |
print_info 1 "$(getIndent 1)>> Previous config backed up to .config${NOW}.bak" |
131 |
+ |
132 |
+ [ -n "${CMD_KERNEL_CONFIG}" -a "${CMD_KERNEL_CONFIG}" = "default" ] && |
133 |
+ rm "${KERNEL_OUTPUTDIR}/.config" > /dev/null |
134 |
fi |
135 |
fi |
136 |
+ fi |
137 |
|
138 |
+ if isTrue "${MRPROPER}" |
139 |
+ then |
140 |
print_info 1 "$(getIndent 1)>> Running mrproper..." |
141 |
compile_generic mrproper kernel |
142 |
else |