How to build a part of Android AOSP?

后端 未结 3 1215
甜味超标
甜味超标 2021-02-01 22:32

I am trying to build my own libs and apps in external directory of the AOSP, but the problem is i have to run make each time and the make will compile/build whole the android.

相关标签:
3条回答
  • 2021-02-01 22:44

    A plain make invocation will not rebuild more than necessary, but even with a leaf library or binary even an incremental build can take a few minutes. If you only want to build your particular module you can look at the functions briefly documented at the top of build/envsetup.sh. Specifically, the m and mm shell functions should be useful as they only build one or more modules without caring about their dependencies and without even trying to read all Android.mk files found in the tree. Using them should speed up incremental builds significantly (but all dependencies must have been built at some point, i.e. they're only useful for incremental builds).

    build/envsetup.sh also defines a number of other shell functions that are useful for building the Android platform and working with its source code.

    0 讨论(0)
  • 2021-02-01 22:53

    To briefly address the more general case, mm is a useful command, but the location from which it should be run is not well documented - or more specifically, it is not always clear what is a "module".

    Let's say you have made a change to SystemUI, which is a specialized app that is key to the overall functionality of Android. This is part of the frameworks/base repository.

    If you just go to the frameworks/base directory, and execute mm it will not find anything to do - your changes will be ignored.

    To actually pick up your changes with mm you have to be in the directory where they reside - in this example, you would need to be in frameworks/base/packages/SystemUI. The appropriate location for other codebases will be different - but as a guess, you probably need to be where the Android.mk covering your changes resides.

    You can then either use the make snod target from the top of the tree to rebuild the system.img and flash it with fastboot, or use adb remount, adb push the new SystemUI.apk, and then adb shell "start; stop" to restart the Android framework.

    0 讨论(0)
  • 2021-02-01 22:56

    You can get list of all of the modules in your Android code with the following command:

    make modules
    

    To build any single module:

    make [modulename]
    
    0 讨论(0)
提交回复
热议问题