Removing AOSP apps from build

后端 未结 1 415
半阙折子戏
半阙折子戏 2020-12-16 02:02

First, I\'m trying to build an Android platform from the Android source code without stock apps like LiveWallpapers, Calendar, Contacts, Calculator, Phone, Settings, etc.

相关标签:
1条回答
  • 2020-12-16 02:19

    I think that those modules (packages) may be included by other apps, being specified in LOCAL_REQUIRED_MODULES in .mk files. I would try to figure out package names of the modules, then search through all .mk files.

    Instead of modifying bunch of .mk files in AOSP in many folders, you can add a new module, a stub, and disable modules in its Android.mk using LOCAL_OVERRIDES_PACKAGES. If a module still appear in target, you'll probably need to add to LOCAL_OVERRIDES_PACKAGES another modules which added undesired packages via LOCAL_REQUIRED_MODULES.

    Sorry I do not know a better way to do that.

    packages/apps folder holds most of applications .mk files, but you may need to check device, vendor and hardware folders too, in general case.

    ADDED: I've just discovered that envsetup.sh provides mgrep command to search in makefiles (including *.mk), so you can try this to find .mk referring DeskClock package:

    build@1c1b9d217b9d:~/android/cm12.1$ mgrep DeskClock
    ./packages/apps/DeskClock/Android.mk:20:LOCAL_PACKAGE_NAME := DeskClock
    ./packages/apps/DeskClock/tests/Android.mk:12:LOCAL_PACKAGE_NAME := DeskClockTests
    ./packages/apps/DeskClock/tests/Android.mk:14:LOCAL_INSTRUMENTATION_FOR := DeskClock
    ./build/target/product/core.mk:26:    DeskClock \
    

    So you see DeskClock is included into the build from core.mk

    Though mgrep command is not mentioned in help section of envsetup.sh, it is reported by 'hmm' command (help for envsetup.sh) - I quote it here to stimulate us to learn AOSP tools deeper )):

    build@1c1b9d217b9d:~/android/cm12.1$ hmm
    Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
    - lunch:   lunch <product_name>-<build_variant>
    - tapas:   tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user]
    - croot:   Changes directory to the top of the tree.
    - cout:    Changes directory to out.
    - m:       Makes from the top of the tree.
    - mm:      Builds all of the modules in the current directory, but not their dependencies.
    - mmm:     Builds all of the modules in the supplied directories, but not their dependencies.
               To limit the modules being built use the syntax: mmm dir/:target1,target2.
    - mma:     Builds all of the modules in the current directory, and their dependencies.
    - mmp:     Builds all of the modules in the current directory and pushes them to the device.
    - mmmp:    Builds all of the modules in the supplied directories and pushes them to the device.
    - mmma:    Builds all of the modules in the supplied directories, and their dependencies.
    - mms:     Short circuit builder. Quickly re-build the kernel, rootfs, boot and system images
               without deep dependencies. Requires the full build to have run before.
    - cgrep:   Greps on all local C/C++ files.
    - ggrep:   Greps on all local Gradle files.
    - jgrep:   Greps on all local Java files.
    - resgrep: Greps on all local res / *.xml files.
    - sgrep:   Greps on all local source files.
    - godir:   Go to the directory containing a file.
    - cmremote: Add git remote for CM Gerrit Review
    - cmgerrit: A Git wrapper that fetches/pushes patch from/to CM Gerrit Review
    - cmrebase: Rebase a Gerrit change and push it again
    - aospremote: Add git remote for matching AOSP repository
    - cafremote: Add git remote for matching CodeAurora repository.
    - mka:      Builds using SCHED_BATCH on all processors
    - mkap:     Builds the module(s) using mka and pushes them to the device.
    - cmka:     Cleans and builds using mka.
    - repolastsync: Prints date and time of last repo sync.
    - reposync: Parallel repo sync using ionice and SCHED_BATCH
    - repopick: Utility to fetch changes from Gerrit.
    - installboot: Installs a boot.img to the connected device.
    - installrecovery: Installs a recovery.img to the connected device.
    
    Look at the source to view more functions. The complete list is:
    mgrep                           cmka                            get_symbols_directory           lunch                           repopick
    sgrep                           cmrebase                        getbugreports                   m                               reposync
    treegrep                        cmremote                        getdriver                       make                            resgrep
    _lunch                          core                            getlastscreenshot               makerecipe                      runhat
    adb_get_product_device          coredump_enable                 getprebuilt                     mangrep                         runtest
    adb_get_traced_by               coredump_setup                  getscreenshotpath               mk_timer                        sepgrep
    add_lunch_combo                 cout                            getsdcardpath                   mka                             set_java_home
    aospremote                      cproj                           gettargetarch                   mm                              set_sequence_number
    breakfast                       croot                           gettop                          mma                             set_stuff_for_environment
    brunch                          ffffdclient                       ggrep                           mmm                             setpaths
    cafremote                       dopush                          godir                           mmma                            settitle
    cgrep                           eat                             hmm                             mms                             smoketest
    check_bash_version              findmakefile                    installboot                     omnom                           stacks
    check_product                   fixup_common_out_dir            installrecovery                 pez                             startviewserver
    check_variant                   gdbclient                       is                              pid                             stopviewserver
    choosecombo                     gdbclient_old                   isviewserverstarted             print_lunch_menu                systemstack
    chooseproduct                   gdbwrapper                      jgrep                           printconfig                     tapas
    choosetype                      get_abs_build_var               key_back                        qpid                            tracedmdump
    choosevariant                   get_build_var                   key_home                        repodiff
    cmgerrit                        get_make_command                key_menu                        repolastsync
    

    You may check implementation of mgrep in envsetup.sh to get ideas for new grep searches ))

    0 讨论(0)
提交回复
热议问题