Daniel Fandrich | 0a42860 | 2011-07-19 08:10:05 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # Build Busybox against Android's bionic |
| 3 | # Originally by Dan Fandrich |
| 4 | # |
Denys Vlasenko | f23f785 | 2011-09-09 18:07:38 +0200 | [diff] [blame] | 5 | # Configure with "make android_defconfig" |
| 6 | # |
Daniel Fandrich | 0a42860 | 2011-07-19 08:10:05 +0200 | [diff] [blame] | 7 | # This file has been tested on Android Froyo (the lack of ttyname_r in |
Denys Vlasenko | f23f785 | 2011-09-09 18:07:38 +0200 | [diff] [blame] | 8 | # the android libc must be patched around) and Gingerbread. |
Daniel Fandrich | 0a42860 | 2011-07-19 08:10:05 +0200 | [diff] [blame] | 9 | |
| 10 | # Point this to the Android root directory; it's used in the defconfig CFLAGS |
| 11 | export A="$HOME/android" |
| 12 | |
| 13 | # Android product being built |
| 14 | P=zoom2 |
| 15 | |
| 16 | # Toolchain version in use by this version of Android |
| 17 | GCCVER=4.4.3 |
| 18 | |
| 19 | export PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-$GCCVER/bin:$PATH" |
| 20 | |
| 21 | # Set the linker flags; compiler flags are in the defconfig file |
| 22 | if grep "^CONFIG_STATIC=y" .config >/dev/null ; then |
| 23 | # Static linking |
| 24 | LDFLAGS="-static -Xlinker -z -Xlinker muldefs -nostdlib $A/out/target/product/$P/obj/lib/crtbegin_static.o $A/out/target/product/$P/obj/lib/crtend_android.o -L$A/out/target/product/$P/obj/lib -L$A/out/target/product/$P/obj/STATIC_LIBRARIES/libm_intermediates -L$A/out/target/product/$P/obj/STATIC_LIBRARIES/libc_intermediates" |
| 25 | LDLIBS="m c gcc" |
| 26 | else |
| 27 | # Dynamic linking |
| 28 | LDFLAGS="-Xlinker -z -Xlinker muldefs -nostdlib -Bdynamic -Xlinker -T$A/build/core/armelf.x -Xlinker -dynamic-linker -Xlinker /system/bin/linker -Xlinker -z -Xlinker nocopyreloc -Xlinker --no-undefined $A/out/target/product/$P/obj/lib/crtbegin_dynamic.o $A/out/target/product/$P/obj/lib/crtend_android.o -L$A/out/target/product/$P/obj/lib" |
| 29 | LDLIBS="dl m c gcc" |
| 30 | fi |
| 31 | |
| 32 | make EXTRA_LDFLAGS="$LDFLAGS" LDLIBS="$LDLIBS" "$@" |