1 |
From: "W. Trevor King" <wking@×××××××.us> |
2 |
|
3 |
Some kernel config manipulation options already exist in genkernel |
4 |
(--lvm, --multipath, ...), but this option allows you to override a |
5 |
given config setting without rolling a new option specific to that |
6 |
setting: |
7 |
|
8 |
$ genkernel ... --kconfig=CONFIG_LOGO=n ... |
9 |
|
10 |
Ordinarily it would be easier (and more robust, with dependency |
11 |
checking) to use --menuconfig or similar, but for reproducible |
12 |
catalyst builds its better to specify the overrides explicitly in the |
13 |
spec file. |
14 |
--- |
15 |
I'm not sure how patches should be submitted, so I'm defaulting to a |
16 |
Linux/Git-style email. Let me know if you'd rather have the patch via |
17 |
bugs.g.o or through some other channel. |
18 |
|
19 |
|
20 |
gen_cmdline.sh | 7 +++++++ |
21 |
gen_configkernel.sh | 5 +++++ |
22 |
genkernel | 1 + |
23 |
3 files changed, 13 insertions(+) |
24 |
|
25 |
diff --git a/gen_cmdline.sh b/gen_cmdline.sh |
26 |
index 5503bb5..6766b4e 100755 |
27 |
--- a/gen_cmdline.sh |
28 |
+++ b/gen_cmdline.sh |
29 |
@@ -32,6 +32,7 @@ longusage() { |
30 |
echo " --save-config Save the configuration to /etc/kernels" |
31 |
echo " --no-save-config Don't save the configuration to /etc/kernels" |
32 |
echo " --virtio Include VirtIO kernel code" |
33 |
+ echo " --kconfig=<CONFIG>=<value> Set a specific kernel config option" |
34 |
echo " Kernel Compile settings" |
35 |
echo " --oldconfig Implies --no-clean and runs a 'make oldconfig'" |
36 |
echo " --clean Run make clean before compilation" |
37 |
@@ -326,6 +327,12 @@ parse_cmdline() { |
38 |
CMD_VIRTIO=`parse_optbool "$*"` |
39 |
print_info 2 "CMD_VIRTIO: ${CMD_VIRTIO}" |
40 |
;; |
41 |
+ --kconfig=*) |
42 |
+ KCONFIG_KEY=$(echo "$*" | cut -d= -f2) |
43 |
+ KCONFIG_VALUE=$(echo "$*" | cut -d= -f3) |
44 |
+ KCONFIG["$KCONFIG_KEY"]="$KCONFIG_VALUE" |
45 |
+ print_info 2 "KCONFIG: ${KCONFIG_KEY}=${KCONFIG_VALUE}" |
46 |
+ ;; |
47 |
--multipath|--no-multipath) |
48 |
CMD_MULTIPATH=`parse_optbool "$*"` |
49 |
if [ "$CMD_MULTIPATH" = "1" -a ! -e /usr/include/libdevmapper.h ] |
50 |
diff --git a/gen_configkernel.sh b/gen_configkernel.sh |
51 |
index a69c713..c1a1cce 100755 |
52 |
--- a/gen_configkernel.sh |
53 |
+++ b/gen_configkernel.sh |
54 |
@@ -160,4 +160,9 @@ config_kernel() { |
55 |
sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_VIRTIO_NET.*/CONFIG_VIRTIO_NET=y/g' |
56 |
sed -i ${KERNEL_DIR}/.config -e 's/#\? \?CONFIG_VHOST_NET.*/CONFIG_VHOST_NET=y/g' |
57 |
fi |
58 |
+ |
59 |
+ for KEY in "${!KCONFIG[@]}"; do |
60 |
+ VALUE="${KCONFIG[$KEY]}" |
61 |
+ sed -i ${KERNEL_DIR}/.config -e "s/#\? \?$KEY.*/$KEY=$VALUE/g' |
62 |
+ done |
63 |
} |
64 |
diff --git a/genkernel b/genkernel |
65 |
index 83fbb51..2784992 100755 |
66 |
--- a/genkernel |
67 |
+++ b/genkernel |
68 |
@@ -79,6 +79,7 @@ trap trap_cleanup SIGHUP SIGQUIT SIGINT SIGTERM SIGKILL |
69 |
BUILD_KERNEL=0 |
70 |
BUILD_RAMDISK=0 |
71 |
BUILD_MODULES=0 |
72 |
+declare -A KCONFIG |
73 |
|
74 |
# Parse all command line options... |
75 |
Options=$* # Save for later |
76 |
-- |
77 |
1.8.2.rc0.16.g20a599e |