Android codebase are very big, compile once will take a lot of time, if Preloader/lk/bootimage is OK, but Android words are very long.
In fact, this compilation time can be further shortened!
1. Removal of Modules_to_check
(1). Android By default, all modules will be compiled (regardless of need), this is somewhat redundant, can be modified by the compilation system does not compile which unused modules
(2). Method of modification: ALPS/BUILD/CORE/MAIN.MK
Files:prebuilt \
$ (modules_to_install) \
$ (Modules_to_check) \
$ (Installed_android_info_txt_target)
Modified to:
Files:prebuilt \
$ (modules_to_install) \
$ (Installed_android_info_txt_target)
(3). In the case of a UBI NAND file system project (such as the Alps/build/core/makefile NAND project), you need to:
$ (Installed_recoveryimage_target): $ (MKBOOTFS) $ (mkbootimg) $ (minigzip) \
$ (installed_ramdisk_target) \
$ (installed_bootimage_target) \
$ (recovery_binary) \
$ (RECOVERY_INITRC) $ (recovery_kernel) \
$ (installed_2ndbootloader_target) \
$ (Recovery_build_prop) $ (recovery_resource_deps) \
$ (recovery_fstab) \
$ (recovery_gzip) $ (Recovery_sec_ko) \
$ (Recovery_install_ota_keys)
The previous add:
Ifeq ($ (target_userimages_use_ubifs), true)
$ (Installed_recoveryimage_target): $ (Recovery_ubiformat)
endif
Otherwise the compilation will fail!
(4). Modified Android compile time reduced 16%~18% (data for reference only)
(5). Google has already been applied by default in version 4.3 of this method.
(6). Only works for new, but because there are no modules to compile, it saves time and saves disk space (saving intermediate files in the Out directory).
2. Turn on Android CCache
(1). CCache is Google's default store in the CodeBase tool, for ccache function can go to the web search data.
(2). Set the cache size (this step must be done!!) ), a codebase need about 5G of space, if your compilation environment has 5 codebase in use, then need 25G of space. Setting the small will also cause the compilation time to extend!!
[1]. GB Version: Prebuilt/linux-x86/ccache/ccache-m 25G
[2]. JB Version: Prebuilts/misc/linux-x86/ccache/ccache-m 25G
(3). How to open:
[1]. Add use_ccache=1 to the command line:./mk-o=use_ccache=1 N. If the user version of Ccahce is turned on, you can do this:./mk-o=use_ccache=1,target_build_variant=user N.
[2]. Suggestion: Add to environment variable (other way also): Modify ALPS/MAKEMTK, create a new line after #!/usr/bin/perl, fill in $env{"use_ccache"} = 1;
(4). The 1th compilation will take a little more time to build the cache, then enjoy the benefits of CCache, reducing all compile time using gcc, about 25%~30%.
[1]. You can view the cache information through ccache-s, if full, you can use Ccache-c to clear all. Compiling the new codebase in full state will remove the old one, which will reduce the efficiency, so the cache must be set correctly!
(6). It works on Mm/new/remake Android.
3. Open Kernel CCache
(1). The above ccache is only valid for compiling Android, kernel section needs additional settings
(2) in the. alps/kernel/makefile file
S = $ (cross_compile) as
LD = $ (cross_compile) LD.BFD
CC = $ (cross_compile) gcc
CPP = $ (CC)-E
Add later:
Ifneq ($ (use_ccache),)
Export Ccache_compilercheck: = Content
Export ccache_sloppiness: = Time_macros,include_file_mtime,file_macro
Export Ccache_basedir: =/
CCache: = $ (Strip $ (wildcard $ (PWD)/. /prebuilts/misc/linux-x86/ccache/ccache))
Ifdef CCache
Ifneq ($ (CCache), $ (FirstWord $ (CC)))
CC: = $ (CCache) $ (CC)
endif
CCache =
endif
endif
(3). This also allows the CCache to shorten the compilation time when compiling kernel.
Increase Android Compilation speed