Patchwork Allow relocated .config location

login
register
about
Submitter Patrick Georgi
Date 2010-11-23 07:51:37
Message ID <4CEB7289.90104@georgi-clan.de>
Download mbox | patch
Permalink /patch/2352/
State Accepted
Headers show

Comments

Patrick Georgi - 2010-11-23 07:51:37
Hi,

right now, the build system assumes that .config is in $(top). abuild
stores each board's .config by copying it into the build directory after
the fact, while clobbering any existing files.

With the attached patch, it's possible to define a new location for
.config, using the DOTCONFIG variable, and abuild makes use of that.

It still messes around with .xcompile and the various .config copies, so
this is only the second step of many (I already started on that topic a
while ago, with a minor change to Makefile), but it's a start, and
should be self contained.

==
Allow user to relocate .config by using the DOTCONFIG variable.
Make abuild use that.

Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Uwe Hermann - 2010-12-03 00:05:51
On Tue, Nov 23, 2010 at 08:51:37AM +0100, Patrick Georgi wrote:
> Hi,
> 
> right now, the build system assumes that .config is in $(top). abuild
> stores each board's .config by copying it into the build directory after
> the fact, while clobbering any existing files.
> 
> With the attached patch, it's possible to define a new location for
> .config, using the DOTCONFIG variable, and abuild makes use of that.
> 
> It still messes around with .xcompile and the various .config copies, so
> this is only the second step of many (I already started on that topic a
> while ago, with a minor change to Makefile), but it's a start, and
> should be self contained.
> 
> ==
> Allow user to relocate .config by using the DOTCONFIG variable.
> Make abuild use that.
> 
> Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>

Acked-by: Uwe Hermann <uwe@hermann-uwe.de>

I built a few boards with abuild, seems to work fine.


Uwe.

Patch

Index: util/abuild/abuild

===================================================================
--- util/abuild/abuild	(Revision 6119)

+++ util/abuild/abuild	(Arbeitskopie)

@@ -162,53 +162,52 @@ 

 	if [ "$CONFIG" != "" ]; then
 		printf "  Using existing configuration $CONFIG ... "
 		xml "  <config>$CONFIG</config>"
-		cp $CONFIG .config
+		cp $CONFIG ${build_dir}/config.build
 	else
 		printf "  Creating config file... "
 		xml "  <config>autogenerated</config>"
 		grep "if[\t ]*VENDOR" src/mainboard/$VENDOR/$MAINBOARD/../Kconfig | \
-			sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > .config
+			sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > ${build_dir}/config.build
 		grep "if[\t ]*BOARD" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
-			sed "s,^.*\(BOARD_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
+			sed "s,^.*\(BOARD_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> ${build_dir}/config.build
 		grep "select[\t ]*ARCH" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
-			sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
-		echo "CONFIG_MAINBOARD_DIR=\"$VENDOR/$MAINBOARD\"" >> .config
-		echo "CONFIG_CBFS_PREFIX=\"$cbfs_prefix\"" >> .config
+			sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> ${build_dir}/config.build
+		echo "CONFIG_MAINBOARD_DIR=\"$VENDOR/$MAINBOARD\"" >> ${build_dir}/config.build
+		echo "CONFIG_CBFS_PREFIX=\"$cbfs_prefix\"" >> ${build_dir}/config.build
 		if [ "$PAYLOAD" != "/dev/null" ]; then
-			echo "# CONFIG_PAYLOAD_NONE is not set" >> .config
-			echo "CONFIG_PAYLOAD_ELF=y" >> .config
-			echo "CONFIG_FALLBACK_PAYLOAD_FILE=\"$PAYLOAD\"" >> .config
+			echo "# CONFIG_PAYLOAD_NONE is not set" >> ${build_dir}/config.build
+			echo "CONFIG_PAYLOAD_ELF=y" >> ${build_dir}/config.build
+			echo "CONFIG_FALLBACK_PAYLOAD_FILE=\"$PAYLOAD\"" >> ${build_dir}/config.build
 		fi
 
 		if [ "$loglevel" != "default" ]; then
 			printf "(loglevel override) "
