From 16c6cc994fe1325535caa16dab5590c5a4cf2246 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Wed, 1 Oct 2008 18:10:40 +0000 Subject: 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 --git a/ct-ng.comp b/ct-ng.comp index 0d959e9..365007f 100644 --- a/ct-ng.comp +++ b/ct-ng.comp @@ -13,7 +13,7 @@ _ct-ng () { 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 --git a/docs/overview.txt b/docs/overview.txt index cd704aa..5e06afa 100644 --- a/docs/overview.txt +++ b/docs/overview.txt @@ -283,19 +283,16 @@ Re-building an existing toolchain | 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 --git a/kconfig/kconfig.mk b/kconfig/kconfig.mk index 4aae796..be8f61d 100644 --- a/kconfig/kconfig.mk +++ b/kconfig/kconfig.mk @@ -7,7 +7,7 @@ export PROJECTVERSION=$(CT_VERSION) 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 @@ $(CT_TOP_DIR)/config.gen/tools.in: $(TOOLS_CONFIG_FILES) 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 @@ oldconfig: $(CONFIG_FILES) $(obj)/conf 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 --git a/scripts/crosstool.sh b/scripts/crosstool.sh index 35aa247..ad2c104 100755 --- a/scripts/crosstool.sh +++ b/scripts/crosstool.sh @@ -36,7 +36,7 @@ CT_DoLog INFO "Build started ${CT_STAR_DATE_HUMAN}" # 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 @@ if [ -z "${CT_RESTART}" ]; then [ ${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 --git a/tools/toolchain-config.in b/tools/toolchain-config.in new file mode 100644 index 0000000..d8a4df3 --- /dev/null +++ b/tools/toolchain-config.in @@ -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 ### -- cgit v0.10.2-6-g49f6