Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a12f4d2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "kbuild: add generic mergeconfig target, %.config"

parents 3fa5c25a 796eec77
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -104,22 +104,20 @@ endif
%_defconfig: $(obj)/conf
	$(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)

configfiles=$(wildcard $(srctree)/kernel/configs/$(1).config $(srctree)/arch/$(SRCARCH)/configs/$(1).config)
configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)

define mergeconfig
$(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
$(if $(call configfiles,$(1)),, $(error No configuration exists for this target on this architecture))
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(call configfiles,$(1))
$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
endef
%.config: $(obj)/conf
	$(if $(call configfiles),, $(error No configuration exists for this target on this architecture))
	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles)
	+$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig

PHONY += kvmconfig
kvmconfig:
	$(call mergeconfig,kvm_guest)
kvmconfig: kvm_guest.config
	@:

PHONY += tinyconfig
tinyconfig: allnoconfig
	$(call mergeconfig,tiny)
tinyconfig:
	$(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config

# Help text used by make help
help:
+14 −11
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ usage() {
	echo "  -O    dir to put generated output files"
}

MAKE=true
RUNMAKE=true
ALLTARGET=alldefconfig
WARNREDUN=false
OUTPUT=.
@@ -48,7 +48,7 @@ while true; do
		continue
		;;
	"-m")
		MAKE=false
		RUNMAKE=false
		shift
		continue
		;;
@@ -80,6 +80,11 @@ done
INITFILE=$1
shift;

if [ ! -r "$INITFILE" ]; then
	echo "The base file '$INITFILE' does not exist.  Exit." >&2
	exit 1
fi

MERGE_LIST=$*
SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
@@ -93,8 +98,7 @@ for MERGE_FILE in $MERGE_LIST ; do
	CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)

	for CFG in $CFG_LIST ; do
		grep -q -w $CFG $TMP_FILE
		if [ $? -eq 0 ] ; then
		grep -q -w $CFG $TMP_FILE || continue
		PREV_VAL=$(grep -w $CFG $TMP_FILE)
		NEW_VAL=$(grep -w $CFG $MERGE_FILE)
		if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
@@ -106,12 +110,11 @@ for MERGE_FILE in $MERGE_LIST ; do
			echo Value of $CFG is redundant by fragment $MERGE_FILE:
		fi
		sed -i "/$CFG[ =]/d" $TMP_FILE
		fi
	done
	cat $MERGE_FILE >> $TMP_FILE
done

if [ "$MAKE" = "false" ]; then
if [ "$RUNMAKE" = "false" ]; then
	cp $TMP_FILE $OUTPUT/.config
	echo "#"
	echo "# merged configuration written to $OUTPUT/.config (needs make)"