summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/binutils.in7
-rw-r--r--config/binutils/binutils.in.2 (renamed from config/binutils/elf2flt.in)0
-rw-r--r--config/config.mk8
-rw-r--r--scripts/build/binutils/binutils.sh92
-rw-r--r--scripts/build/binutils/elf2flt.sh149
-rw-r--r--scripts/crosstool-NG.sh.in5
-rw-r--r--steps.mk2
7 files changed, 105 insertions, 158 deletions
diff --git a/config/binutils.in b/config/binutils.in
index 869d819..99b8b9f 100644
--- a/config/binutils.in
+++ b/config/binutils.in
@@ -33,7 +33,10 @@ config ARCH_BINFMT_FDPIC
endchoice
-source "config/binutils/binutils.in"
-source "config/binutils/elf2flt.in"
+config BINUTILS
+ string
+
+source "config.gen/binutils.in"
+source "config.gen/binutils.in.2"
endmenu
diff --git a/config/binutils/elf2flt.in b/config/binutils/binutils.in.2
index 0e74886..0e74886 100644
--- a/config/binutils/elf2flt.in
+++ b/config/binutils/binutils.in.2
diff --git a/config/config.mk b/config/config.mk
index dc1e56c..4f204f8 100644
--- a/config/config.mk
+++ b/config/config.mk
@@ -21,6 +21,8 @@ KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/co
KERNEL_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2))
CC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
CC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in.2))
+BINUTILS_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/binutils/*.in))
+BINUTILS_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/binutils/*.in.2))
LIBC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
LIBC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in.2))
DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
@@ -29,6 +31,7 @@ DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/co
GEN_CONFIG_FILES = config.gen/arch.in \
config.gen/kernel.in \
config.gen/cc.in \
+ config.gen/binutils.in \
config.gen/libc.in \
config.gen/debug.in
# ... and how to access them:
@@ -61,6 +64,7 @@ config.gen:
ARCHS = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES))
KERNELS = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES))
CCS = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES))
+BINUTILSS = $(patsubst config/binutils/%.in,%,$(BINUTILS_CONFIG_FILES))
LIBCS = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES))
DEBUGS = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES))
@@ -81,6 +85,10 @@ config.gen/cc.in: $(CC_CONFIG_FILES) $(CC_CONFIG_FILES_2)
@$(ECHO) ' IN $(@)'
$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C compiler" "CC" "config/cc" "N" $(CCS)
+config.gen/binutils.in: $(CC_BINUTILS_FILES) $(CC_BINUTILS_FILES_2)
+ @$(ECHO) ' IN $(@)'
+ $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Binutils" "BINUTILS" "config/binutils" "N" $(BINUTILSS)
+
config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2)
@$(ECHO) ' IN $(@)'
$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C library" "LIBC" "config/libc" "Y" $(LIBCS)
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index 38bea69..d973594 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -12,6 +12,14 @@ do_binutils_get() {
{ftp,http}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils \
ftp://gcc.gnu.org/pub/binutils/{releases,snapshots}
fi
+
+ if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
+ CT_GetCVS "elf2flt-${CT_ELF2FLT_VERSION}" \
+ ":pserver:anonymous@cvs.uclinux.org:/var/cvs" \
+ "elf2flt" \
+ "" \
+ "elf2flt-${CT_ELF2FLT_VERSION}"
+ fi
}
# Extract binutils
@@ -24,6 +32,11 @@ do_binutils_extract() {
CT_Extract "binutils-${CT_BINUTILS_VERSION}"
CT_Patch "binutils" "${CT_BINUTILS_VERSION}"
+
+ if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
+ CT_Extract "elf2flt-${CT_ELF2FLT_VERSION}"
+ CT_Patch "elf2flt" "${CT_ELF2FLT_VERSION}"
+ fi
}
# Build binutils for build -> target
@@ -45,6 +58,19 @@ do_binutils_for_build() {
do_binutils_backend "${binutils_opts[@]}"
CT_Popd
+
+ if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
+ # We re-use binutils' options, plus our owns
+ binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" )
+ binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_BUILD}" )
+
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}"
+
+ do_elf2flt_backend "${binutils_opts[@]}"
+
+ CT_Popd
+ fi
+
CT_EndStep
}
@@ -65,6 +91,20 @@ do_binutils_for_host() {
do_binutils_backend "${binutils_opts[@]}"
+ CT_Popd
+
+ if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
+ # We re-use binutils' options, plus our owns
+ binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" )
+ binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" )
+
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}"
+
+ do_elf2flt_backend "${binutils_opts[@]}"
+
+ CT_Popd
+ fi
+
# Make those new tools available to the core C compilers to come.
# Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as
# well. Create that.
@@ -73,6 +113,9 @@ do_binutils_for_host() {
case "${CT_TOOLCHAIN_TYPE}" in
cross|native)
binutils_tools=( ar as ld strip )
+ if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
+ binutils_tools+=( elf2flt flthdr )
+ fi
case "${CT_BINUTILS_LINKERS_LIST}" in
ld) binutils_tools+=( ld.bfd ) ;;
gold) binutils_tools+=( ld.gold ) ;;
@@ -93,7 +136,6 @@ do_binutils_for_host() {
*) ;;
esac
- CT_Popd
CT_EndStep
}
@@ -218,6 +260,54 @@ do_binutils_backend() {
fi
}
+# Build elf2flt for X -> target
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# static_build : build statcially : bool : no
+# cflags : cflags to use : string : (empty)
+# ldflags : ldflags to use : string : (empty)
+# binutils_src : source dir of binutils : dir : (none)
+# binutils_bld : build dir of binutils : dir : (none)
+# build_manuals : whether to build manuals : bool : no
+do_elf2flt_backend() {
+ local host
+ local prefix
+ local static_build
+ local cflags
+ local ldflags
+ local binutils_bld
+ local binutils_src
+ local build_manuals
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ CT_DoLog EXTRA "Configuring elf2flt"
+ CT_DoExecLog CFG \
+ CFLAGS="${cflags}" \
+ LDFLAGS="${ldflags}" \
+ "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure" \
+ --build=${CT_BUILD} \
+ --host=${host} \
+ --target=${CT_TARGET} \
+ --prefix=${prefix} \
+ --with-bfd-include-dir=${binutils_bld}/bfd \
+ --with-binutils-include-dir=${binutils_src}/include \
+ --with-libbfd=${binutils_bld}/bfd/libbfd.a \
+ --with-libiberty=${binutils_bld}/libiberty/libiberty.a \
+ ${elf2flt_opts} \
+ "${CT_ELF2FLT_EXTRA_CONFIG_ARRAY[@]}"
+
+ CT_DoLog EXTRA "Building elf2flt"
+ CT_DoExecLog ALL make ${JOBSFLAGS}
+
+ CT_DoLog EXTRA "Installing elf2flt"
+ CT_DoExecLog ALL make install
+}
+
# Now on for the target libraries
do_binutils_for_target() {
local -a extra_config
diff --git a/scripts/build/binutils/elf2flt.sh b/scripts/build/binutils/elf2flt.sh
deleted file mode 100644
index f0dd690..0000000
--- a/scripts/build/binutils/elf2flt.sh
+++ /dev/null
@@ -1,149 +0,0 @@
-# This file adds functions to build elf2flt
-# Copyright 2009 John Williams
-# Copyright 2007 Yann E. MORIN
-# Licensed under the GPL v2. See COPYING in the root of this package
-
-# Default: do nothing
-do_elf2flt_get() { :; }
-do_elf2flt_extract() { :; }
-do_elf2flt_for_build() { :; }
-do_elf2flt_for_host() { :; }
-
-if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
-
-# Download elf2flt
-do_elf2flt_get() {
- if [ "${CT_ELF2FLT_CUSTOM}" = "y" ]; then
- CT_GetCustom "elf2flt" "${ELF2FLT_VERSION}" \
- "${CT_ELF2FLT_CUSTOM_LOCATION}"
- else
- CT_GetCVS "elf2flt-${CT_ELF2FLT_VERSION}" \
- ":pserver:anonymous@cvs.uclinux.org:/var/cvs" \
- "elf2flt" \
- "" \
- "elf2flt-${CT_ELF2FLT_VERSION}"
- fi
-}
-
-# Extract elf2flt
-do_elf2flt_extract() {
- # If using custom directory location, nothing to do
- if [ "${CT_ELF2FLT_CUSTOM}" = "y" \
- -a -d "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}" ]; then
- return 0
- fi
- CT_Extract "elf2flt-${CT_ELF2FLT_VERSION}"
- CT_Patch "elf2flt" "${CT_ELF2FLT_VERSION}"
-}
-
-# Build elf2flt for build -> target
-do_elf2flt_for_build() {
- local -a elf2flt_opts
-
- case "${CT_TOOLCHAIN_TYPE}" in
- native|cross) return 0;;
- esac
-
- CT_DoStep INFO "Installing elf2flt for build"
- CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}"
-
- elf2flt_opts+=( "host=${CT_BUILD}" )
- elf2flt_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
- elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
- elf2flt_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
- elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_HOST}" )
-
- do_elf2flt_backend "${elf2flt_opts[@]}"
-
- CT_Popd
- CT_EndStep
-}
-
-# Build elf2flt for host -> target
-do_elf2flt_for_host() {
- local -a elf2flt_opts
-
- CT_DoStep INFO "Installing elf2flt for host"
- CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}"
-
- elf2flt_opts+=( "host=${CT_HOST}" )
- elf2flt_opts+=( "prefix=${CT_PREFIX_DIR}" )
- elf2flt_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
- elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
- elf2flt_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
- elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" )
-
- do_elf2flt_backend "${elf2flt_opts[@]}"
-
- # Make those new tools available to the core C compilers to come.
- # Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as
- # well. Create that.
- # Don't do it for canadian or cross-native, because the binutils
- # are not executable on the build machine.
- case "${CT_TOOLCHAIN_TYPE}" in
- cross|native)
- mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin"
- mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
- for t in elf2flt flthdr; do
- CT_DoExecLog ALL ln -sv \
- "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" \
- "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
- CT_DoExecLog ALL ln -sv \
- "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" \
- "${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
- done
- ;;
- *) ;;
- esac
-
- CT_Popd
- CT_EndStep
-}
-
-# Build elf2flt for X -> target
-# Parameter : description : type : default
-# host : machine to run on : tuple : (none)
-# prefix : prefix to install into : dir : (none)
-# static_build : build statcially : bool : no
-# cflags : cflags to use : string : (empty)
-# ldflags : ldflags to use : string : (empty)
-do_elf2flt_backend() {
- local host
- local prefix
- local static_build
- local cflags
- local ldflags
- local binutils_bld
- local binutils_src
- local arg
-
- for arg in "$@"; do
- eval "${arg// /\\ }"
- done
-
- binutils_src="${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}"
-
- CT_DoLog EXTRA "Configuring elf2flt"
- CT_DoExecLog CFG \
- CFLAGS="${cflags}" \
- LDFLAGS="${ldflags}" \
- "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure" \
- --build=${CT_BUILD} \
- --host=${host} \
- --target=${CT_TARGET} \
- --prefix=${prefix} \
- --with-bfd-include-dir=${binutils_bld}/bfd \
- --with-binutils-include-dir=${binutils_src}/include \
- --with-libbfd=${binutils_bld}/bfd/libbfd.a \
- --with-libiberty=${binutils_bld}/libiberty/libiberty.a \
- ${elf2flt_opts} \
- "${CT_ELF2FLT_EXTRA_CONFIG_ARRAY[@]}"
-
- CT_DoLog EXTRA "Building elf2flt"
- CT_DoExecLog ALL make ${JOBSFLAGS}
-
- CT_DoLog EXTRA "Installing elf2flt"
- CT_DoExecLog ALL make install
-}
-
-fi # CT_ARCH_BINFMT_FLAT
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index 782a407..4b2e14f 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -127,8 +127,7 @@ CT_DoLog INFO "Building environment variables"
. "${CT_LIB_DIR}/scripts/build/companion_tools.sh"
. "${CT_LIB_DIR}/scripts/build/kernel/${CT_KERNEL}.sh"
. "${CT_LIB_DIR}/scripts/build/companion_libs.sh"
-. "${CT_LIB_DIR}/scripts/build/binutils/binutils.sh"
-. "${CT_LIB_DIR}/scripts/build/binutils/elf2flt.sh"
+. "${CT_LIB_DIR}/scripts/build/binutils/${CT_BINUTILS}.sh"
. "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh"
. "${CT_LIB_DIR}/scripts/build/cc/${CT_CC}.sh"
. "${CT_LIB_DIR}/scripts/build/debug.sh"
@@ -545,7 +544,6 @@ if [ -z "${CT_RESTART}" ]; then
do_kernel_get
do_companion_libs_get
do_binutils_get
- do_elf2flt_get
do_cc_get
do_libc_get
do_debug_get
@@ -569,7 +567,6 @@ if [ -z "${CT_RESTART}" ]; then
do_kernel_extract
do_companion_libs_extract
do_binutils_extract
- do_elf2flt_extract
do_cc_extract
do_libc_extract
do_debug_extract
diff --git a/steps.mk b/steps.mk
index 47c94a2..dcc39a2 100644
--- a/steps.mk
+++ b/steps.mk
@@ -21,10 +21,8 @@ help-env::
CT_STEPS := libc_check_config \
companion_libs_for_build \
binutils_for_build \
- elf2flt_for_build \
companion_libs_for_host \
binutils_for_host \
- elf2flt_for_host \
cc_core_pass_1 \
kernel_headers \
libc_start_files \