Skip to content

Commit

Permalink
Merge pull request #76 from Reinis/merge_kconfig
Browse files Browse the repository at this point in the history
Add support for merging kernel config fragment
  • Loading branch information
mudler authored Dec 22, 2018
2 parents b375654 + 5d72fed commit 7b20b78
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gen_cmdline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ longusage() {
echo " --color Output debug in color"
echo " --no-color Do not output debug in color"
echo " Kernel Configuration settings"
echo " --mergekconfig Run merge_config.sh instead of oldconfig"
echo " --no-mergekconfig Do not run merge_config.sh instead of oldconfig"
echo " --menuconfig Run menuconfig after oldconfig"
echo " --no-menuconfig Do not run menuconfig after oldconfig"
echo " --nconfig Run nconfig after oldconfig"
Expand Down Expand Up @@ -358,6 +360,10 @@ parse_cmdline() {
LOGLEVEL="${CMD_LOGLEVEL}"
print_info 2 "CMD_LOGLEVEL: ${CMD_LOGLEVEL}"
;;
--mergekconfig|--no-mergekconfig)
CMD_MERGE_KCONFIG=`parse_optbool "$*"`
print_info 2 "CMD_MERGE_KCONFIG: ${CMD_MERGE_KCONFIG}"
;;
--menuconfig)
TERM_LINES=`stty -a | head -n 1 | cut -d\ -f5 | cut -d\; -f1`
TERM_COLUMNS=`stty -a | head -n 1 | cut -d\ -f7 | cut -d\; -f1`
Expand Down
14 changes: 14 additions & 0 deletions gen_configkernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ config_kernel() {
fi
fi

# Support kernel config fragment merging.
if isTrue "${MERGE_KCONFIG}"
then
KCONFIG_FRAGMENT=${KCONFIG_FRAGMENT:-/etc/default/genkernel_kconfig_fragment}
local message="Error: Config fragment ${KCONFIG_FRAGMENT} not found!"
print_info 1 "kernel: Merging config with ${KCONFIG_FRAGMENT}"
[[ -f "${KCONFIG_FRAGMENT}" ]] || gen_die "${message}"
KCONFIG_CONFIG="${KERNEL_OUTPUTDIR}/.config" \
"${KERNEL_DIR}"/scripts/kconfig/merge_config.sh \
"${KERNEL_OUTPUTDIR}/.config" \
"${KCONFIG_FRAGMENT[@]}"
[[ "$?" ]] || gen_die "Error: merge_config.sh failed!"
fi

if isTrue "${OLDCONFIG}"
then
print_info 1 ' >> Running oldconfig...'
Expand Down
7 changes: 7 additions & 0 deletions gen_determineargs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ determine_real_args() {
set_config_with_override BOOL PLYMOUTH CMD_PLYMOUTH
set_config_with_override BOOL POSTCLEAR CMD_POSTCLEAR
set_config_with_override BOOL MRPROPER CMD_MRPROPER
set_config_with_override BOOL MERGE_KCONFIG CMD_MERGE_KCONFIG
set_config_with_override BOOL MENUCONFIG CMD_MENUCONFIG
set_config_with_override BOOL NCONFIG CMD_NCONFIG
set_config_with_override BOOL CLEAN CMD_CLEAN
Expand Down Expand Up @@ -187,6 +188,12 @@ determine_real_args() {
fi
fi

# After merging config fragments, make alldefconfig is run by default
if isTrue ${MERGE_KCONFIG}
then
OLDCONFIG=0
fi

# Special case: If --no-clean is specified on the command line,
# imply --no-mrproper.
if [ "${CMD_CLEAN}" != '' ]
Expand Down
5 changes: 5 additions & 0 deletions genkernel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ MOUNTBOOT="yes"
# Make symlinks in BOOTDIR automatically?
#SYMLINK="no"

# Merge kernel config fragment
#MERGE_KCONFIG="yes"
# Kernel config fragment(s) to merge
#KCONFIG_FRAGMENT=( "/etc/default/genkernel_kconfig_fragment" )

# Save the new configuration in /etc/kernels upon
# successfull compilation
SAVE_CONFIG="yes"
Expand Down

0 comments on commit 7b20b78

Please sign in to comment.