From 62744e84e72e021ad266af1a005f02322ab5ab90 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Fri, 27 Jun 2008 13:58:53 +0000 Subject: 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 --git a/arch/alpha/config.in b/arch/alpha/config.in index 3a7329d..3cd07c5 100644 --- a/arch/alpha/config.in +++ b/arch/alpha/config.in @@ -1,6 +1,6 @@ # Alpha specific configuration file -comment "Alpha specific configuration" +config ARCH_alpha choice bool diff --git a/arch/alpha/experimental b/arch/alpha/experimental new file mode 100644 index 0000000..e69de29 diff --git a/arch/arm/config.in b/arch/arm/config.in index 093e42b..a358405 100644 --- a/arch/arm/config.in +++ b/arch/arm/config.in @@ -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 --git a/arch/ia64/config.in b/arch/ia64/config.in index e69de29..e8694c0 100644 --- a/arch/ia64/config.in +++ b/arch/ia64/config.in @@ -0,0 +1,4 @@ +# ia64 specific config options + +config ARCH_ia64 + select ARCH_SUPPORTS_BOTH_ENDIAN diff --git a/arch/ia64/experimental b/arch/ia64/experimental new file mode 100644 index 0000000..e69de29 diff --git a/arch/mips/config.in b/arch/mips/config.in index e69de29..abd911a 100644 --- a/arch/mips/config.in +++ b/arch/mips/config.in @@ -0,0 +1,5 @@ +# MIPS specific config options + +config ARCH_mips + select ARCH_SUPPORTS_BOTH_ENDIAN + select ARCH_DEFAULT_BE diff --git a/arch/powerpc/config.in b/arch/powerpc/config.in index 5cfe4ce..9c9c59e 100644 --- a/arch/powerpc/config.in +++ b/arch/powerpc/config.in @@ -1 +1,3 @@ # powerpc specific configuration file + +config ARCH_powerpc diff --git a/arch/powerpc/experimental b/arch/powerpc/experimental new file mode 100644 index 0000000..e69de29 diff --git a/arch/sh/config.in b/arch/sh/config.in index 70a2966..0b476c6 100644 --- a/arch/sh/config.in +++ b/arch/sh/config.in @@ -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 --git a/arch/sh/experimental b/arch/sh/experimental new file mode 100644 index 0000000..e69de29 diff --git a/arch/x86/config.in b/arch/x86/config.in index e69de29..56d829b 100644 --- a/arch/x86/config.in +++ b/arch/x86/config.in @@ -0,0 +1,3 @@ +# x86 specific options + +config ARCH_x86 diff --git a/arch/x86_64/config.in b/arch/x86_64/config.in index e69de29..48be3f8 100644 --- a/arch/x86_64/config.in +++ b/arch/x86_64/config.in @@ -0,0 +1,3 @@ +# x86_64 specific options + +config ARCH_x86_64 diff --git a/config/target.in b/config/target.in index d26bfe0..2060da5 100644 --- a/config/target.in +++ b/config/target.in @@ -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 - -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" +# 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 -config ARCH_SH - bool - prompt "sh (EXPERIMENTAL)" - depends on EXPERIMENTAL - select ARCH_SUPPORTS_BOTH_ENDIAN - select ARCH_DEFAULT_LE +comment "General target options" -config ARCH_x86 +choice bool - prompt "x86" + prompt "Target architecture:" -config ARCH_x86_64 - bool - prompt "x86_64" +source config.gen/arch.in endchoice @@ -93,32 +57,6 @@ config ARCH_LE 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 --git a/docs/overview.txt b/docs/overview.txt index 8cc507e..0e8abc2 100644 --- a/docs/overview.txt +++ b/docs/overview.txt @@ -3,6 +3,34 @@ Content......: Overview of how crosstool-NG works. 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 @@ patches. 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 @@ The "functions" file API: - 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 --git a/kconfig/kconfig.mk b/kconfig/kconfig.mk index fe234a5..3275663 100644 --- a/kconfig/kconfig.mk +++ b/kconfig/kconfig.mk @@ -19,11 +19,14 @@ CFLAGS += -DKBUILD_NO_NLS 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 @@ $(GEN_CONFIG_FILES):: $(CT_TOP_DIR)/config.gen $(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!!!" >>$@ -- cgit v0.10.2-6-g49f6