# HG changeset patch # User Rob Landley # Date 1252806961 18000 # Node ID da1ebb2e22d30de3dba36d3fbd1f6e290b0e2edd # Parent 87ebc3d2a0674b2e6753dcc46bba0daad9b03d93 Part one of the great refactoring, breaking out the uClibc build so it isn't repeated in two places. diff -r 87ebc3d2a067 -r da1ebb2e22d3 cross-compiler.sh --- a/cross-compiler.sh Thu Sep 10 22:20:58 2009 -0500 +++ b/cross-compiler.sh Sat Sep 12 20:56:01 2009 -0500 @@ -89,29 +89,9 @@ mv "$WORK"/gcc-core "$WORK"/gcc PACKAGE=gcc cleanup build-gcc "${STAGE_DIR}"/{lib/gcc,{libexec/gcc,gcc/lib}/install-tools} -# Install kernel headers. - -setupfor linux && -# Install Linux kernel headers (for use by uClibc). -make -j $CPUS headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="${STAGE_DIR}" && -# This makes some very old package builds happy. -ln -s ../sys/user.h "${STAGE_DIR}/include/asm/page.h" - -cleanup - -# Build and install uClibc +# Build uClibc -setupfor uClibc -make KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig && -make KERNEL_HEADERS="${STAGE_DIR}/include" PREFIX="${STAGE_DIR}/" \ - CROSS="${ARCH}-" RUNTIME_PREFIX=/ DEVEL_PREFIX=/ -j $CPUS $VERBOSITY \ - install hostutils || dienow -for i in $(cd utils; ls *.host | sed 's/\.host//') -do - cp utils/"$i".host "$STAGE_DIR/bin/$ARCH-$i" || dienow -done - -cleanup +HOST_UTILS=1 . "$SOURCES"/sections/uClibc.sh cat > "${STAGE_DIR}"/README << EOF && Cross compiler for $ARCH diff -r 87ebc3d2a067 -r da1ebb2e22d3 root-filesystem.sh --- a/root-filesystem.sh Thu Sep 10 22:20:58 2009 -0500 +++ b/root-filesystem.sh Sat Sep 12 20:56:01 2009 -0500 @@ -47,44 +47,9 @@ mkdir -p "$STAGE_DIR/bin" || dienow fi -# Install Linux kernel headers. - -setupfor linux -# Install Linux kernel headers (for use by uClibc). -make headers_install -j "$CPUS" ARCH="${KARCH}" INSTALL_HDR_PATH="$ROOT_TOPDIR" && -# This makes some very old package builds happy. -ln -s ../sys/user.h "$ROOT_TOPDIR/include/asm/page.h" - -cleanup - -# Build and install uClibc. (We could just copy the one from the compiler -# toolchain, but this is cleaner.) - -setupfor uClibc -make CROSS="${ARCH}-" KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig && -cp .config "${WORK}"/config-uClibc || dienow +# Build uClibc -# Alas, if we feed install and install_utils to make at the same time with -# -j > 1, it dies. Not SMP safe. -for i in install install_utils -do - make CROSS="${ARCH}-" KERNEL_HEADERS="$ROOT_TOPDIR/include" \ - PREFIX="$ROOT_TOPDIR/" $VERBOSITY \ - RUNTIME_PREFIX="/" DEVEL_PREFIX="/" \ - UCLIBC_LDSO_NAME=ld-uClibc -j $CPUS $i || dienow -done - -# There's no way to specify a prefix for the uClibc utils; rename them by hand. - -if [ ! -z "$PROGRAM_PREFIX" ] -then - for i in ldd readelf - do - mv "$ROOT_TOPDIR"/bin/{"$i","${PROGRAM_PREFIX}$i"} || dienow - done -fi - -cleanup +STAGE_DIR="$ROOT_TOPDIR" . "$SOURCES"/sections/uClibc.sh if [ "$NATIVE_TOOLCHAIN" == "none" ] then diff -r 87ebc3d2a067 -r da1ebb2e22d3 sources/sections/uClibc.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sources/sections/uClibc.sh Sat Sep 12 20:56:01 2009 -0500 @@ -0,0 +1,52 @@ +# Install Linux kernel headers. + +setupfor linux + +# Install Linux kernel headers (for use by uClibc). +make -j $CPUS headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="$STAGE_DIR" && +# This makes some very old package builds happy. +ln -s ../sys/user.h "$STAGE_DIR/include/asm/page.h" + +# Build and install uClibc + +make_uClibc() +{ + make -j $CPUS $VERBOSITY CROSS="${ARCH}-" \ + UCLIBC_LDSO_NAME=ld-uClibc KERNEL_HEADERS="$STAGE_DIR/include" \ + PREFIX="$STAGE_DIR/" RUNTIME_PREFIX=/ DEVEL_PREFIX=/ $1 || dienow +} + +cleanup + +setupfor uClibc + +make KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig && +cp .config "$WORK/config-uClibc" || dienow + +make_uClibc install + +# Do we need host or target versions of readelf, ldd, and ldconfig? + +if [ ! -z "$HOST_UTILS" ] +then + make_uClibc hostutils + + for i in $(cd utils; ls *.host | sed 's/\.host//') + do + cp utils/"$i".host "$STAGE_DIR/bin/$ARCH-$i" || dienow + done +else + make_uClibc install_utils + + # There's no way to specify a prefix for the uClibc utils; rename by hand. + + if [ ! -z "$PROGRAM_PREFIX" ] + then + for i in ldd readelf ldconfig + do + mv "$STAGE_DIR/bin/"{"$i","${PROGRAM_PREFIX}$i"} || dienow + done + fi +fi + +cleanup