android-build 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. # Build Busybox against Android's bionic
  3. # Originally by Dan Fandrich
  4. #
  5. # Configure with android_defconfig
  6. # This file has been tested on Android Froyo (the lack of ttyname_r in
  7. # the must be patched around) and Gingerbread.
  8. # Point this to the Android root directory; it's used in the defconfig CFLAGS
  9. export A="$HOME/android"
  10. # Android product being built
  11. P=zoom2
  12. # Toolchain version in use by this version of Android
  13. GCCVER=4.4.3
  14. export PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-$GCCVER/bin:$PATH"
  15. # Set the linker flags; compiler flags are in the defconfig file
  16. if grep "^CONFIG_STATIC=y" .config >/dev/null ; then
  17. # Static linking
  18. 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"
  19. LDLIBS="m c gcc"
  20. else
  21. # Dynamic linking
  22. 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"
  23. LDLIBS="dl m c gcc"
  24. fi
  25. make EXTRA_LDFLAGS="$LDFLAGS" LDLIBS="$LDLIBS" "$@"