Building with AOSP
Building with Android Build System
Skip to the Quick Start section if you just want to build.
Android has invented it's own build system on top of make, which is intended to build things easier for a target that has different CPU architecture, and with some flexible configuration setting either defined in environment variable or the config file for different combination of build type.
However, people lacking with a large hard disk, fast speed network or fast enough machine may suffer from this not so common build system that we might get used to.
The default guideline for building a single piece of program say the adb tool or dalvikvm inside AOSP is to repo sync the whole repository and perform a full build. Although it maybe the fastest and simplest way, some people may just don't meet the storage space constraint while others may think that it's a total waste of storage space and bandwidth.
After struggling with the error messages day after day, the mysteries are resolved. Building with the Android Building System could be fun and joy with a known possible shortest path!
Visit the official site for a brief overview on Building System first.
Assume you have done the setup and fetched the code. Followings are the important keys to note:
- Use repo init to create the Makefile inside the root of the AOSP directory. Or use this file instead:
### DO NOT EDIT THIS FILE ### include build/core/main.mk ### DO NOT EDIT THIS FILE ###
Without this, the m, mm and mmm bash function won't work even you have executed '. build/envsetup.sh'.(The usage of dot in bash is equivalent to the 'source' command.)
- Download the snapshot of the prebuilt toolchain arm-eabi-4.4.0(or latest) from AOSP git would be small enough to build.(for linux x86 that I've tried)
- When you see the looped dependency of libhost and acp, try building projects together: 'mmm build/libs/host build/tools/acp'. (This is the 1st problem you will be stuck at warning no acp when building libhost while acp depends on libhost and vice versa!)
- When you see no target to build crtbegin_dynamic.o, try the same trick: 'mmm bionic/libc dalvik'.
- When you see no target to build xyz that is not the cases above, it's time to fetch and make along the dependency chain.
That's all! For sure there should be a static 'dependency list' for a given project but I have not managed to create it yet. Good luck!
- World C program using Android Toolchain. It uses agcc(tool chain wrapper written in Perl, probably the one that [mbm] has used too!)