scripts: add action to extract config from a build.log file
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu Feb 11 21:28:10 2010 +0100 (2010-02-11)
changeset 18032c0ed9ec9a8c
parent 1802 cb9e664f758b
child 1804 da584d1d6ab8
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.
ct-ng.comp
docs/overview.txt
kconfig/kconfig.mk
     1.1 --- a/ct-ng.comp	Thu Feb 11 19:21:56 2010 +0100
     1.2 +++ b/ct-ng.comp	Thu Feb 11 21:28:10 2010 +0100
     1.3 @@ -14,7 +14,7 @@
     1.4      start_steps=$(echo "${steps}" |sed -r -e 's/($| )/\1+/;')
     1.5      stop_steps=$(echo "${steps}" |sed -r -e 's/(^| )/+\1/;')
     1.6  
     1.7 -    actions='help menuconfig oldconfig saveconfig
     1.8 +    actions='help menuconfig oldconfig saveconfig extractconfig
     1.9               build build. build-all build-all.
    1.10               list-samples list-steps show-tuple show-all show-config
    1.11               clean distclean wiki-samples updatetools
     2.1 --- a/docs/overview.txt	Thu Feb 11 19:21:56 2010 +0100
     2.2 +++ b/docs/overview.txt	Thu Feb 11 21:28:10 2010 +0100
     2.3 @@ -331,11 +331,20 @@
     2.4  to create a new toolchain. That needs a very little bit of effort on your side
     2.5  but is quite easy. The options to build a toolchain are saved with the
     2.6  toolchain, and you can retrieve this configuration by running:
     2.7 -  ${CT_TARGET}-config
     2.8 +  ${CT_TARGET}-ct-ng.config
     2.9  
    2.10 -This will dump the configuration to stdout, so to rebuild a toolchain with this
    2.11 -configuration, the following is all you need to do:
    2.12 -  ${CT_TARGET}-config >.config
    2.13 +An alternate method is to extract the configuration from a build.log file.
    2.14 +This will be necessary if your toolchain was build with crosstool-NG prior
    2.15 +to 1.4.0, but can be used with build.log files from any version:
    2.16 +  ct-ng extractconfig <build.log >.config
    2.17 +
    2.18 +Or, if your build.log file is compressed (most probably!):
    2.19 +  bzcat build.log.bz2 |ct-ng extractconfig >.config
    2.20 +
    2.21 +The above commands will dump the configuration to stdout, so to rebuild a
    2.22 +toolchain with this configuration, just redirect the output to the
    2.23 +.config file:
    2.24 +  ${CT_TARGET}-ct-ng.config >.config
    2.25    ct-ng oldconfig
    2.26  
    2.27  Then, you can review and change the configuration by running:
     3.1 --- a/kconfig/kconfig.mk	Thu Feb 11 19:21:56 2010 +0100
     3.2 +++ b/kconfig/kconfig.mk	Thu Feb 11 21:28:10 2010 +0100
     3.3 @@ -24,12 +24,29 @@
     3.4  	@$(ECHO) "  CONF  $(KCONFIG_TOP)"
     3.5  	$(SILENT)$< -s $(KCONFIG_TOP)
     3.6  
     3.7 +# Always be silent, the stdout an be >.config
     3.8 +extractconfig:
     3.9 +	@awk 'BEGIN { dump=0; }                                                 \
    3.10 +	      dump==1 && $$0~/^\[.....\][[:space:]]+(# |)CT_/ {                 \
    3.11 +	          $$1="";                                                       \
    3.12 +	          gsub("^[[:space:]]","");                                      \
    3.13 +	          print;                                                        \
    3.14 +	      }                                                                 \
    3.15 +	      $$0~/Dumping user-supplied crosstool-NG configuration: done in/ { \
    3.16 +	          dump=0;                                                       \
    3.17 +	      }                                                                 \
    3.18 +	      $$0~/Dumping user-supplied crosstool-NG configuration$$/ {        \
    3.19 +	          dump=1;                                                       \
    3.20 +	      }'
    3.21 +
    3.22  #-----------------------------------------------------------
    3.23  # Help text used by make help
    3.24  
    3.25  help-config::
    3.26  	@echo  '  menuconfig         - Update current config using a menu based program'
    3.27  	@echo  '  oldconfig          - Update current config using a provided .config as base'
    3.28 +	@echo  '  extractconfig      - Extract to stdout the configuration items from a'
    3.29 +	@echo  '                       build.log file piped to stdin'
    3.30  
    3.31  #-----------------------------------------------------------
    3.32  # Hmmm! Cheesy build!