changeset 110:62f6268ff61b

Build uClibc's readelf and ldd by hand to work around inadequate cross-compile support. Add default CC=gcc to include.sh. Download distcc. Add run_emulator() to i686 and armv4l and use it in run-mini-native.sh.
author Rob Landley <rob@landley.net>
date Sat, 24 Feb 2007 20:33:02 -0500
parents d9dae1196ea7
children cf2341a95dd5
files cross-compiler.sh download.sh include.sh run-mini-native.sh sources/configs/armv4l sources/configs/i686
diffstat 6 files changed, 30 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/cross-compiler.sh	Sat Feb 24 20:31:26 2007 -0500
+++ b/cross-compiler.sh	Sat Feb 24 20:33:02 2007 -0500
@@ -51,7 +51,7 @@
 
 cd "${CROSS}"/bin &&
 mv "${ARCH}-gcc" gcc-unwrapped &&
-gcc "${TOP}"/sources/toys/gcc-uClibc.c -Os -s -o "${ARCH}-gcc"
+$CC -Os -s "${TOP}"/sources/toys/gcc-uClibc.c -o "${ARCH}-gcc"
 
 [ $? -ne 0 ] && dienow
 
@@ -72,10 +72,13 @@
 (yes "" | make CROSS="${ARCH}-" oldconfig) > /dev/null &&
 make CROSS="${ARCH}-" KERNEL_HEADERS="${CROSS}/include" PREFIX="${CROSS}/" \
 	RUNTIME_PREFIX=/ DEVEL_PREFIX=/ all install_runtime install_dev &&
-# This needs to be built with the native compiler.  Since uClibc uses $CROSS
-# internally, we have to blank it to avoid confusing them.
-#CROSS= make KERNEL_HEADERS="${CROSS}/include" \
-#	RUNTIME_PREFIX="${CROSS}/" DEVEL_PREFIX="${CROSS}/" install_utils &&
+# "make utils" in uClibc is broken for cross compiling.  Either it creates a
+# target binary (which you can't run on the host), or it tries to link the
+# host binary against the target library, and use the target compiler flags
+# (neither of which is going to produce a working host binary).  The solution
+# is to bypass the broken build entirely, and do it by hand.
+$CC -Os -s -I include utils/readelf.c -o readelf &&
+$CC -Os -s -I ldso/include utils/ldd.c -o ldd &&
 cd .. &&
 $CLEANUP uClibc*
 
--- a/download.sh	Sat Feb 24 20:31:26 2007 -0500
+++ b/download.sh	Sat Feb 24 20:33:02 2007 -0500
@@ -64,6 +64,11 @@
 SHA1=72c17d1dd6786d22ca0aaaa7292b8edcd70a27de \
 download &&
 
+# We look for things.  Things that make us go.  (Laxatives, aisle 7.)
+URL=http://distcc.samba.org/ftp/distcc/distcc-2.18.3.tar.bz2 \
+SHA1=88e4c15826bdbc5a3de0f7c1bcb429e558c6976d \
+download &&
+
 echo === Got all source. &&
 
 cleanup_oldfiles &&
--- a/include.sh	Sat Feb 24 20:31:26 2007 -0500
+++ b/include.sh	Sat Feb 24 20:33:02 2007 -0500
@@ -212,3 +212,4 @@
 mkdir -p "${WORK}"
 
 [ -z "$CLEANUP" ] && CLEANUP="rm -rf"
+[ -z "$CC" ] && CC=gcc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run-mini-native.sh	Sat Feb 24 20:33:02 2007 -0500
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+source include.sh
+
+run_emulator build/image-"$1".ext2 build/mini-native-"$1"/zImage-"$1" \
+	"root=/dev/hda rw init=/tools/bin/sh panic=1"
--- a/sources/configs/armv4l	Sat Feb 24 20:31:26 2007 -0500
+++ b/sources/configs/armv4l	Sat Feb 24 20:33:02 2007 -0500
@@ -3,6 +3,11 @@
 GCC_FLAGS= #"--with-float=soft"
 BINUTILS_FLAGS=
 QEMU_TEST=$KARCH
+run_emulator()
+{
+  qemu-system-arm -M versatilepb -nographic -hda "$1" \
+	-kernel "$2" -append "$3 console=ttyAMA0"
+}
 
 # Write out uClibc .config file.
 
--- a/sources/configs/i686	Sat Feb 24 20:31:26 2007 -0500
+++ b/sources/configs/i686	Sat Feb 24 20:33:02 2007 -0500
@@ -4,6 +4,11 @@
 GCC_FLAGS=
 QEMU_TEST=$KARCH
 
+run_emulator()
+{
+  qemu -nographic -hda "$1" -kernel "$2" -append "$3 console=ttyS0"
+}
+
 # Write out uClibc .config file.
 
 cat > "${WORK}"/config-uClibc << 'EOF'