From 013230cda91a104af9e1344ccf926c19c52d9e1d Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Thu, 11 Feb 2010 21:28:10 +0100 Subject: scripts: add action to extract config from a build.log file That got removed quite some time ago, but is really usefull to get the configuration from a build.log file of a failing build. diff --git a/ct-ng.comp b/ct-ng.comp index e14b48e..f6759a7 100644 --- a/ct-ng.comp +++ b/ct-ng.comp @@ -14,7 +14,7 @@ _ct-ng () { start_steps=$(echo "${steps}" |sed -r -e 's/($| )/\1+/;') stop_steps=$(echo "${steps}" |sed -r -e 's/(^| )/+\1/;') - actions='help menuconfig oldconfig saveconfig + actions='help menuconfig oldconfig saveconfig extractconfig build build. build-all build-all. list-samples list-steps show-tuple show-all show-config clean distclean wiki-samples updatetools diff --git a/docs/overview.txt b/docs/overview.txt index 206e8c9..a0e1222 100644 --- a/docs/overview.txt +++ b/docs/overview.txt @@ -331,11 +331,20 @@ If you have an existing toolchain, you can re-use the options used to build it to create a new toolchain. That needs a very little bit of effort on your side but is quite easy. The options to build a toolchain are saved with the toolchain, and you can retrieve this configuration by running: - ${CT_TARGET}-config + ${CT_TARGET}-ct-ng.config -This will dump the configuration to stdout, so to rebuild a toolchain with this -configuration, the following is all you need to do: - ${CT_TARGET}-config >.config +An alternate method is to extract the configuration from a build.log file. +This will be necessary if your toolchain was build with crosstool-NG prior +to 1.4.0, but can be used with build.log files from any version: + ct-ng extractconfig .config + +Or, if your build.log file is compressed (most probably!): + bzcat build.log.bz2 |ct-ng extractconfig >.config + +The above commands will dump the configuration to stdout, so to rebuild a +toolchain with this configuration, just redirect the output to the +.config file: + ${CT_TARGET}-ct-ng.config >.config ct-ng oldconfig Then, you can review and change the configuration by running: diff --git a/kconfig/kconfig.mk b/kconfig/kconfig.mk index 296ca5e..88dcdd3 100644 --- a/kconfig/kconfig.mk +++ b/kconfig/kconfig.mk @@ -24,12 +24,29 @@ oldconfig: $(obj)/conf .config @$(ECHO) " CONF $(KCONFIG_TOP)" $(SILENT)$< -s $(KCONFIG_TOP) +# Always be silent, the stdout an be >.config +extractconfig: + @awk 'BEGIN { dump=0; } \ + dump==1 && $$0~/^\[.....\][[:space:]]+(# |)CT_/ { \ + $$1=""; \ + gsub("^[[:space:]]",""); \ + print; \ + } \ + $$0~/Dumping user-supplied crosstool-NG configuration: done in/ { \ + dump=0; \ + } \ + $$0~/Dumping user-supplied crosstool-NG configuration$$/ { \ + dump=1; \ + }' + #----------------------------------------------------------- # Help text used by make help help-config:: @echo ' menuconfig - Update current config using a menu based program' @echo ' oldconfig - Update current config using a provided .config as base' + @echo ' extractconfig - Extract to stdout the configuration items from a' + @echo ' build.log file piped to stdin' #----------------------------------------------------------- # Hmmm! Cheesy build! -- cgit v0.10.2-6-g49f6