Original URL: http://blog.csdn.net/mliubing2532/article/details/7567164
If you only need to modify the contents of one module, but do make every time, and wait a long time. Using the module to compile, that only need to be in the directory of your module or its sub-directory, the execution of MM, you can compile a separate apk, so not fast!
BUILD/ENVSETUP.SH provides several useful shell commands, using $.build/envsetup.sh (note number) or $sourcebuild/envsetup.sh to be introduced into the shell environment. The following is organized and summarized. In particular, envsetup.sh also introduces vendorsetup.sh scripts in vendor/and device/directory.command-the function in envsetup.sh
function Help () # Display assistance information
function Get_abs_build_var () # Get absolute variables
function Get_build_var () # Get absolute variables
function check_product () # Check Product
function check_variant () # Check variables
function setpaths () # Set file path
function Printconfig () # Print configuration
function set_stuff_for_environment () # Setting environment variables
function Set_sequence_number () # Set Ordinal
function Settitle () # Set Caption
function Choosetype () # Setting type
function chooseproduct () # Set Product
function Choosevariant () # Set variant
function tapas () # Functions with Choosecombo
function Choosecombo () # Set compilation parameters
function Add_lunch_combo () # Add Lunch Project
function Print_lunch_menu () # Print lunch list
function lunch () # config Lunch
function m () #make from top is equivalent to executing make under ics/, compiling the entire Android source code
function Findmakefile () # Find Makefile
function mm () #make The current directory is compiled from
function mmm () #make the supplied directories start compiling from the provided path
function Croot () # Back to the root directory
function cproj () #改变当前路径到最近的还有Android The grandparent path of the. mk file.
function pid ()
function Systemstack ()
function Gdbclient ()
function Jgrep () #查找java文件
function Cgrep () #查找c/cpp file
function Resgrep ()
function Tracedmdump ()
function Runhat ()
function Getbugreports ()
function Startviewserver ()
function Stopviewserver ()
function isviewserverstarted ()
function SmokeTest ()
function Runtest ()
function Godir () # jumps to the specified directory
1, three m meaning:
Here's what you see in Help
-M:makes from the top of the tree.
-Mm:builds all of the modules in the current directory.
-Mmm:builds all of the modules in the supplied directories.
M, it's obviously make.
MM, when compiling a single module can be used in the current directory, if the current path is the top level of the code tree, the MM equivalent to make. If it is deep, measuring mm is equivalent to one_shot_makefile= $M make-c $T files[email protected]$M findmakefile found Android.mk, $T is the top-level path of the code tree, Files is the phony goal defined in MAIN.MK, which is the modules and auxiliary instructions TXT file that all Android needs to compile in the context of the $m corresponding directory.
MMM can be used in the Android directory, given the path of the package, MM will make the corresponding package.
For example, MMM package/apps/calculator croot changes the current path to the top level of the code tree. Cproj changes the current path to the most recent grandparent path of the Android.mk file. The PID uses the ADB Shell PS command to list the PID of the process that specifies the name on the phone. Usage:pid <YourName>
Specific steps:
1) Open the ~/.baserc file, and add the source ~/i850/build/envsetup.sh. Add yourself to the path where the file is located,
This eliminates the need to reference this file each time you start a new terminal to execute the MM command (this step is important and must be added to the user environment variable).
2) After completing Step 1, you can execute the MM in your module freely, to use other quick commands, you can view the envsetup.sh file, such as Cgrep,jgrep,resgrep in different types of files to make the corresponding query. and M,mmm and so on.
3) You can also use ADB push to push your apk to the emulator or phone terminal, or you can generate a new system.img from the project root directory via Make-snod.
2, modify the APK application: The application in the packages can be compiled separately if modified. Execute first
$. Build/envsetup.sh #初始化
$mmm packages/providers/contactsprovider/
# #用mm/mmm to compile the generated. APK will not be packaged into system.img, we will need to manually package the system folder as system.img via make Snod
# #可以使用make Snod the module to system.img, or you can use the ADB install *.apk
Note: Compiled by MMM packages/providers/contactsprovider/apk in Out/target/product/generic/system/app
Install the apk you just modified with the ADB install out/target/product/generic/system/app/xxx.apk to see what you have changed on the emulator.
ADB push way in:
adb shell Mount-o rw,remount-t ext3/dev/block/mmcblk0p2/system mount and get write permission
ADB push Xxx.apk/system/app
3. Modify the framework: if modified in Contacts.java, the framework must be recompiled. Execute first
$ . Build/envsetup.sh #初始化
#网上有的说要执行 make Update-api, you can actually compile the modified framework into the SDK by directly make PRODUCT-SDK-SDK. #编译framework后, those modified apps can no longer be compiled separately. 4-6 minutes
$ make product-sdk-sdk #重新生成SDK 10-20 minutes.
"Go" Android source build/envsetup.sh Learn notes