mailing list of musl libc
 help / color / mirror / code / Atom feed
* bootstrap-linux patches for cross compilation to arm
@ 2012-07-28 12:18 James Bond
  2012-07-28 12:54 ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: James Bond @ 2012-07-28 12:18 UTC (permalink / raw)
  To: musl


[-- Attachment #1.1: Type: text/plain, Size: 1547 bytes --]

Hi,

This is the patch to make bootstrap linux to cross compile successfully to
arm target.
This patch is based on pikhq's commit a0a06ab5329cbcfbb088fbe490c4363043a1216a
(the latest as of today).

I've successfully created a working rootfs and native toolchain from x86-64
host with this. My host gcc is 4.6.2 if it matters.
The changes are minimal and intended only to get the cross working, I
didn't try to optimise anything.

What was fixed:
- change linux-musl to linux-musleabi for arm target
- add host_configargs="LIBS=-lc" and --with-stage1-libs=-lc for native
gcc/binutils compile so that they don't pull in *printf from libiberty
(which segfaults).
- add linux-arm.config

Some known issues:
a) musl version as configured is at 0.9.2 but with arm it won't boot with
0.9.2 (busybox segfaults), you need to get the latest git master, make a
tarball out of it and rename it to musl-0.9.2.tar.gz in the "src"
directory.
b) kernel compile is commented out - it doesn't work out of the box. It
kind of works but stops near then end with missing symbols. If one then
re-do the process (issue another make in the kernel directory) it then
continues to completion. The produced kernel/modules works fine.
c) the kernel config for arm is configured based on versatible emulation
(because that's what I use for qemu at the moment).

Got a lot of help from John and Isaac to get this going, so thanks to both
of you.

This is my first post to the mailing list, so you feel this kind of stuff
is out of topic, my apology and lesson learnt.

cheers!

[-- Attachment #1.2: Type: text/html, Size: 1756 bytes --]

[-- Attachment #2: bootstrap-linux-arm.patch --]
[-- Type: application/octet-stream, Size: 27351 bytes --]

diff -Naur bootstrap-linux/bootstrap.sh bts/bootstrap.sh
--- bootstrap-linux/bootstrap.sh	2012-06-18 17:48:00.186828725 +1000
+++ bts/bootstrap.sh	2012-07-27 20:03:28.000000000 +1000
@@ -1,9 +1,9 @@
 #!/bin/sh -e
-
 export PATH=$(pwd)/cross/bin:$(pwd)/utils:$PATH
 
 build cross-scripts/binutils-*
-build cross-scripts/gcc-*
+build cross-scripts/gcc-* 
+build cross-scripts/gdb-* 
 
 export CC=""
 export CFLAGS="-Os"
@@ -20,9 +20,10 @@
 build build-scripts/binutils-*
 build build-scripts/gcc-*
 build build-scripts/make-*
-build build-scripts/gmp-*
-build build-scripts/mpfr-*
-build build-scripts/mpc-*
+#build build-scripts/gmp-*
+#build build-scripts/mpfr-*
+#build build-scripts/mpc-*
+
 build build-scripts/busybox-*
-build build-scripts/linux-*
+#build build-scripts/linux-*
 build build-scripts/finish
diff -Naur bootstrap-linux/build-scripts/binutils-2.22 bts/build-scripts/binutils-2.22
--- bootstrap-linux/build-scripts/binutils-2.22	2012-06-18 17:48:00.186828725 +1000
+++ bts/build-scripts/binutils-2.22	2012-07-27 19:49:14.000000000 +1000
@@ -2,6 +2,9 @@
 patches=binutils-2.22-musl.diff
 
 config() {
-	./configure --host=$A-unknown-linux-musl --target=$A-unknown-linux-musl --prefix=/ \
-		--disable-werror --disable-nls
+	export host_configargs='LIBS=-lc'
+	#sed -i -e '1 s/^/#define ELIDE_CODE\n/' libiberty/getopt.c
+	./configure --host=$A-unknown-linux-musl${tuple_suffix} --target=$A-unknown-linux-musl${tuple_suffix} --prefix=/ \
+		--disable-werror --disable-nls --with-stage1-libs=-lc
+	export -n host_configargs 
 }
diff -Naur bootstrap-linux/build-scripts/busybox-1.19.4 bts/build-scripts/busybox-1.19.4
--- bootstrap-linux/build-scripts/busybox-1.19.4	2012-06-18 17:48:00.186828725 +1000
+++ bts/build-scripts/busybox-1.19.4	2012-07-27 18:51:59.000000000 +1000
@@ -3,12 +3,12 @@
 patches=busybox-musl-fixes.patch
 
 config() {
-	make allnoconfig CROSS_COMPILE="$A-unknown-linux-musl-" HOSTCFLAGS="-D_GNU_SOURCE" \
+	make allnoconfig CROSS_COMPILE="$A-unknown-linux-musl${tuple_suffix}-" HOSTCFLAGS="-D_GNU_SOURCE" \
 		KCONFIG_ALLCONFIG="$top"/busybox.config
 }
 
 build() {
-	make CROSS_COMPILE="$A-unknown-linux-musl-" HOSTCFLAGS="-D_GNU_SOURCE"
+	make CROSS_COMPILE="$A-unknown-linux-musl${tuple_suffix}-" HOSTCFLAGS="-D_GNU_SOURCE"
 }
 
 install() {
@@ -17,6 +17,6 @@
 	cp busybox "$out"/bin/busybox
 
 	cat busybox.links | while read line;do
-		ln -s busybox "$(basename $line)"
+		[ ! -e "$out"/bin/"$(basename $line)" ] && ln -s busybox "$out"/bin/"$(basename $line)"
 	done
 }
diff -Naur bootstrap-linux/build-scripts/gcc-4.6.3 bts/build-scripts/gcc-4.6.3
--- bootstrap-linux/build-scripts/gcc-4.6.3	2012-06-18 17:48:00.186828725 +1000
+++ bts/build-scripts/gcc-4.6.3	2012-07-27 18:08:45.000000000 +1000
@@ -2,11 +2,14 @@
 patches=gcc-4.6.3-musl.diff
 
 config() {
+	export host_configargs='LIBS=-lc'
 	sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
+	sed -i -e '1 s/^/#define ELIDE_CODE\n/' libiberty/getopt.c
 	mkdir "$work/gcc-build"
 	cd "$work/gcc-build"
-	"$work/$unpack"/configure --host=$A-unknown-linux-musl --target=$A-unknown-linux-musl --enable-languages=c \
-		--prefix=/ --disable-libmudflap --disable-nls
+	"$work/$unpack"/configure --host=$A-unknown-linux-musl${tuple_suffix} --target=$A-unknown-linux-musl${tuple_suffix} --enable-languages=c \
+		--prefix=/ --disable-libmudflap --disable-nls --with-stage1-libs=-lc
+	export -n host_configargs 
 }
 
 install() {
diff -Naur bootstrap-linux/build-scripts/gmp-5.0.2 bts/build-scripts/gmp-5.0.2
--- bootstrap-linux/build-scripts/gmp-5.0.2	2012-06-18 17:48:00.186828725 +1000
+++ bts/build-scripts/gmp-5.0.2	2012-07-27 19:40:26.000000000 +1000
@@ -1,10 +1,10 @@
 url=http://ftpmirror.gnu.org/gmp/gmp-$version.tar.bz2
 
-CC=$A-unknown-linux-musl-gcc
+CC=$A-unknown-linux-musl${tuple_suffix}-gcc
 CFLAGS="$CFLAGS -D_GNU_SOURCE -D_BSD_SOURCE -Wno-implicit"
 
 config() {
 	munge-config-sub configfsf.sub
 
-	./configure --prefix=/ --host=$A-unknown-linux-musl
+	LIBS="-lc" ./configure --prefix=/ --host=$A-unknown-linux-musl${tuple_suffix}
 }
diff -Naur bootstrap-linux/build-scripts/linux-3.2.18 bts/build-scripts/linux-3.2.18
--- bootstrap-linux/build-scripts/linux-3.2.18	2012-06-18 17:48:00.186828725 +1000
+++ bts/build-scripts/linux-3.2.18	2012-07-27 18:10:23.000000000 +1000
@@ -1,21 +1,23 @@
 ARCH=$A
 [ "$ARCH" = "i686" ] && ARCH=i386
+KCONFIG=linux.config
+[ "$ARCH" = "arm" ] && KCONFIG=linux-arm.config
 
 url=http://www.kernel.org/pub/linux/kernel/v3.0/linux-$version.tar.bz2
 
 patches="linux-noperl-capflags.patch linux-noperl-headers.patch linux-noperl-timeconst.patch linux-posix-sed.patch"
 
 config() {
-	make allnoconfig ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl-" \
-		HOSTCFLAGS="-D_GNU_SOURCE" KCONFIG_ALLCONFIG="$top/linux.config"
+	make allnoconfig ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl${tuple_suffix}-" \
+		HOSTCFLAGS="-D_GNU_SOURCE" KCONFIG_ALLCONFIG="$top/$KCONFIG"
 }
 
 build() {
-	make HOSTCFLAGS=-D_GNU_SOURCE ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl-" \
+	make HOSTCFLAGS=-D_GNU_SOURCE ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl${tuple_suffix}-" \
 		INSTALL_HDR_PATH=dest headers_install
 	find dest/include \( -name .install -o -name ..install.cmd \) -delete
 	
-	make HOSTCFLAGS=-D_GNU_SOURCE ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl-"
+	make HOSTCFLAGS=-D_GNU_SOURCE ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl${tuple_suffix}-"
 }
 
 install() {
@@ -24,10 +26,10 @@
 	if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ];then
 		cp arch/x86/boot/bzImage "$out"/boot/vmlinuz-$version
 	else
-		cp arch/$ARCH/boot/bzImage "$out"/boot/vmlinuz-$version
+		cp arch/$ARCH/boot/zImage "$out"/boot/vmlinuz-$version
 	fi
 
-	make INSTALL_MOD_PATH="$out" ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl-" modules_install
+	make INSTALL_MOD_PATH="$out" ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl${tuple_suffix}-" modules_install
 
 	mkdir -p "$out"/include/
 	cp -rv dest/include/* "$out"/include/
diff -Naur bootstrap-linux/build-scripts/make-3.82 bts/build-scripts/make-3.82
--- bootstrap-linux/build-scripts/make-3.82	2012-06-18 17:48:00.186828725 +1000
+++ bts/build-scripts/make-3.82	2012-07-27 18:08:22.000000000 +1000
@@ -1,8 +1,8 @@
 url=http://ftp.gnu.org/gnu/$name/$name-$version.tar.bz2
 
-CFLAGS="$CFLAGS -D__BEOS__"
+CFLAGS="$CFLAGS -D__BEOS__ -DUSE_VARIADIC -DHAVE_VPRINTF"
 
 config() {
 	munge-config-sub config/config.sub
-	./configure --prefix=/ --disable-nls --host=$A-unknown-linux-musl
+	./configure --prefix=/ --disable-nls --host=$A-unknown-linux-musl${tuple_suffix}
 }
diff -Naur bootstrap-linux/build-scripts/musl-0.9.0 bts/build-scripts/musl-0.9.0
--- bootstrap-linux/build-scripts/musl-0.9.0	2012-06-18 17:48:00.186828725 +1000
+++ bts/build-scripts/musl-0.9.0	1970-01-01 10:00:00.000000000 +1000
@@ -1,7 +0,0 @@
-url=http://www.etalabs.net/musl/releases/musl-$version.tar.gz
-
-CC=$A-unknown-linux-musl-gcc
-
-config() {
-	./configure --target=$A-unknown-linux-musl --prefix=/ --disable-gcc-wrapper
-}
diff -Naur bootstrap-linux/build-scripts/musl-0.9.2 bts/build-scripts/musl-0.9.2
--- bootstrap-linux/build-scripts/musl-0.9.2	1970-01-01 10:00:00.000000000 +1000
+++ bts/build-scripts/musl-0.9.2	2012-07-27 18:08:22.000000000 +1000
@@ -0,0 +1,7 @@
+url=http://www.etalabs.net/musl/releases/musl-$version.tar.gz
+
+CC=$A-unknown-linux-musl${tuple_suffix}-gcc
+
+config() {
+	./configure --target=$A-unknown-linux-musl${tuple_suffix} --prefix=/ --disable-gcc-wrapper
+}
diff -Naur bootstrap-linux/cross-scripts/binutils-2.22 bts/cross-scripts/binutils-2.22
--- bootstrap-linux/cross-scripts/binutils-2.22	2012-06-18 17:48:00.186828725 +1000
+++ bts/cross-scripts/binutils-2.22	2012-07-27 18:08:22.000000000 +1000
@@ -7,7 +7,7 @@
 CFLAGS="$CFLAGS -D_GNU_SOURCE"
 
 config() {
-	./configure --target=$A-unknown-linux-musl --prefix="$out"
+	./configure --target=$A-unknown-linux-musl${tuple_suffix} --prefix="$out"
 }
 
 install() {
diff -Naur bootstrap-linux/cross-scripts/gcc-4.6.3 bts/cross-scripts/gcc-4.6.3
--- bootstrap-linux/cross-scripts/gcc-4.6.3	2012-06-18 17:48:00.186828725 +1000
+++ bts/cross-scripts/gcc-4.6.3	2012-07-28 01:29:06.564450644 +1000
@@ -9,10 +9,10 @@
 	sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
 	mkdir "$work/gcc-build"
 	cd "$work/gcc-build"
-	"$work/$unpack"/configure --target=$A-unknown-linux-musl --enable-languages=c --with-newlib \
+	"$work/$unpack"/configure --target=$A-unknown-linux-musl${tuple_suffix} --enable-languages=c --with-newlib \
 		--disable-multilib --disable-libssp --disable-libquadmath \
 		--disable-threads --disable-decimal-float --disable-shared \
-		--disable-libmudflap --disable-libgomp --prefix="$out"
+		--disable-libmudflap --disable-libgomp --prefix="$out" 
 }
 
 install() {
@@ -20,5 +20,5 @@
 	cd "$work/$unpack"
 	rm -rf "$work/gcc-build"
 	cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
-	  `dirname $($A-unknown-linux-musl-gcc -print-libgcc-file-name)`/include-fixed/limits.h
+	  `dirname $($A-unknown-linux-musl${tuple_suffix}-gcc -print-libgcc-file-name)`/include-fixed/limits.h
 }
diff -Naur bootstrap-linux/cross-scripts/gdb-7.4.1 bts/cross-scripts/gdb-7.4.1
--- bootstrap-linux/cross-scripts/gdb-7.4.1	1970-01-01 10:00:00.000000000 +1000
+++ bts/cross-scripts/gdb-7.4.1	2012-07-27 18:34:02.000000000 +1000
@@ -0,0 +1,15 @@
+name=gdb
+
+url=http://mirrors.kernel.org/sources.redhat.com/$name/releases/$name-$version.tar.bz2
+patches=gdb-7.4.1-musl.diff
+out=$top/cross
+
+CFLAGS="$CFLAGS -D_GNU_SOURCE"
+
+config() {
+	./configure --target=$A-unknown-linux-musl${tuple_suffix} --prefix="$out"
+}
+
+install() {
+	make install
+}
diff -Naur bootstrap-linux/cross-scripts/gmp-5.0.2 bts/cross-scripts/gmp-5.0.2
--- bootstrap-linux/cross-scripts/gmp-5.0.2	2012-06-18 17:48:00.186828725 +1000
+++ bts/cross-scripts/gmp-5.0.2	2012-07-27 19:38:12.000000000 +1000
@@ -5,8 +5,8 @@
 config() {
 	munge-config-sub configfsf.sub
 
-	CFLAGS="$CFLAGS -D_GNU_SOURCE -D_BSD_SOURCE -Wno-implicit" \
-		./configure --prefix="$out"/$A-unknown-linux-musl --host=$A-unknown-linux-musl --disable-shared
+	CFLAGS="$CFLAGS -D_GNU_SOURCE -D_BSD_SOURCE -Wno-implicit" LIBS="-lc" \
+		./configure --prefix="$out"/$A-unknown-linux-musl${tuple_suffix} --host=$A-unknown-linux-musl${tuple_suffix} --disable-shared
 }
 
 install() {
diff -Naur bootstrap-linux/cross-scripts/linux-headers-3.2.18 bts/cross-scripts/linux-headers-3.2.18
--- bootstrap-linux/cross-scripts/linux-headers-3.2.18	2012-06-18 17:48:00.186828725 +1000
+++ bts/cross-scripts/linux-headers-3.2.18	2012-07-27 18:08:22.000000000 +1000
@@ -10,17 +10,17 @@
 patches=linux-noperl-headers.patch
 
 config() {
-	make allnoconfig ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl-" \
-		HOSTCFLAGS="-D_GNU_SOURCE" KCONFIG_ALLCONFIG="$top/linux.config"
+	make allnoconfig ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl${tuple_suffix}-" \
+		HOSTCFLAGS="-D_GNU_SOURCE" KCONFIG_ALLCONFIG="$top/linux-arm.config"
 }
 
 build() {
-	make HOSTCFLAGS=-D_GNU_SOURCE ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl-" \
+	make HOSTCFLAGS=-D_GNU_SOURCE ARCH=$ARCH CROSS_COMPILE="$A-unknown-linux-musl${tuple_suffix}-" \
 		INSTALL_HDR_PATH=dest headers_install
 }
 
 install() {
 	find dest/include \( -name .install -o -name ..install.cmd \) -delete
-	mkdir -p "$out"/$A-unknown-linux-musl/include/
-	cp -rv dest/include/* "$out"/$A-unknown-linux-musl/include/
+	mkdir -p "$out"/$A-unknown-linux-musl${tuple_suffix}/include/
+	cp -rv dest/include/* "$out"/$A-unknown-linux-musl${tuple_suffix}/include/
 }
diff -Naur bootstrap-linux/cross-scripts/mpc-0.9 bts/cross-scripts/mpc-0.9
--- bootstrap-linux/cross-scripts/mpc-0.9	2012-06-18 17:48:00.186828725 +1000
+++ bts/cross-scripts/mpc-0.9	2012-07-27 19:37:12.000000000 +1000
@@ -5,7 +5,7 @@
 config() {
 	munge-config-sub
 
-	./configure --prefix="$out"/$A-unknown-linux-musl/ --host=$A-unknown-linux-musl --disable-shared
+	./configure --prefix="$out"/$A-unknown-linux-musl${tuple_suffix}/ --host=$A-unknown-linux-musl${tuple_suffix} --disable-shared
 }
 
 install() {
diff -Naur bootstrap-linux/cross-scripts/mpfr-3.0.1 bts/cross-scripts/mpfr-3.0.1
--- bootstrap-linux/cross-scripts/mpfr-3.0.1	2012-06-18 17:48:00.186828725 +1000
+++ bts/cross-scripts/mpfr-3.0.1	2012-07-27 19:36:50.000000000 +1000
@@ -5,7 +5,7 @@
 config() {
 	munge-config-sub
 
-	./configure --prefix="$out"/$A-unknown-linux-musl --host=$A-unknown-linux-musl --disable-shared
+	./configure --prefix="$out"/$A-unknown-linux-musl${tuple_suffix} --host=$A-unknown-linux-musl${tuple_suffix} --disable-shared
 }
 
 install() {
diff -Naur bootstrap-linux/cross-scripts/musl-0.9.0 bts/cross-scripts/musl-0.9.0
--- bootstrap-linux/cross-scripts/musl-0.9.0	2012-06-18 17:48:00.186828725 +1000
+++ bts/cross-scripts/musl-0.9.0	1970-01-01 10:00:00.000000000 +1000
@@ -1,14 +0,0 @@
-url=http://www.etalabs.net/musl/releases/musl-$version.tar.gz
-
-out="$top/cross"
-
-CC=$A-unknown-linux-musl-gcc
-
-config() {
-	./configure --target=$A-unknown-linux-musl --prefix="$out"/$A-unknown-linux-musl/ --syslibdir="$out"/lib \
-		--disable-gcc-wrapper --disable-shared
-}
-
-install() {
-	make install
-}
diff -Naur bootstrap-linux/cross-scripts/musl-0.9.2 bts/cross-scripts/musl-0.9.2
--- bootstrap-linux/cross-scripts/musl-0.9.2	1970-01-01 10:00:00.000000000 +1000
+++ bts/cross-scripts/musl-0.9.2	2012-07-27 18:08:45.000000000 +1000
@@ -0,0 +1,14 @@
+url=http://www.etalabs.net/musl/releases/musl-$version.tar.gz
+
+out="$top/cross"
+
+CC=$A-unknown-linux-musl${tuple_suffix}-gcc
+
+config() {
+	./configure --target=$A-unknown-linux-musl${tuple_suffix} --prefix="$out"/$A-unknown-linux-musl${tuple_suffix}/ --syslibdir="$out"/lib \
+		--disable-gcc-wrapper --disable-shared
+}
+
+install() {
+	make install
+}
diff -Naur bootstrap-linux/linux-arm.config bts/linux-arm.config
--- bootstrap-linux/linux-arm.config	1970-01-01 10:00:00.000000000 +1000
+++ bts/linux-arm.config	2012-07-18 16:36:22.000000000 +1000
@@ -0,0 +1,476 @@
+CONFIG_ARM=y
+CONFIG_MIGHT_HAVE_PCI=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_HAVE_SCHED_CLOCK=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+CONFIG_LOCALVERSION=""
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+CONFIG_DEFAULT_HOSTNAME="(none)"
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_HAVE_SPARSE_IRQ=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_TINY_RCU=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_NAMESPACES=y
+CONFIG_UTS_NS=y
+CONFIG_IPC_NS=y
+CONFIG_USER_NS=y
+CONFIG_PID_NS=y
+CONFIG_NET_NS=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
+CONFIG_RD_XZ=y
+CONFIG_RD_LZO=y
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_UID16=y
+CONFIG_KALLSYMS=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_PCI_QUIRKS=y
+CONFIG_COMPAT_BRK=y
+CONFIG_SLAB=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_CFQ=y
+CONFIG_DEFAULT_IOSCHED="cfq"
+CONFIG_INLINE_SPIN_UNLOCK=y
+CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
+CONFIG_INLINE_READ_UNLOCK=y
+CONFIG_INLINE_READ_UNLOCK_IRQ=y
+CONFIG_INLINE_WRITE_UNLOCK=y
+CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
+CONFIG_FREEZER=y
+CONFIG_MMU=y
+CONFIG_ARCH_VERSATILE=y
+CONFIG_ARCH_VERSATILE_PB=y
+CONFIG_MACH_VERSATILE_AB=y
+CONFIG_PLAT_VERSATILE_CLCD=y
+CONFIG_PLAT_VERSATILE_FPGA_IRQ=y
+CONFIG_PLAT_VERSATILE_SCHED_CLOCK=y
+CONFIG_PLAT_VERSATILE=y
+CONFIG_ARM_TIMER_SP804=y
+CONFIG_CPU_ARM926T=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5TJ=y
+CONFIG_CPU_PABRT_LEGACY=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_COPY_V4WB=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_USE_DOMAINS=y
+CONFIG_ARM_THUMB=y
+CONFIG_ARM_L1_CACHE_SHIFT=5
+CONFIG_ARM_VIC=y
+CONFIG_ARM_VIC_NR=2
+CONFIG_ICST=y
+CONFIG_ARM_AMBA=y
+CONFIG_PCI=y
+CONFIG_PCI_SYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_VMSPLIT_3G=y
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_PREEMPT_NONE=y
+CONFIG_HZ=100
+CONFIG_AEABI=y
+CONFIG_OABI_COMPAT=y
+CONFIG_HAVE_ARCH_PFN_VALID=y
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=999999
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_VIRT_TO_BUS=y
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_NEED_PER_CPU_KM=y
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_LEDS=y
+CONFIG_LEDS_CPU=y
+CONFIG_ALIGNMENT_TRAP=y
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_CMDLINE="root=1f03 mem=32M"
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
+CONFIG_FPE_NWFPE=y
+CONFIG_VFP=y
+CONFIG_BINFMT_ELF=y
+CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
+CONFIG_HAVE_AOUT=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_PM_SLEEP=y
+CONFIG_PM=y
+CONFIG_PM_CLK=y
+CONFIG_CPU_PM=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_XFRM=y
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
+CONFIG_INET_LRO=y
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+CONFIG_WIRELESS=y
+CONFIG_UEVENT_HELPER_PATH=""
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+CONFIG_MTD=y
+CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+CONFIG_MTD_CFI_INTELEXT=y
+CONFIG_MTD_CFI_UTIL=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_BLK_DEV=y
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+CONFIG_HAVE_IDE=y
+CONFIG_SCSI_MOD=y
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+CONFIG_SCSI_PROC_FS=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_BLK_DEV_SR=y
+CONFIG_SCSI_WAIT_SCAN=m
+CONFIG_SCSI_SPI_ATTRS=y
+CONFIG_SCSI_LOWLEVEL=y
+CONFIG_SCSI_SYM53C8XX_2=y
+CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
+CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
+CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
+CONFIG_SCSI_SYM53C8XX_MMIO=y
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+CONFIG_MII=y
+CONFIG_ETHERNET=y
+CONFIG_NET_VENDOR_3COM=y
+CONFIG_NET_VENDOR_ADAPTEC=y
+CONFIG_NET_VENDOR_ALTEON=y
+CONFIG_NET_VENDOR_AMD=y
+CONFIG_NET_VENDOR_ATHEROS=y
+CONFIG_NET_VENDOR_BROADCOM=y
+CONFIG_NET_VENDOR_BROCADE=y
+CONFIG_NET_VENDOR_CHELSIO=y
+CONFIG_NET_VENDOR_CISCO=y
+CONFIG_NET_VENDOR_DEC=y
+CONFIG_NET_VENDOR_DLINK=y
+CONFIG_NET_VENDOR_EMULEX=y
+CONFIG_NET_VENDOR_EXAR=y
+CONFIG_NET_VENDOR_FARADAY=y
+CONFIG_NET_VENDOR_HP=y
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+CONFIG_NET_VENDOR_MELLANOX=y
+CONFIG_NET_VENDOR_MICREL=y
+CONFIG_NET_VENDOR_MYRI=y
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+CONFIG_NET_VENDOR_NVIDIA=y
+CONFIG_NET_VENDOR_OKI=y
+CONFIG_NET_PACKET_ENGINE=y
+CONFIG_NET_VENDOR_QLOGIC=y
+CONFIG_NET_VENDOR_REALTEK=y
+CONFIG_NET_VENDOR_RDC=y
+CONFIG_NET_VENDOR_SEEQ=y
+CONFIG_NET_VENDOR_SILAN=y
+CONFIG_NET_VENDOR_SIS=y
+CONFIG_NET_VENDOR_SMSC=y
+CONFIG_SMC91X=y
+CONFIG_NET_VENDOR_STMICRO=y
+CONFIG_NET_VENDOR_SUN=y
+CONFIG_NET_VENDOR_TEHUTI=y
+CONFIG_NET_VENDOR_TI=y
+CONFIG_NET_VENDOR_VIA=y
+CONFIG_WLAN=y
+CONFIG_INPUT=y
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+CONFIG_INPUT_EVDEV=y
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_KEYBOARD_ATKBD=y
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+CONFIG_SERIO=y
+CONFIG_SERIO_AMBAKMI=y
+CONFIG_SERIO_LIBPS2=y
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_VT_CONSOLE_SLEEP=y
+CONFIG_HW_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=16
+CONFIG_DEVKMEM=y
+CONFIG_SERIAL_8250=m
+CONFIG_SERIAL_8250_PCI=m
+CONFIG_SERIAL_8250_NR_UARTS=4
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+CONFIG_SERIAL_8250_EXTENDED=y
+CONFIG_SERIAL_8250_MANY_PORTS=y
+CONFIG_SERIAL_8250_SHARE_IRQ=y
+CONFIG_SERIAL_8250_RSA=y
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_HW_RANDOM=m
+CONFIG_DEVPORT=y
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=m
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+CONFIG_SSB_POSSIBLE=y
+CONFIG_BCMA_POSSIBLE=y
+CONFIG_VGA_ARB=y
+CONFIG_VGA_ARB_MAX_GPUS=16
+CONFIG_FB=y
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+CONFIG_FB_ARMCLCD=y
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FONTS=y
+CONFIG_FONT_ACORN_8x8=y
+CONFIG_SOUND=y
+CONFIG_SOUND_OSS_CORE=y
+CONFIG_SOUND_OSS_CORE_PRECLAIM=y
+CONFIG_SND=m
+CONFIG_SND_TIMER=m
+CONFIG_SND_PCM=m
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=m
+CONFIG_SND_PCM_OSS=m
+CONFIG_SND_PCM_OSS_PLUGINS=y
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+CONFIG_SND_VMASTER=y
+CONFIG_SND_AC97_CODEC=m
+CONFIG_SND_DRIVERS=y
+CONFIG_SND_PCI=y
+CONFIG_SND_ARM=y
+CONFIG_SND_ARMAACI=m
+CONFIG_AC97_BUS=m
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+CONFIG_USB_ARCH_HAS_EHCI=y
+CONFIG_USB_ARCH_HAS_XHCI=y
+CONFIG_MMC=y
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=8
+CONFIG_MMC_BLOCK_BOUNCE=y
+CONFIG_MMC_ARMMMCI=m
+CONFIG_RTC_LIB=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_HAVE_MACH_CLKDEV=y
+CONFIG_CLKSRC_MMIO=y
+CONFIG_IOMMU_SUPPORT=y
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_USE_FOR_EXT23=y
+CONFIG_EXT4_FS_XATTR=y
+CONFIG_EXT4_FS_POSIX_ACL=y
+CONFIG_JBD2=y
+CONFIG_FS_MBCACHE=y
+CONFIG_FS_POSIX_ACL=y
+CONFIG_EXPORTFS=y
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+CONFIG_ISO9660_FS=y
+CONFIG_JOLIET=y
+CONFIG_FAT_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+CONFIG_MISC_FILESYSTEMS=y
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_RTIME=y
+CONFIG_CRAMFS=y
+CONFIG_MINIX_FS=y
+CONFIG_ROMFS_FS=y
+CONFIG_ROMFS_BACKED_BY_BLOCK=y
+CONFIG_ROMFS_ON_BLOCK=y
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_ROOT_NFS=y
+CONFIG_NFSD=y
+CONFIG_NFSD_V3=y
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+CONFIG_PARTITION_ADVANCED=y
+CONFIG_MSDOS_PARTITION=y
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_KERNEL=y
+CONFIG_SCHED_DEBUG=y
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_MEMORY_INIT=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+CONFIG_BRANCH_PROFILE_NONE=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_ARM_UNWIND=y
+CONFIG_DEBUG_USER=y
+CONFIG_DEBUG_LL=y
+CONFIG_DEBUG_LL_UART_NONE=y
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+CONFIG_CRYPTO_ALGAPI=m
+CONFIG_CRYPTO_ALGAPI2=m
+CONFIG_CRYPTO_RNG=m
+CONFIG_CRYPTO_RNG2=m
+CONFIG_CRYPTO_AES=m
+CONFIG_CRYPTO_ANSI_CPRNG=m
+CONFIG_CRYPTO_HW=y
+CONFIG_BITREVERSE=y
+CONFIG_CRC16=y
+CONFIG_CRC32=y
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_DECOMPRESS=y
+CONFIG_XZ_DEC=y
+CONFIG_XZ_DEC_X86=y
+CONFIG_XZ_DEC_POWERPC=y
+CONFIG_XZ_DEC_IA64=y
+CONFIG_XZ_DEC_ARM=y
+CONFIG_XZ_DEC_ARMTHUMB=y
+CONFIG_XZ_DEC_SPARC=y
+CONFIG_XZ_DEC_BCJ=y
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_DECOMPRESS_XZ=y
+CONFIG_DECOMPRESS_LZO=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
diff -Naur bootstrap-linux/patches/gdb-7.4.1-musl.diff bts/patches/gdb-7.4.1-musl.diff
--- bootstrap-linux/patches/gdb-7.4.1-musl.diff	1970-01-01 10:00:00.000000000 +1000
+++ bts/patches/gdb-7.4.1-musl.diff	2012-07-19 00:36:07.000000000 +1000
@@ -0,0 +1,20 @@
+--- gdb-7.4.1/config.sub.orig	2011-11-02 11:56:53.000000000 +1100
++++ gdb-7.4.1/config.sub	2012-07-18 18:10:19.427187199 +1000
+@@ -124,7 +124,7 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+-  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
++  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | linux-musl* | \
+   linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+   knetbsd*-gnu* | netbsd*-gnu* | \
+   kopensolaris*-gnu* | \
+@@ -1345,7 +1345,7 @@
+ 	      | -chorusos* | -chorusrdb* | -cegcc* \
+ 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ 	      | -mingw32* | -linux-gnu* | -linux-android* \
+-	      | -linux-newlib* | -linux-uclibc* \
++	      | -linux-newlib* | -linux-uclibc* | -linux-musl* \
+ 	      | -uxpv* | -beos* | -mpeix* | -udk* \
+ 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
diff -Naur bootstrap-linux/utils/build bts/utils/build
--- bootstrap-linux/utils/build	2012-06-18 17:48:00.190162059 +1000
+++ bts/utils/build	2012-07-27 19:55:24.000000000 +1000
@@ -2,6 +2,8 @@
 
 : ${A:=$(uname -m)}
 export A
+tuple_suffix=""
+[ $A = "arm" ] && export tuple_suffix=eabi
 
 : ${top:=`pwd`}
 : ${out:=$top/out}
@@ -35,12 +37,12 @@
 config() {
 	if [ -x configure ];then
 		munge-config-sub
-		./configure --prefix=/ --host=$A-unknown-linux-musl
+		./configure --prefix=/ --host=$A-unknown-linux-musl${tuple_suffix}
 	fi
 }
 
 build() {
-	make
+	make -j 4
 }
 
 install() {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bootstrap-linux patches for cross compilation to arm
  2012-07-28 12:18 bootstrap-linux patches for cross compilation to arm James Bond
@ 2012-07-28 12:54 ` Rich Felker
  2012-07-28 13:54   ` John Spencer
  2012-07-28 14:42   ` James Bond
  0 siblings, 2 replies; 7+ messages in thread
From: Rich Felker @ 2012-07-28 12:54 UTC (permalink / raw)
  To: musl

On Sat, Jul 28, 2012 at 10:18:43PM +1000, James Bond wrote:
> - add host_configargs="LIBS=-lc" and --with-stage1-libs=-lc for native
> gcc/binutils compile so that they don't pull in *printf from libiberty
> (which segfaults).

Do you have any idea why this is needed? Are they always pulled in
(and just don't segfault on other archs), or is pulling them in
arm-specific?

> - add linux-arm.config
> 
> Some known issues:
> a) musl version as configured is at 0.9.2 but with arm it won't boot with
> 0.9.2 (busybox segfaults), you need to get the latest git master, make a
> tarball out of it and rename it to musl-0.9.2.tar.gz in the "src"
> directory.

Do you know which bugfix solved this? It would be nice to mention in
the 0.9.3 release notes/announcement (hopefully in the next few days).

> This is my first post to the mailing list, so you feel this kind of stuff
> is out of topic, my apology and lesson learnt.

Welcome to the list. This type of contribution to the list is
perfectly acceptable.

Rich


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bootstrap-linux patches for cross compilation to arm
  2012-07-28 12:54 ` Rich Felker
@ 2012-07-28 13:54   ` John Spencer
  2012-07-28 14:42   ` James Bond
  1 sibling, 0 replies; 7+ messages in thread
From: John Spencer @ 2012-07-28 13:54 UTC (permalink / raw)
  To: musl

On 07/28/2012 02:54 PM, Rich Felker wrote:
> On Sat, Jul 28, 2012 at 10:18:43PM +1000, James Bond wrote:
>> - add host_configargs="LIBS=-lc" and --with-stage1-libs=-lc for native
>> gcc/binutils compile so that they don't pull in *printf from libiberty
>> (which segfaults).
> Do you have any idea why this is needed? Are they always pulled in
> (and just don't segfault on other archs), or is pulling them in
> arm-specific?
>

i experienced similar things on sabotage. ARM is for some reason pulling 
in more of libiberty as other archs.
some of them have conflicting prototypes with libc.

https://github.com/rofl0r/sabotage/blob/master/pkg/stage0_gcc4 :

for i in strsignal putenv random setenv strstr strtod strtol strtoul; do
culprit=libiberty/$i.c
rm $culprit
touch $culprit
done




>> - add linux-arm.config
>>
>> Some known issues:
>> a) musl version as configured is at 0.9.2 but with arm it won't boot with
>> 0.9.2 (busybox segfaults), you need to get the latest git master, make a
>> tarball out of it and rename it to musl-0.9.2.tar.gz in the "src"
>> directory.
> Do you know which bugfix solved this? It would be nice to mention in
> the 0.9.3 release notes/announcement (hopefully in the next few days).
>

https://github.com/rofl0r/sabotage/blob/master/pkg/musl

patch -p1 < "$K/musl-0.9.2-arm_init.patch" || exit 1
patch -p1 < "$K/musl-0.9.2-arm_sigsetjmp.patch" || exit 1
patch -p1 < "$K/musl-0.9.2-longjmp.patch" || exit 1
patch -p1 < "$K/musl-0.9.2-rtld.patch" || exit 1
patch -p1 < "$K/musl-0.9.2-sendmsg.patch" || exit 1
patch -p1 < "$K/musl-0.9.2-getservbyname.patch" || exit 1


busybox needs another fix, as described also on the musl wiki FAQ
https://github.com/rofl0r/sabotage/blob/master/pkg/busybox

# --sort-section renders busybox unusable on ARM: 
http://sourceware.org/bugzilla/show_bug.cgi?id=14156
sed -i 's,SORT_SECTION=,SORT_SECTION= #,' scripts/trylink





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bootstrap-linux patches for cross compilation to arm
  2012-07-28 12:54 ` Rich Felker
  2012-07-28 13:54   ` John Spencer
@ 2012-07-28 14:42   ` James Bond
  2012-07-28 20:37     ` Rich Felker
  1 sibling, 1 reply; 7+ messages in thread
From: James Bond @ 2012-07-28 14:42 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 3102 bytes --]

On Sat, Jul 28, 2012 at 10:54 PM, Rich Felker <dalias@aerifal.cx> wrote:

> On Sat, Jul 28, 2012 at 10:18:43PM +1000, James Bond wrote:
> > - add host_configargs="LIBS=-lc" and --with-stage1-libs=-lc for native
> > gcc/binutils compile so that they don't pull in *printf from libiberty
> > (which segfaults).
>
> Do you have any idea why this is needed? Are they always pulled in
> (and just don't segfault on other archs), or is pulling them in
> arm-specific?
>

This seems to be a problem in arm only. Unpatched bootstrap will build
cross x86-64 --> x86 rootfs and native toolchain fine, no problem.

The problem so far looks like this: some of the helper functions in libgcc
raises exceptions; and the code for these exceptions in libc (also musl).
But when using static libc, libc is linked in first before libgcc, thus
libgcc's dependencies on libc can't be resolved unless we add "-lc" at the
end.

One can easily exhibit the same problem using musl-cross too - just make
sure that musl-cross build a toolchain with static musl libc (instead of
the default dynamic libc). Then compile "#include <stdio.h> void main() {
printf("hello %d\n"); }" with "arm-linux-musleabi -o hello hello.c" --- you
will get a host of unsatisfied dependency errors for raise, abort, etc
basically the stack unwinding stuff. The problem is down the chain printf
uses division, and division is done in libgcc and can raise exception, thus
the need for the stack unwinding code. To get it to compile, I found that I
need to do "arm-linux-musleabi -o hello hello.c -lc" instead.

Note the dependency complains is about raise/abort - not about printf, so
it indicates (to me at least) that libc did get pull in earlier, but
somehow gcc missed that it also needs to bring in the stack unwinding code.

The end result is without adding those parameters, libiberty configure will
fail to detect that musl has *printf (because compilation fails), and thus
pulls in its own version (which crash but that's totally out of topic
here).

Those host_configargs and --with-stage1-libs is a hack to get gcc/binutils
configure test programs to compile so that libibery doesn't pull in more
than what is needed.


>
> > - add linux-arm.config
> >
> > Some known issues:
> > a) musl version as configured is at 0.9.2 but with arm it won't boot with
> > 0.9.2 (busybox segfaults), you need to get the latest git master, make a
> > tarball out of it and rename it to musl-0.9.2.tar.gz in the "src"
> > directory.
>
> Do you know which bugfix solved this? It would be nice to mention in
> the 0.9.3 release notes/announcement (hopefully in the next few days).
>

Thanks. I tested with commit  06650b968461b72d5eb44063dd68c176be330372
which is rather ancient in musl reckoning, it's the one with all John's
patches merged in. I'd do a test with a more recent commit and get back to
you.


>
> > This is my first post to the mailing list, so you feel this kind of stuff
> > is out of topic, my apology and lesson learnt.
>
> Welcome to the list. This type of contribution to the list is
> perfectly acceptable.
>

Thank you.

cheers,
James

[-- Attachment #2: Type: text/html, Size: 4018 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bootstrap-linux patches for cross compilation to arm
  2012-07-28 14:42   ` James Bond
@ 2012-07-28 20:37     ` Rich Felker
  2012-07-30  1:14       ` James Bond
  0 siblings, 1 reply; 7+ messages in thread
From: Rich Felker @ 2012-07-28 20:37 UTC (permalink / raw)
  To: musl

On Sun, Jul 29, 2012 at 12:42:21AM +1000, James Bond wrote:
> On Sat, Jul 28, 2012 at 10:54 PM, Rich Felker <dalias@aerifal.cx> wrote:
> 
> > On Sat, Jul 28, 2012 at 10:18:43PM +1000, James Bond wrote:
> > > - add host_configargs="LIBS=-lc" and --with-stage1-libs=-lc for native
> > > gcc/binutils compile so that they don't pull in *printf from libiberty
> > > (which segfaults).
> >
> > Do you have any idea why this is needed? Are they always pulled in
> > (and just don't segfault on other archs), or is pulling them in
> > arm-specific?
> >
> 
> This seems to be a problem in arm only. Unpatched bootstrap will build
> cross x86-64 --> x86 rootfs and native toolchain fine, no problem.
> 
> The problem so far looks like this: some of the helper functions in libgcc
> raises exceptions; and the code for these exceptions in libc (also musl).
> But when using static libc, libc is linked in first before libgcc, thus
> libgcc's dependencies on libc can't be resolved unless we add "-lc" at the
> end.

Are you sure this is how the workaround is working? Adding -lc is most
likely to take place at the beginning, not the end. Default libs
provided by the compiler come last.

> One can easily exhibit the same problem using musl-cross too - just make
> sure that musl-cross build a toolchain with static musl libc (instead of
> the default dynamic libc). Then compile "#include <stdio.h> void main() {
> printf("hello %d\n"); }" with "arm-linux-musleabi -o hello hello.c" --- you
> will get a host of unsatisfied dependency errors for raise, abort, etc
> basically the stack unwinding stuff. The problem is down the chain printf
> uses division, and division is done in libgcc and can raise exception, thus
> the need for the stack unwinding code. To get it to compile, I found that I
> need to do "arm-linux-musleabi -o hello hello.c -lc" instead.

This is stupid; there's no reason for the division to raise signals or
generate exceptions. Integer division by zero results in undefined
behavior, so libgcc can just do nothing special when it happens. Or it
could just execute an instruction that will raise a synchronous signal
(like an illegal opcode) rather than making library calls.

Floating point division by zero has well-defined results and raises a
floating point exception on implementations that support floating
point exceptions, but ARM EABI does not support them, and therefore
there's nothing special to be done (and even if there were, it would
not involve signals or C++ exceptions, just raising flags).

It would be really nice to fix this issue at the gcc level since it's
significantly bloating applications with code that do not, and should
not, need.

> The end result is without adding those parameters, libiberty configure will
> fail to detect that musl has *printf (because compilation fails), and thus
> pulls in its own version (which crash but that's totally out of topic
> here).

I see. That makes sense.

Rich


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bootstrap-linux patches for cross compilation to arm
  2012-07-28 20:37     ` Rich Felker
@ 2012-07-30  1:14       ` James Bond
  2012-07-30  4:21         ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: James Bond @ 2012-07-30  1:14 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2041 bytes --]

On Sun, Jul 29, 2012 at 6:37 AM, Rich Felker <dalias@aerifal.cx> wrote:

> Are you sure this is how the workaround is working? Adding -lc is most
> likely to take place at the beginning, not the end. Default libs
> provided by the compiler come last.
>

If I put that the beginning it won't work. I'm not sure how it works (the
previous explanation is just my guess - I should have said so earlier) but
it does solve problem - by doing this the compilation works and thus
libiberty configure detects *printf and uses musl's version correctly.


> This is stupid; there's no reason for the division to raise signals or
> generate exceptions. Integer division by zero results in undefined
> behavior, so libgcc can just do nothing special when it happens. Or it
> could just execute an instruction that will raise a synchronous signal
> (like an illegal opcode) rather than making library calls.
>
> Floating point division by zero has well-defined results and raises a
> floating point exception on implementations that support floating
> point exceptions, but ARM EABI does not support them, and therefore
> there's nothing special to be done (and even if there were, it would
> not involve signals or C++ exceptions, just raising flags).
>
> It would be really nice to fix this issue at the gcc level since it's
> significantly bloating applications with code that do not, and should
> not, need.
>

Agreed.

A few people have been hit by this problem, I found at least two here:
- earlier problem (2009) with proposed hack
http://gcc.gnu.org/ml/gcc-help/2009-10/msg00332.html
- more recent problem (2012) with proposed patches
http://comments.gmane.org/gmane.comp.gcc.help/41025

The patch involves disabling exception in libgcc's libunwind. However I'm
not qualified to judge the correctness or suitability of these patches for
general purpose as they are targetting bare metal, while for our case we
are targetting musl.

BTW - Re-run bootstrap with the latest musl git master (as of yesterday)
and all seems to work fine.

cheers
James

[-- Attachment #2: Type: text/html, Size: 2764 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bootstrap-linux patches for cross compilation to arm
  2012-07-30  1:14       ` James Bond
@ 2012-07-30  4:21         ` Rich Felker
  0 siblings, 0 replies; 7+ messages in thread
From: Rich Felker @ 2012-07-30  4:21 UTC (permalink / raw)
  To: musl

On Mon, Jul 30, 2012 at 11:14:46AM +1000, James Bond wrote:
> > This is stupid; there's no reason for the division to raise signals or
> > generate exceptions. Integer division by zero results in undefined
> >  [...]
> 
> Agreed.
> 
> A few people have been hit by this problem, I found at least two here:
> - earlier problem (2009) with proposed hack
> http://gcc.gnu.org/ml/gcc-help/2009-10/msg00332.html
> - more recent problem (2012) with proposed patches
> http://comments.gmane.org/gmane.comp.gcc.help/41025
> 
> The patch involves disabling exception in libgcc's libunwind. However I'm
> not qualified to judge the correctness or suitability of these patches for
> general purpose as they are targetting bare metal, while for our case we
> are targetting musl.

The patch seems correct or at least suitable as a workaround. It looks
like this is a bug in gcc's code generation for arm; with exceptions
enabled, it seems to be generating code to throw an exception for
division by zero. There's no reason this should be done; integer
division by zero is UB not an exception you can catch and handle (even
in C++).

Rich


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-30  4:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-28 12:18 bootstrap-linux patches for cross compilation to arm James Bond
2012-07-28 12:54 ` Rich Felker
2012-07-28 13:54   ` John Spencer
2012-07-28 14:42   ` James Bond
2012-07-28 20:37     ` Rich Felker
2012-07-30  1:14       ` James Bond
2012-07-30  4:21         ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).