Skip to content

Commit 7b20b78

Browse files
authored
Merge pull request #76 from Reinis/merge_kconfig
Add support for merging kernel config fragment
2 parents b375654 + 5d72fed commit 7b20b78

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

gen_cmdline.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ longusage() {
2323
echo " --color Output debug in color"
2424
echo " --no-color Do not output debug in color"
2525
echo " Kernel Configuration settings"
26+
echo " --mergekconfig Run merge_config.sh instead of oldconfig"
27+
echo " --no-mergekconfig Do not run merge_config.sh instead of oldconfig"
2628
echo " --menuconfig Run menuconfig after oldconfig"
2729
echo " --no-menuconfig Do not run menuconfig after oldconfig"
2830
echo " --nconfig Run nconfig after oldconfig"
@@ -358,6 +360,10 @@ parse_cmdline() {
358360
LOGLEVEL="${CMD_LOGLEVEL}"
359361
print_info 2 "CMD_LOGLEVEL: ${CMD_LOGLEVEL}"
360362
;;
363+
--mergekconfig|--no-mergekconfig)
364+
CMD_MERGE_KCONFIG=`parse_optbool "$*"`
365+
print_info 2 "CMD_MERGE_KCONFIG: ${CMD_MERGE_KCONFIG}"
366+
;;
361367
--menuconfig)
362368
TERM_LINES=`stty -a | head -n 1 | cut -d\ -f5 | cut -d\; -f1`
363369
TERM_COLUMNS=`stty -a | head -n 1 | cut -d\ -f7 | cut -d\; -f1`

gen_configkernel.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ config_kernel() {
6565
fi
6666
fi
6767

68+
# Support kernel config fragment merging.
69+
if isTrue "${MERGE_KCONFIG}"
70+
then
71+
KCONFIG_FRAGMENT=${KCONFIG_FRAGMENT:-/etc/default/genkernel_kconfig_fragment}
72+
local message="Error: Config fragment ${KCONFIG_FRAGMENT} not found!"
73+
print_info 1 "kernel: Merging config with ${KCONFIG_FRAGMENT}"
74+
[[ -f "${KCONFIG_FRAGMENT}" ]] || gen_die "${message}"
75+
KCONFIG_CONFIG="${KERNEL_OUTPUTDIR}/.config" \
76+
"${KERNEL_DIR}"/scripts/kconfig/merge_config.sh \
77+
"${KERNEL_OUTPUTDIR}/.config" \
78+
"${KCONFIG_FRAGMENT[@]}"
79+
[[ "$?" ]] || gen_die "Error: merge_config.sh failed!"
80+
fi
81+
6882
if isTrue "${OLDCONFIG}"
6983
then
7084
print_info 1 ' >> Running oldconfig...'

gen_determineargs.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ determine_real_args() {
9797
set_config_with_override BOOL PLYMOUTH CMD_PLYMOUTH
9898
set_config_with_override BOOL POSTCLEAR CMD_POSTCLEAR
9999
set_config_with_override BOOL MRPROPER CMD_MRPROPER
100+
set_config_with_override BOOL MERGE_KCONFIG CMD_MERGE_KCONFIG
100101
set_config_with_override BOOL MENUCONFIG CMD_MENUCONFIG
101102
set_config_with_override BOOL NCONFIG CMD_NCONFIG
102103
set_config_with_override BOOL CLEAN CMD_CLEAN
@@ -187,6 +188,12 @@ determine_real_args() {
187188
fi
188189
fi
189190

191+
# After merging config fragments, make alldefconfig is run by default
192+
if isTrue ${MERGE_KCONFIG}
193+
then
194+
OLDCONFIG=0
195+
fi
196+
190197
# Special case: If --no-clean is specified on the command line,
191198
# imply --no-mrproper.
192199
if [ "${CMD_CLEAN}" != '' ]

genkernel.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ MOUNTBOOT="yes"
4141
# Make symlinks in BOOTDIR automatically?
4242
#SYMLINK="no"
4343

44+
# Merge kernel config fragment
45+
#MERGE_KCONFIG="yes"
46+
# Kernel config fragment(s) to merge
47+
#KCONFIG_FRAGMENT=( "/etc/default/genkernel_kconfig_fragment" )
48+
4449
# Save the new configuration in /etc/kernels upon
4550
# successfull compilation
4651
SAVE_CONFIG="yes"

0 commit comments

Comments
 (0)