修改Android作業系統
首次編譯
如果用Ubuntu 18.04編譯Android 7.1.2原始碼,需要在make
前執行export LC_ALL=C
。
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
增加JVM堆大小。然後重啟jack。
編譯單獨模組
執行. build/envsetup.sh之後,輸入hmm可以看幫助
$ 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. - 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. - mmma:Builds all of the modules in the supplied directories, and their dependencies. - provision: Flash device with all required partitions. Options will be passed on to fastboot. - 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. - mangrep:Greps on all local AndroidManifest.xml files. - mgrep:Greps on all local Makefiles files. - sepgrep:Greps on all local sepolicy files. - sgrep:Greps on all local source files. - godir:Go to the directory containing a file. Environment options: - SANITIZE_HOST: Set to 'true' to use ASAN for all host modules. Note that ASAN_OPTIONS=detect_leaks=0 will be set by default until the build is leak-check clean. Look at the source to view more functions. The complete list is: addcompletions add_lunch_combo build_build_var_cache cgrep check_product check_variant choosecombo chooseproduct choosetype choosevariant core coredump_enable coredump_setup cproj croot destroy_build_var_cache findmakefile get_abs_build_var getbugreports get_build_var getdriver getlastscreenshot get_make_command getprebuilt getscreenshotpath getsdcardpath gettargetarch gettop ggrep godir hmm is isviewserverstarted jgrep key_back key_home key_menu lunch _lunch m make mangrep mgrep mm mma mmm mmma pez pid printconfig print_lunch_menu provision qpid rcgrep resgrep runhat runtest sepgrep set_java_home setpaths set_sequence_number set_stuff_for_environment settitle sgrep smoketest stacks startviewserver stopviewserver systemstack tapas tracedmdump treegrep
似乎沒有網上的官方文件提供以上內容,除了原始碼 。
既然編譯單獨模組,就使用mm命令。經實測,似乎必須指定模組目錄
WORKING_DIRECTORY$ mm art
而不是
WORKING_DIRECTORY/art$ mm
用後一個方法似乎某些配置檔案不會匯入,程式碼樣式會出錯。待探究。
重新打包
$ make snod
怎麼知道這個命令呢?
編譯結果放在WORKING_DIRECTORY/out/target/product/generic_x86,其中generic_x86是以前選擇的lunch combo。
程式碼庫管理
在一個倉庫裡刪除某些標籤
git tag –list ‘android-*’ | xargs -I % git tag -d %
獲取指定的標籤
似乎要先獲取所有標籤,再刪除所有標籤,再獲取指定標籤。一定有比這更好的辦法。
git fetch fork refs/tags/android-7.1.2_r36
參考資料
shui1025701856.https://blog.csdn.net/shui1025701856/article/details/80497911 . . 2018-05-29 [2019-02-22]. Daemon369.編譯Android原始碼中的單獨模組 . . 2013-08-22 [2019-03-25]. 羅昇陽.如何單獨編譯Android原始碼中的模組. . 2011-06-24 [2019-03-25].