Android學習第二篇;模塊化編譯

在學習android源碼的過程中,肯定需要修改源碼並查看效果

如果每次都make則太費時

此時使用mmm命令

假設修改了frameworks/base中某個文件

首先mmm frameworks/base/

再make snod

再emulator就可以看出效果了,但是這個方法只能在第一次make之後才能發揮作用,用完之後就不產生效果了。目前正在找其他辦法解決

解決明明修改了代碼,在mmm模塊化編譯時就是無法將編譯的內容更新到系統上的問題

首先明確修改的代碼位置

比如,修改AndroidRuntime.cpp在frameworks/base/core/jin/AndroidRuntime.cpp

進入該目錄,執行

mm

退回根目錄,執行

make snod

再執行emulator

可以看到效果,親測可行

列出部分命令

  • croot - change directory to the top of the tree
  • m - execute 'make' from the top of the tree (even if your current directory is somewhere else)
  • mm - builds all of the modules in the current directory
  • mmm <dir1> ... - build all of the modules in the supplied directories
  • cgrep <pattern> - grep on all local C/C++ files
  • jgrep <pattern> - grep on all local Java files
  • resgrep <pattern> - grep on all local res/*.xml files
  • godir <filename> - go to the directory containing a file

  • make sdk - build the tools that are part of an SDK (adb, fastboot, etc.)
  • make snod - build the system image from the current software binaries
  • make services
  • make runtime
  • make droid - make droid is the normal build.
  • make all - make everything, whether it is included in the product definition or not
  • make clean - remove all built files (prepare for a new build). Same as rm -rf out/<configuration>/
  • make modules - shows a list of submodules that can be built (List of all LOCAL_MODULE definitions)
  • make <local_module> - make a specific module (note that this is not the same as directory name. It is the LOCAL_MODULE definition in the Android.mk file)
  • make clean-<local_module> - clean a specific module
  • make bootimage TARGET_PREBUILT_KERNEL=/path/to/bzImage - create a new boot image with custom bzImage

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章