Mercurial > hg > aboriginal
changeset 41:3baa8ab7ee6d
Largeish update.
cross-compiler.sh: Update uClibc to more current snapshot, patch to fix a bug
in that uClibc snapshot that screws up armv4l, shuffle the build so the name
change (to $ARCH-gcc) happens when installing the wrapper script, use
dotprogress for creating cross-compiler-$ARCH tarball. Tweak uClibc
config so I can build defconfig busybox against it (needs RPC support for mount
NFS and inetd).
download.sh: update uClibc, teach it to download things without an sha1sum
(like daily snapshots), and to delete obsolete packages after download.
include.sh: fallout from above.
Tweak to the readme from George Boudreau, and more comments in general.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 16 Dec 2006 20:20:00 -0500 |
parents | 21e058fa3676 |
children | 7b0f34fbc35a |
files | cross-compiler.sh download.sh include.sh sources/configs/armv4l sources/patches/uClibc-fixarmv4l.patch |
diffstat | 5 files changed, 92 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/cross-compiler.sh Thu Dec 14 15:20:07 2006 -0500 +++ b/cross-compiler.sh Sat Dec 16 20:20:00 2006 -0500 @@ -4,6 +4,8 @@ source include.sh +mkdir -p "${CROSS}" || dienow + # Build and install binutils setupfor binutils build-binutils @@ -33,6 +35,8 @@ make install-gcc && cd .. && +echo Fixup toolchain... && + # Move the gcc internal libraries and headers somewhere sane. mkdir -p "${CROSS}"/gcc && @@ -40,25 +44,27 @@ mv "${CROSS}"/lib/gcc/*/* "${CROSS}"/gcc/lib && $CLEANUP "${CURSRC}" build-gcc "${CROSS}"/{lib/gcc,gcc/lib/install-tools} && +# Change the FSF's crazy names to something reasonable. + +cd "${CROSS}"/bin && +for i in "${CROSS_TARGET}"-* +do + strip "$i" && + mv "$i" "${ARCH}"-"$(echo "$i" | sed 's/.*-//')" +done && + # Build and install gcc wrapper script. -GCCNAME="$(echo "${CROSS}"/bin/*-gcc)" && -mv "$GCCNAME" "${CROSS}"/bin/gcc-unwrapped && -gcc "${TOP}"/sources/toys/gcc-uClibc.c -Os -s -o "$GCCNAME" +mv "${ARCH}-gcc" gcc-unwrapped && +gcc "${TOP}"/sources/toys/gcc-uClibc.c -Os -s -o "${ARCH}-gcc" [ $? -ne 0 ] && dienow # Install the linux kernel, and kernel headers. setupfor linux -# Configure kernel -##mv "${WORK}"/config-linux .config && -##(yes "" | make ARCH="${KARCH}" oldconfig) && # Install Linux kernel headers (for use by uClibc). make headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="${CROSS}" && -# Build bootable kernel for target. -##make ARCH="${KARCH}" CROSS_COMPILE="${CROSS_TARGET}"- && -##cp "${KERNEL_PATH}" "${CROSS}"/zImage && cd .. && $CLEANUP linux-* @@ -68,24 +74,10 @@ setupfor uClibc cp "${WORK}"/config-uClibc .config && -(yes "" | make CROSS="${CROSS_TARGET}"- oldconfig) && -make CROSS="${CROSS_TARGET}"- KERNEL_SOURCE="${CROSS}" && -#make CROSS="${CROSS_TARGET}"- utils && -# The kernel headers are already installed, but uClibc's install will try to -# be "helpful" and copy them over themselves, at which point hilarity ensues. -# Make it not do that. -rm include/{asm,asm-generic,linux} && -make CROSS="${CROSS_TARGET}"- KERNEL_SOURCE="${CROSS}"/ \ - RUNTIME_PREFIX="${CROSS}"/ DEVEL_PREFIX="${CROSS}"/ \ - install_runtime install_dev && -# The uClibc build uses ./include instead of ${CROSS}/include, so the symlinks -# need to come back. (Yes, it links against the _headers_ from the source, -# but against the _libraries_ from the destination. Hence needing to install -# libc.so before building utils.) -ln -s "${CROSS}"/include/linux include/linux && -ln -s "${CROSS}"/include/asm include/asm && -ln -s "${CROSS}"/include/asm-generic include/asm-generic && -make CROSS=${CROSS_TARGET}- RUNTIME_PREFIX="${CROSS}"/ install_utils && +(yes "" | make CROSS="${ARCH}-" oldconfig) > /dev/null && +make CROSS="${ARCH}-" KERNEL_HEADERS="${CROSS}/include" \ + RUNTIME_PREFIX="${CROSS}/" DEVEL_PREFIX="${CROSS}/" \ + all install_runtime install_dev install_utils && cd .. && $CLEANUP uClibc* @@ -105,38 +97,31 @@ # Build hello.c dynamic, then static, to verify header/library paths. -"$GCCNAME" -Os "$WORK"/hello.c -o "$WORK"/hello && -"$GCCNAME" -Os -static "$WORK"/hello.c -o "$WORK"/hello && +"${ARCH}-gcc" -Os "$WORK"/hello.c -o "$WORK"/hello && +"${ARCH}-gcc" -Os -static "$WORK"/hello.c -o "$WORK"/hello && [ x"$(qemu-"${KARCH}" "${WORK}"/hello)" == x"Hello world!" ] && echo Cross-toolchain seems to work. [ $? -ne 0 ] && dienow -# Change the FSF's crazy names to something reasonable. - -cd "${CROSS}"/bin && -for i in "${ARCH}"-* -do - strip "$i" - mv "$i" "${ARCH}"-"$(echo "$i" | sed 's/.*-//')" -done - cat > "${CROSS}"/README << EOF && Cross compiler for $ARCH From http://landley.net/code/firmware -To use: Add the \"bin\" directory to your \$PATH, and use \"$ARCH-gcc\" as +To use: Add the "bin" directory to your \$PATH, and use "$ARCH-gcc" as your compiler. The syntax used to build the Linux kernel is: - make ARCH="${KARCH}" CROSS_COMPILE="${ARCH}"- + make ARCH=${KARCH} CROSS_COMPILE=${ARCH}- EOF -# Tar up the cross compiler. +echo creating cross-compiler-"${ARCH}".tar.bz2 && cd "${TOP}" -tar cjvCf build cross-compiler-"${ARCH}".tar.bz2 cross-compiler-"${ARCH}" && +{ tar cjvCf build cross-compiler-"${ARCH}".tar.bz2 cross-compiler-"${ARCH}" || + dienow +} | dotprogress [ $? -ne 0 ] && dienow
--- a/download.sh Thu Dec 14 15:20:07 2006 -0500 +++ b/download.sh Sat Dec 16 20:20:00 2006 -0500 @@ -13,8 +13,8 @@ SHA1=a373be93fcb55b97a5b96a422f690edafeff1de4 \ download && -URL=http://www.uclibc.org/downloads/snapshots/uClibc-20061128.tar.bz2 \ -SHA1=50c024ac137262981348ad54e0f64d83db1bce4e \ +URL=http://www.uclibc.org/downloads/snapshots/uClibc-20061214.tar.bz2 \ +SHA1= \ download && URL=ftp://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2 \ @@ -45,4 +45,7 @@ SHA1=41ed86d941b9c8025aee45db56c0283169dcab3d \ download && -echo === Got all source. +echo === Got all source. && + +cleanup_oldfiles +
--- a/include.sh Thu Dec 14 15:20:07 2006 -0500 +++ b/include.sh Sat Dec 16 20:20:00 2006 -0500 @@ -20,7 +20,12 @@ # Test first (so we don't re-download a file we've already got). SUM=`cat "$SRCDIR/$FILENAME" | sha1sum | awk '{print $1}'` - if [ x"$SUM" == x"$SHA1" ] + if [ -z "$SHA1" ] && [ -f "$SRCDIR/$FILENAME" ] + then + touch "$SRCDIR/$FILENAME" + echo "No SHA1 for $FILENAME" + return 0 + elif [ x"$SUM" == x"$SHA1" ] then touch "$SRCDIR/$FILENAME" echo "Confirmed $FILENAME" @@ -46,6 +51,22 @@ return 1 } +# Clean obsolete files out of the source directory + +START_TIME=`date +%s` + +function cleanup_oldfiles() +{ + for i in "${SRCDIR}"/* + do + if [ -f "$i" ] && [ "$(date +%s -r "$i")" -lt "${START_TIME}" ] + then + echo Removing old file "$i" + rm -rf "$i" + fi + done +} + function dienow() { echo "Exiting due to errors" @@ -72,6 +93,8 @@ function setupfor() { + # Is it a bzip2 or gzip tarball? + FILE="${LINKDIR}/$1" if [ -f "${FILE}".tar.bz2 ] then @@ -81,11 +104,17 @@ FILE="${FILE}".tar.gz DECOMPRESS="z" fi + + # Announce package, with easy-to-grep-for "===" marker. Extract it. + echo "=== Building $1" echo -n "Extracting" cd "${WORK}" && { tar xv${DECOMPRESS}f "$FILE" || dienow } | dotprogress + + # Do we have a separate working directory? + if [ -z "$2" ] then cd "$1"* || dienow @@ -93,10 +122,23 @@ mkdir "$2" cd "$2" || dienow fi + + # Set CURSRC + export CURSRC="$1" [ ! -z "$3" ] && CURSRC="$3" export CURSRC=`echo "${WORK}/${CURSRC}"*` [ ! -d "${CURSRC}" ] && dienow + + # Apply any patches to this package + + for i in "${SOURCES}/patches/$1"* + do + if [ -f "$i" ] + then + (cd "${CURSRC}" && patch -p1 -i "$i") || dienow + fi + done } # Setup @@ -110,9 +152,9 @@ export SOURCES="${TOP}/sources" export SRCDIR="${SOURCES}/packages" export LINKDIR="${SOURCES}/build-links" -export WORK="${TOP}/build/temp" +export BUILD="${TOP}/build" +export WORK="${BUILD}/temp" export FROMSRC=../packages -export CROSS_BASE="${TOP}/build/cross-compiler" mkdir -p "${SRCDIR}" "${WORK}" "${LINKDIR}" # For bash: check the $PATH for new executables added after startup. @@ -142,8 +184,8 @@ # Add the cross compiler to the start of the path. - export CROSS="${TOP}/build/cross-compiler-$ARCH" - mkdir -p "${CROSS}" || dienow + export CROSS="${BUILD}/cross-compiler-$ARCH" + export NATIVE="${BUILD}/mini-native-$ARCH" export PATH=${CROSS}/bin:"$PATH" fi
--- a/sources/configs/armv4l Thu Dec 14 15:20:07 2006 -0500 +++ b/sources/configs/armv4l Sat Dec 16 20:20:00 2006 -0500 @@ -108,7 +108,7 @@ # Networking Support # # UCLIBC_HAS_IPV6 is not set -# UCLIBC_HAS_RPC is not set +UCLIBC_HAS_RPC=y # UCLIBC_USE_NETLINK is not set #
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sources/patches/uClibc-fixarmv4l.patch Sat Dec 16 20:20:00 2006 -0500 @@ -0,0 +1,11 @@ +--- uClibc/libc/sysdeps/linux/common/bits/uClibc_pthread.h 2006-12-15 10:32:13.000000000 -0500 ++++ uClibc-patched/libc/sysdeps/linux/common/bits/uClibc_pthread.h 2006-12-15 10:02:46.000000000 -0500 +@@ -34,7 +34,7 @@ + __const pthread_mutexattr_t *__mutex_attr); + extern int weak_function __pthread_mutex_destroy (pthread_mutex_t *__mutex); + extern int weak_function __pthread_mutex_lock (pthread_mutex_t *__mutex); +-extern int weak_function __pthread_mutex_unlock (pthread_mutex_t *__mutex); ++extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); + extern void __uclibc_mutex_unlock (void *) attribute_hidden; + extern int weak_function __pthread_mutex_trylock (pthread_mutex_t *__mutex); + extern void weak_function _pthread_cleanup_push_defer (