Wednesday, August 24, 2011

How to build common Linux utils for Android without using Android.mk

Ideally one should build his/her project as a part of AOSP (Android Open Source Project) using Android standard Makefile aka Android.mk. You can find many such examples in $AOSP/external/

This guide is meant for lazy people like me who doesn't want to use the above procedure to build small Linux debug utilities/binaries like devmem2, fbset etc for Android. It assumes that we have already built AOSP sources for a TARGET_PLATFORM.

# export ANDROID_ROOT= path_to_AOSP_sources

# export TARGET_PRODUCT= target_product_name

# $ANDROID_ROOT/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc -nostdlib -Wl,-dynamic-linker,/system/bin/linker $ANDROID_ROOT/out/target/product/$TARGET_PRODUCT/obj/lib/crtbegin_dynamic.o $ANDROID_ROOT/out/target/product/$TARGET_PRODUCT/obj/lib/crtend_android.o -L$ANDROID_ROOT/out/target/product/$TARGET_PRODUCT/obj/lib -lc -ldl -fno-short-enums -I$ANDROID_ROOT/bionic/libc/include -I$ANDROID_ROOT/bionic/libc/arch-arm/include -I$ANDROID_ROOT/bionic/libc/kernel/common -I$ANDROID_ROOT/bionic/libc/kernel/arch-arm -o devmem2 devmem2.c

No comments:

Post a Comment