blob: 123ba966ece3d63bd87514376d03d992174455b8 [file] [log] [blame]
Daniel Fandrich0a428602011-07-19 08:10:05 +02001#!/bin/sh
2# Build Busybox against Android's bionic
3# Originally by Dan Fandrich
4#
Denys Vlasenkof23f7852011-09-09 18:07:38 +02005# Configure with "make android_defconfig"
6#
Daniel Fandrich0a428602011-07-19 08:10:05 +02007# This file has been tested on Android Froyo (the lack of ttyname_r in
Denys Vlasenkof23f7852011-09-09 18:07:38 +02008# the android libc must be patched around) and Gingerbread.
Daniel Fandrich0a428602011-07-19 08:10:05 +02009
10# Point this to the Android root directory; it's used in the defconfig CFLAGS
11export A="$HOME/android"
12
13# Android product being built
14P=zoom2
15
16# Toolchain version in use by this version of Android
17GCCVER=4.4.3
18
19export PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-$GCCVER/bin:$PATH"
20
21# Set the linker flags; compiler flags are in the defconfig file
22if 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"
26else
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"
30fi
31
Denys Vlasenkoe0ddb652015-04-14 14:15:15 +020032# It's possible with newer version
33# you need to use CFLAGS_busybox instead of EXTRA_LDFLAGS below:
Daniel Fandrich0a428602011-07-19 08:10:05 +020034make EXTRA_LDFLAGS="$LDFLAGS" LDLIBS="$LDLIBS" "$@"