-			echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL_$loglevel=y" >> .config
-			echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL=$loglevel" >> .config
-			echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$loglevel=y" >> .config
-			echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" >> .config
+			echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL_$loglevel=y" >> ${build_dir}/config.build
+			echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL=$loglevel" >> ${build_dir}/config.build
+			echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$loglevel=y" >> ${build_dir}/config.build
+			echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" >> ${build_dir}/config.build
 		fi
 
 		if [ "$update" != "false" ]; then
 			printf "(update) "
-			echo "CONFIG_UPDATE_IMAGE=y" >> .config
+			echo "CONFIG_UPDATE_IMAGE=y" >> ${build_dir}/config.build
 		fi
 
 		if [ "$ccache" = "true" ]; then
 			printf "(ccache enabled) "
-			echo "CONFIG_CCACHE=y" >> .config
+			echo "CONFIG_CCACHE=y" >> ${build_dir}/config.build
 		fi
 
 		if [ "$scanbuild" = "true" ]; then
 			printf "(scan-build enabled) "
-			echo "CONFIG_SCANBUILD_ENABLE=y" >> .config
-			echo "CONFIG_SCANBUILD_REPORT_LOCATION=\"$TARGET/scan-build-results-tmp\"" >> .config
+			echo "CONFIG_SCANBUILD_ENABLE=y" >> ${build_dir}/config.build
+			echo "CONFIG_SCANBUILD_REPORT_LOCATION=\"$TARGET/scan-build-results-tmp\"" >> ${build_dir}/config.build
 		fi
 	fi
 
 	#yes "" | $MAKE oldconfig -j $cpus obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
-	yes "" | $MAKE oldconfig obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
+	yes "" | $MAKE oldconfig DOTCONFIG=${build_dir}/config.build obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
 	ret=$?
-	mv .config.old $TARGET/${VENDOR}_${MAINBOARD}/config.in
 	if [ $ret -eq 0 ]; then
 		printf "ok; "
 		xml "  <builddir>ok</builddir>"
@@ -245,9 +244,8 @@ 

 	echo "TOP=$ROOT" >> $MAKEFILE
 	echo "OUT=$TARGET/${VENDOR}_${MAINBOARD}" >> $MAKEFILE
 	echo "all:" >> $MAKEFILE
-	echo "	cp config.build \$(TOP)/.config" >> $MAKEFILE
-	echo "	cd \$(TOP); \$(MAKE) oldconfig obj=\$(OUT)" >> $MAKEFILE
-	echo "	cd \$(TOP); \$(MAKE) obj=\$(OUT)" >> $MAKEFILE
+	echo "	cd \$(TOP); \$(MAKE) oldconfig DOTCONFIG=\$(OUT)/config.build obj=\$(OUT)" >> $MAKEFILE
+	echo "	cd \$(TOP); \$(MAKE) DOTCONFIG=\$(OUT)/config.build obj=\$(OUT)" >> $MAKEFILE
 
 	return $ret
 }
@@ -265,10 +263,9 @@ 

 	CURR=$( pwd )
 	#stime=`perl -e 'print time();' 2>/dev/null || date +%s`
 	build_dir=$TARGET/${VENDOR}_${MAINBOARD}
-	eval $MAKE $silent -j $cpus obj=${build_dir} objutil=$TARGET/sharedutils \
+	eval $MAKE $silent -j $cpus DOTCONFIG=${build_dir}/config.build obj=${build_dir} objutil=$TARGET/sharedutils \
 		&> ${build_dir}/make.log
 	ret=$?
-	mv .config ${build_dir}/config.build
 	mv .xcompile ${build_dir}/xcompile.build
 	cd $TARGET/${VENDOR}_${MAINBOARD}
 
Index: Makefile

===================================================================
--- Makefile	(Revision 6117)

+++ Makefile	(Arbeitskopie)

@@ -47,7 +47,10 @@ 

 CONFIG_SHELL := sh
 KBUILD_DEFCONFIG := configs/defconfig
 UNAME_RELEASE := $(shell uname -r)
-HAVE_DOTCONFIG := $(wildcard .config)
+DOTCONFIG ?= .config
+KCONFIG_CONFIG = $(DOTCONFIG)
+export KCONFIG_CONFIG
+HAVE_DOTCONFIG := $(wildcard $(DOTCONFIG))
 MAKEFLAGS += -rR --no-print-directory
 
 # Make is silent per default, but 'make V=1' will show all compiler calls.