Skip to content

Commit

Permalink
[MIPS] Add Support for Additional MIPS ARCH
Browse files Browse the repository at this point in the history
Doubled the numnber of .config variables modified by the Makefile.
Thanks to Brendan Kirby for his help on the sed overuse of the '|' token.

Signed-off-by: Pete Delaney <[email protected]>
Signed-off-by: Tias Guns <[email protected]>
  • Loading branch information
Pete Delaney authored and tias committed Jan 23, 2013
1 parent 0643267 commit 331fc61
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,35 @@
# Point to your android-ndk installation
ANDROID_NDK="/opt/android-ndk"

# Pick your target ARCH (arm,mips)
ARCH=arm

# Config to use
CONFIG_FILE="./android_ndk_stericson-like"
#CONFIG_FILE="android_ndk_config-w-patches" # contains more


# Following options should not be changed unless you know better
BB_DIR="busybox-git"
SYSROOT="$(ANDROID_NDK)/platforms/android-9/arch-arm"
GCC_PREFIX="$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-"
BB_DIR="busybox-git.$(ARCH)"
SYSROOT="$(ANDROID_NDK)/platforms/android-9/arch-$(ARCH)"

#
# ARM SETUP
#
ifeq ($(ARCH),arm)
GCC_PREFIX="$(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-"
EXTRA_CFLAGS="-DANDROID -D__ANDROID__ -DSK_RELEASE -nostdlib -march=armv7-a -msoft-float -mfloat-abi=softfp -mfpu=neon -mthumb -mthumb-interwork -fpic -fno-short-enums -fgcse-after-reload -frename-registers"
EXTRA_LDFLAGS="-Xlinker -z -Xlinker muldefs -nostdlib -Bdynamic -Xlinker -dynamic-linker -Xlinker /system/bin/linker -Xlinker -z -Xlinker nocopyreloc -Xlinker --no-undefined ${SYSROOT}/usr/lib/crtbegin_dynamic.o ${SYSROOT}/usr/lib/crtend_android.o"
endif

#
# MIPS SETUP
#
ifeq ($(ARCH),mips)
GCC_PREFIX="$(ANDROID_NDK)/toolchains/mipsel-linux-android-4.4.3/prebuilt/linux-x86/bin/mipsel-linux-android-"
EXTRA_CFLAGS="-DANDROID -D__ANDROID__ -DSK_RELEASE -fpic -fno-short-enums -fgcse-after-reload -frename-registers -U_MIPS_SIM -D_MIPS_SIM=_MIPS_SIM_NABI32"
EXTRA_LDFLAGS="-Xlinker -z -Xlinker muldefs -nostdlib -Bdynamic -Xlinker -dynamic-linker -Xlinker /system/bin/linker -Xlinker -z -Xlinker nocopyreloc -Xlinker --no-undefined ${SYSROOT}/usr/lib/crtbegin_dynamic.o ${SYSROOT}/usr/lib/crtend_android.o"
endif


all: busybox-git config patches build
Expand All @@ -31,10 +51,6 @@ config:
echo "Error: config file '$(CONFIG_FILE)' does not exist!" \
exit 1; \
fi
cat $(CONFIG_FILE) | \
sed "s|\(CONFIG_CROSS_COMPILER_PREFIX=\).*|\1\"$(GCC_PREFIX)\"|" | \
sed "s|\(CONFIG_SYSROOT=\).*|\1\"$(SYSROOT)\"|" \
> $(BB_DIR)/.config

patches:
if test -f $(BB_DIR)/android-busybox-ndk-patched; then \
Expand All @@ -46,7 +62,17 @@ patches:
done; \
touch "$(BB_DIR)/android-busybox-ndk-patched"; \
fi

@echo "EXPORT CONFIG_FILE=$(CONFIG_FILE)"
@echo "EXPORT GCC_PREFIX=$(GCC_PREFIX)"
@echo "EXPORT SYSROOT=$(SYSROOT)"
@echo "EXPORT EXTRA_CFLAGS=$(EXTRA_CFLAGS)"
@echo "EXPORT EXTRA_LDFLAGS=$(EXTRA_LDFLAGS)"
cat $(CONFIG_FILE) | \
sed "s%\(CONFIG_CROSS_COMPILER_PREFIX=\).*%\1\"$(GCC_PREFIX)\"%" | \
sed "s%\(CONFIG_SYSROOT=\).*%\1\"$(SYSROOT)\"%" | \
sed "s%\(CONFIG_EXTRA_CFLAGS=\).*%\1\"$(EXTRA_CFLAGS)\"%" | \
sed "s%\(CONFIG_EXTRA_LDFLAGS=\).*%\1\"$(EXTRA_LDFLAGS)\"%" \
> $(BB_DIR)/.config
build-check:
if test ! -d $(ANDROID_NDK); then \
echo "Error: edit 'Makefile' and point 'ANDROID_NDK=' to your android ndk installation\n(currently: $(ANDROID_NDK))"; exit 1; \
Expand Down

0 comments on commit 331fc61

Please sign in to comment.