# HG changeset patch # User "Yann E. MORIN" # Date 1222884640 0 # Node ID c444ce4b51b9d38957715c2bf88b9651172e6950 # Parent c4f2c434448cab0d3a6cd98f7ab539e340eaed24 Save the toolchain configuration to its own file, as an auto-extracting shell script: - get rid of the 'extractconfig' action, it was cumbersome to use, and badly documented, - introduce a skeleton for the config script, - update auto-completion, - document the config script. /trunk/kconfig/kconfig.mk | 9 2 7 0 ++------- /trunk/scripts/crosstool.sh | 6 5 1 0 +++++- /trunk/docs/overview.txt | 21 9 12 0 +++++++++------------ /trunk/tools/toolchain-config.in | 8 8 0 0 ++++++++ /trunk/ct-ng.comp | 2 1 1 0 +- 5 files changed, 25 insertions(+), 21 deletions(-) diff -r c4f2c434448c -r c444ce4b51b9 ct-ng.comp --- a/ct-ng.comp Tue Sep 30 18:19:48 2008 +0000 +++ b/ct-ng.comp Wed Oct 01 18:10:40 2008 +0000 @@ -13,7 +13,7 @@ start_steps=$(echo "${steps}" |sed -r -e 's/(^| )/\1+/;') stop_steps=$(echo "${steps}" |sed -r -e 's/(^| )/+\1/;') - actions='config menuconfig oldconfig saveconfig extractconfig + actions='config menuconfig oldconfig saveconfig list-samples build list-steps regtest regtest-local regtest-global clean distclean wiki-samples updatetools tarball' diff -r c4f2c434448c -r c444ce4b51b9 docs/overview.txt --- a/docs/overview.txt Tue Sep 30 18:19:48 2008 +0000 +++ b/docs/overview.txt Wed Oct 01 18:10:40 2008 +0000 @@ -283,19 +283,16 @@ 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 in the build log -file that is saved within the toolchain. crosstool-NG can extract those options -to recreate a new configuration: - ct-ng extractconfig .config +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 -will extract those options, prompt you for the new ones, which you can later -edit with menuconfig. +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 -Of course, if your build log was compressed, you'd have to use something like: - bzcat /path/to/your/build.log.bz2 |ct-ng extractconfig >.config - -Then, once the configuration has been extracted, run: - ct-ng oldconfig +Then, you can review and change the configuration by running: + ct-ng menuconfig ________________________ / diff -r c4f2c434448c -r c444ce4b51b9 kconfig/kconfig.mk --- a/kconfig/kconfig.mk Tue Sep 30 18:19:48 2008 +0000 +++ b/kconfig/kconfig.mk Wed Oct 01 18:10:40 2008 +0000 @@ -7,7 +7,7 @@ KCONFIG_TOP = config/config.in obj = $(CT_TOP_DIR)/kconfig -PHONY += clean help oldconfig menuconfig config defoldconfig extractconfig +PHONY += clean help oldconfig menuconfig config defoldconfig # Darwin (MacOS-X) does not have proper libintl support ifeq ($(shell uname -s),Darwin) @@ -114,7 +114,7 @@ echo "endmenu"; \ ) >$@ -config menuconfig oldconfig defoldconfig extractconfig: $(KCONFIG_TOP) +config menuconfig oldconfig defoldconfig: $(KCONFIG_TOP) $(KCONFIG_TOP): @ln -sf $(CT_LIB_DIR)/config config @@ -131,16 +131,11 @@ defoldconfig: $(CONFIG_FILES) $(obj)/conf @yes "" |$(obj)/conf -s $(KCONFIG_TOP) -extractconfig: $(CONFIG_FILES) $(obj)/conf - @$(CT_LIB_DIR)/tools/extract-config.sh >.config - @$(obj)/conf -s $(KCONFIG_TOP) - # Help text used by make help help-config:: @echo ' config - Update current config using a line-oriented program' @echo ' menuconfig - Update current config using a menu based program' @echo ' oldconfig - Update current config using a provided .config as base' - @echo ' extractconfig - Create a new config using options extracted from a' @echo ' build log piped into stdin' # Cheesy build diff -r c4f2c434448c -r c444ce4b51b9 scripts/crosstool.sh --- a/scripts/crosstool.sh Tue Sep 30 18:19:48 2008 +0000 +++ b/scripts/crosstool.sh Wed Oct 01 18:10:40 2008 +0000 @@ -36,7 +36,7 @@ # renice oursleves CT_DoExecLog DEBUG renice ${CT_NICE} $$ -CT_DoStep DEBUG "Dumping crosstool-NG configuration" +CT_DoStep DEBUG "Dumping user-supplied crosstool-NG configuration" cat "${CT_TOP_DIR}/.config" |egrep '^(# |)CT_' |CT_DoLog DEBUG CT_EndStep @@ -341,6 +341,10 @@ [ ${CT_LOAD} -ne 0 ] && PARALLELMFLAGS="${PARALLELMFLAGS} -l${CT_LOAD}" export PARALLELMFLAGS + CT_DoLog EXTRA "Installing user-supplied crosstool-NG configuration" + CT_DoExecLog DEBUG install -m 0755 "${CT_LIB_DIR}/tools/toolchain-config.in" "${CT_PREFIX_DIR}/bin/${CT_TARGET}.ct-ng.config" + bzip2 -c -9 .config >>"${CT_PREFIX_DIR}/bin/${CT_TARGET}.ct-ng.config" + CT_DoStep EXTRA "Dumping internal crosstool-NG configuration" CT_DoLog EXTRA "Building a toolchain for:" CT_DoLog EXTRA " build = ${CT_BUILD}" diff -r c4f2c434448c -r c444ce4b51b9 tools/toolchain-config.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/toolchain-config.in Wed Oct 01 18:10:40 2008 +0000 @@ -0,0 +1,8 @@ +#!/bin/sh + +SKIP_ME="### CT_NG SKIP ME ###" +skip_me=$(($(cat "${0}" |grep --binary-files=text -o -b -E "^${SKIP_ME}$" |cut -d : -f 1)+${#SKIP_ME}+1)) +dd if="${0}" bs=${skip_me} skip=1 2>/dev/null |bzcat +exit 0 + +### CT_NG SKIP ME ###