# HG changeset patch # User "Yann E. MORIN" # Date 1214575133 0 # Node ID 87802cb25a0fc8c52c72dc31b9dd2f9690a4f863 # Parent 17a57be570a5fc1726aff43661cfac8235ba5a80 Autogenerate the architecture selection choice menu. Update architectures definition files accordingly. Update documentation accordingly. Use makefile syntax when listing arch/, tools/ and debug/ config files. /trunk/kconfig/kconfig.mk | 32 29 3 0 +++++++++++++++-- /trunk/docs/overview.txt | 75 67 8 0 +++++++++++++++++++++++++++++++++++---- /trunk/config/target.in | 94 16 78 0 ++++++++----------------------------------------- /trunk/arch/arm/config.in | 6 5 1 0 +++ /trunk/arch/powerpc/config.in | 2 2 0 0 + /trunk/arch/ia64/config.in | 4 4 0 0 ++ /trunk/arch/alpha/config.in | 2 1 1 0 /trunk/arch/x86/config.in | 3 3 0 0 ++ /trunk/arch/mips/config.in | 5 5 0 0 +++ /trunk/arch/sh/config.in | 4 3 1 0 ++ /trunk/arch/x86_64/config.in | 3 3 0 0 ++ 11 files changed, 138 insertions(+), 92 deletions(-) diff -r 17a57be570a5 -r 87802cb25a0f arch/alpha/config.in --- a/arch/alpha/config.in Fri Jun 27 11:19:12 2008 +0000 +++ b/arch/alpha/config.in Fri Jun 27 13:58:53 2008 +0000 @@ -1,6 +1,6 @@ # Alpha specific configuration file -comment "Alpha specific configuration" +config ARCH_alpha choice bool diff -r 17a57be570a5 -r 87802cb25a0f arch/arm/config.in --- a/arch/arm/config.in Fri Jun 27 11:19:12 2008 +0000 +++ b/arch/arm/config.in Fri Jun 27 13:58:53 2008 +0000 @@ -1,4 +1,8 @@ -comment "ARM specific options" +# ARM specific configuration file + +config ARCH_arm + select ARCH_SUPPORTS_BOTH_ENDIAN + select ARCH_DEFAULT_LE config ARCH_ARM_EABI bool diff -r 17a57be570a5 -r 87802cb25a0f arch/ia64/config.in --- a/arch/ia64/config.in Fri Jun 27 11:19:12 2008 +0000 +++ b/arch/ia64/config.in Fri Jun 27 13:58:53 2008 +0000 @@ -0,0 +1,4 @@ +# ia64 specific config options + +config ARCH_ia64 + select ARCH_SUPPORTS_BOTH_ENDIAN diff -r 17a57be570a5 -r 87802cb25a0f arch/mips/config.in --- a/arch/mips/config.in Fri Jun 27 11:19:12 2008 +0000 +++ b/arch/mips/config.in Fri Jun 27 13:58:53 2008 +0000 @@ -0,0 +1,5 @@ +# MIPS specific config options + +config ARCH_mips + select ARCH_SUPPORTS_BOTH_ENDIAN + select ARCH_DEFAULT_BE diff -r 17a57be570a5 -r 87802cb25a0f arch/powerpc/config.in --- a/arch/powerpc/config.in Fri Jun 27 11:19:12 2008 +0000 +++ b/arch/powerpc/config.in Fri Jun 27 13:58:53 2008 +0000 @@ -1,1 +1,3 @@ # powerpc specific configuration file + +config ARCH_powerpc diff -r 17a57be570a5 -r 87802cb25a0f arch/sh/config.in --- a/arch/sh/config.in Fri Jun 27 11:19:12 2008 +0000 +++ b/arch/sh/config.in Fri Jun 27 13:58:53 2008 +0000 @@ -1,6 +1,8 @@ # Super-H specific configuration file -comment "Super-H specific configuration" +config ARCH_sh + select ARCH_SUPPORTS_BOTH_ENDIAN + select ARCH_DEFAULT_LE choice bool diff -r 17a57be570a5 -r 87802cb25a0f arch/x86/config.in --- a/arch/x86/config.in Fri Jun 27 11:19:12 2008 +0000 +++ b/arch/x86/config.in Fri Jun 27 13:58:53 2008 +0000 @@ -0,0 +1,3 @@ +# x86 specific options + +config ARCH_x86 diff -r 17a57be570a5 -r 87802cb25a0f arch/x86_64/config.in --- a/arch/x86_64/config.in Fri Jun 27 11:19:12 2008 +0000 +++ b/arch/x86_64/config.in Fri Jun 27 13:58:53 2008 +0000 @@ -0,0 +1,3 @@ +# x86_64 specific options + +config ARCH_x86_64 diff -r 17a57be570a5 -r 87802cb25a0f config/target.in --- a/config/target.in Fri Jun 27 11:19:12 2008 +0000 +++ b/config/target.in Fri Jun 27 13:58:53 2008 +0000 @@ -2,65 +2,29 @@ menu "Target options" -comment "General target options" - config ARCH string - default "alpha" if ARCH_ALPHA - default "arm" if ARCH_ARM - default "ia64" if ARCH_IA64 - default "mips" if ARCH_MIPS - default "powerpc" if ARCH_PPC - default "sh" if ARCH_SH - default "x86" if ARCH_x86 - default "x86_64" if ARCH_x86_64 + +# Pre-declare target optimisation variables +config ARCH_ARCH +config ARCH_ABI +config ARCH_CPU +config ARCH_TUNE +config ARCH_FPU +config ARCH_SUPPORTS_BOTH_ENDIAN +config ARCH_DEFAULT_BE +config ARCH_DEFAULT_LE +config ARCH_FLOAT_HW +config ARCH_FLOAT_SW +config TARGET_CFLAGS + +comment "General target options" choice bool prompt "Target architecture:" - default ARCH_x86 -config ARCH_ALPHA - bool - prompt "alpha (EXPERIMENTAL)" - depends on EXPERIMENTAL - -config ARCH_ARM - bool - prompt "arm" - select ARCH_SUPPORTS_BOTH_ENDIAN - select ARCH_DEFAULT_LE - -config ARCH_IA64 - bool - prompt "ia64 (EXPERIMENTAL)" - depends on EXPERIMENTAL - select ARCH_SUPPORTS_BOTH_ENDIAN - -config ARCH_MIPS - bool - prompt "mips" - select ARCH_SUPPORTS_BOTH_ENDIAN - select ARCH_DEFAULT_BE - -config ARCH_PPC - bool - prompt "powerpc" - -config ARCH_SH - bool - prompt "sh (EXPERIMENTAL)" - depends on EXPERIMENTAL - select ARCH_SUPPORTS_BOTH_ENDIAN - select ARCH_DEFAULT_LE - -config ARCH_x86 - bool - prompt "x86" - -config ARCH_x86_64 - bool - prompt "x86_64" +source config.gen/arch.in endchoice @@ -93,32 +57,6 @@ endchoice -# Include architecture-specific configuration -if ARCH_ALPHA -source config/arch/alpha/config.in -endif -if ARCH_ARM -source config/arch/arm/config.in -endif -if ARCH_IA64 -source config/arch/ia64/config.in -endif -if ARCH_MIPS -source config/arch/mips/config.in -endif -if ARCH_PPC -source config/arch/powerpc/config.in -endif -if ARCH_SH -source config/arch/sh/config.in -endif -if ARCH_x86 -source config/arch/x86/config.in -endif -if ARCH_x86_64 -source config/arch/x86_64/config.in -endif - comment "Target optimisations" config ARCH_ARCH diff -r 17a57be570a5 -r 87802cb25a0f docs/overview.txt --- a/docs/overview.txt Fri Jun 27 11:19:12 2008 +0000 +++ b/docs/overview.txt Fri Jun 27 13:58:53 2008 +0000 @@ -3,6 +3,34 @@ Copyrigth....: (C) 2007 Yann E. MORIN License......: Creative Commons Attribution Share Alike (CC-by-sa), v2.5 +____________________ + / +Table Of Content / +_________________/ + + +Introduction +History +Installing crosstool-NG + Install method + The hacker's way + Contributed code +Configuring crosstool-NG + Interesting config options + Re-building an existing toolchain +Running crosstool-NG + Stopping and restarting a build + Testing all toolchains at once + Overriding the number of // jobs +Using the toolchain +Toolchain types +Internals + Makefile front-end + Kconfig parser + Architecture-specific + Adding a new version of a component + Build scripts + ________________ / Introduction / @@ -492,19 +520,50 @@ Architecture-specific | ----------------------+ +Note: this chapter is not really well written, and might thus be a little bit +complex to understand. To get a better grasp of what an architecture is, the +reader is kindly encouraged to look at the "arch/" sub-directory, and to the +existing architectures to see how things are laid out. + An architecture is defined by: - a human-readable name, in lower case letters, with numbers as appropriate. - The underscore is allowed. Eg.: arm, x86_64 - - a boolean kconfig option named after the architecture (in capital letters - if possible) prefixed with "ARCH_". Eg.: ARCH_ARM, ARCH_x86_64 + The underscore is allowed; space and special characters are not. + Eg.: arm, x86_64 - a directory in "arch/" named after the architecture, with the same letters as above. Eg.: arch/arm, arch/x86_64 - This directory contains: - - a configuration file in kconfig syntax, named "config.in", which may be - empty. Eg.: arch/arm/config.in + This directory contains the following files, and only those files: + - a configuration file in kconfig syntax, named "config.in", which shall + follow the API defined below. + Eg.: arch/arm/config.in - a function script in bash-3.0 syntax, named "functions", which shall - follow the API defined below. Eg.: arch/arm/functions + follow the API defined below. + Eg.: arch/arm/functions + - an optional file, named "experimental" (in lower case!), which, if it + is present, means that support for this architecture is EXPERIMENTAL. + Eg.: arch/arm/experimental + +The "config.in" file API: + > the config option "ARCH_%arch%" (where %arch% is to be replaced with the + actual architecture name). + That config option must have *neither* a type, *nor* a prompt! Also, it can + *not* depend on any other config option (EXPERIMENTAL is managed as above). + Eg.: + config ARCH_arm + + optional: + selects adequate associated config options. + Eg.: + config ARCH_arm + select ARCH_SUPPORTS_BOTH_ENDIAN + select ARCH_DEFAULT_LE + + > other target-specific options, at your discretion. Note however that to + avoid name-clashing, such options shall be prefixed with "ARCH_%arch%", + where %arch% is again replaced by the actual architecture name. + (Note: due to historical reasons, and lack of time to clean up the code, + I may have left some config options that do not completely conform to + this, as the architecture name was written all upper case. However, the + prefix is unique among architectures, and does not cause harm). The "functions" file API: > the function "CT_DoArchValues" @@ -578,7 +637,7 @@ - CT_ARCH_ENDIAN_CFLAG : the gcc switch to choose big or little endian ( "-mbig-endian" or "-mlittle-endian" ) - default to: see above. - + Adding a new version of a component | ------------------------------------+ diff -r 17a57be570a5 -r 87802cb25a0f kconfig/kconfig.mk --- a/kconfig/kconfig.mk Fri Jun 27 11:19:12 2008 +0000 +++ b/kconfig/kconfig.mk Fri Jun 27 13:58:53 2008 +0000 @@ -19,11 +19,14 @@ endif # Build a list of all config files -DEBUG_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/debug -type f -name '*.in') -TOOLS_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config/tools -type f -name '*.in') +ARCHS = $(patsubst $(CT_LIB_DIR)/arch/%,%,$(wildcard $(CT_LIB_DIR)/arch/*)) +ARCH_CONFIG_FILE = $(wildcard $(CT_LIB_DIR)/arch/*/*.in) +DEBUG_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/debug/*.in) +TOOLS_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/tools/*.in) STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in') -GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/debug.in \ +GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/arch.in \ + $(CT_TOP_DIR)/config.gen/debug.in \ $(CT_TOP_DIR)/config.gen/tools.in CONFIG_FILES=$(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES) @@ -33,6 +36,29 @@ $(CT_TOP_DIR)/config.gen: @mkdir -p $(CT_TOP_DIR)/config.gen +$(CT_TOP_DIR)/config.gen/arch.in:: $(ARCH_CONFIG_FILES) + @(echo "# Architectures menu"; \ + echo "# Generated file, do not edit!!!"; \ + echo ""; \ + for arch in $(ARCHS); do \ + echo "config ARCH_$${arch}"; \ + echo " bool"; \ + echo -n " prompt \"$${arch}"; \ + if [ -f $(CT_LIB_DIR)/arch/$${arch}/experimental ]; then \ + echo " (EXPERIMENTAL)\""; \ + echo " depends on EXPERIMENTAL"; \ + else \ + echo "\""; \ + fi; \ + echo "if ARCH_$${arch}"; \ + echo "config ARCH"; \ + echo " default \"$${arch}\" if ARCH_$${arch}"; \ + echo "source config/arch/$${arch}/config.in"; \ + echo "endif"; \ + echo ""; \ + done; \ + ) >$@ + $(CT_TOP_DIR)/config.gen/debug.in:: $(DEBUG_CONFIG_FILES) @echo "# Debug facilities menu" >$@ @echo "# Generated file, do not edit!!!" >>$@