Android source build/envsetup. Sh learning notes

Source: Internet
Author: User

If you only need to modify the content of a module, but you need to execute make every time, the last wait is a long time. To compile a module, you only need to execute mm in the directory or its subdirectory of your module to compile a separate APK!

Build/envsetup. Sh provides several useful shell commands, which can be introduced to the shell environment by using $. Build/envsetup. Sh (note point number) or $ sourcebuild/envsetup. Sh. The following is a summary. In particular, envsetup. Sh also introduces the vendorsetup. Sh script under the vendor/and device/directories. Command-that is, the function in envsetup. Sh

Function help () # display help information
Function get_abs_build_var () # obtain Absolute Variables
Function get_build_var () # obtain Absolute Variables
Function check_product () # Check Product
Function check_variant () # Check Variables
Function setpaths () # Set the file path
Function printconfig () # print the configuration
Function set_stuff_for_environment () # Set Environment Variables
Function set_sequence_number () # Set the serial number
Function settitle () # Set the title
Function choosetype () # Set Type
Function chooseproduct () # Set Product
Function choosevariant () # Set Variant
Function tapas () # functions the same as choosecombo
Function choosecombo () # Set compilation Parameters
Function add_lunch_combo () # Add a lunch project
Function print_lunch_menu () # print the lunch list
Function lunch () # configure lunch
Function M () # make from top is equivalent to executing make under ICs/and compiling the entire android source code
Function findmakefile () # Find makefile
Function mm () # make from current directory compile the current directory
Function Mmm () # Make the supplied directories to compile from the provided path
Function Croot () # Return to the root directory
Function cproj () # change the current path to the parent path of the latest Android. mk file.
Function PID ()
Function systemstack ()
Function gdbclient ()
Function jgrep () # Find a Java File
Function cgrep () # Find the C/CPP File
Function resgrep ()
Function tracedmdump ()
Function runhat ()
Function getbugreports ()
Function startviewserver ()
Function stopviewserver ()
Function isviewserverstarted ()
Function smoketest ()
Function runtest ()
Function godir () # Jump to the specified directory

1. Meaning of three M:

The following information is displayed 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, obviously make

Mm, which can be used in the current directory when compiling a single module. If the current path is the top layer of the code tree, mm is equivalent to make. For a deep layer, mm is equivalent to one_shot_makefile = $ M make-C $ t files $ @ $ m, which is the android file found by findmakefile. MK, $ T is the top-level path of the code tree, and files is main. phony defined in Mk
Goal is to complete all modules to be compiled by Android and auxiliary description TXT files within the directory of $ M.

Mmm can be used in the android directory. Given the package path, MM will make the corresponding package.

For example, mmm package/apps/calculator Croot changes the current path to the top layer of the code tree. Cproj changes the current path to the parent path of the latest Android. mk file. PID: Use the ADB shell ps command to list the PID of the process with the specified name on the mobile phone. Usage: PID <yourname>

Procedure:
1) Open ~ /Add the. baserc file to the source ~ /I850/build/envsetup. Sh. Add the path of your own file,

This eliminates the need to reference this file before starting a new terminal to execute the MM command (this step is very important and must be added to the user environment variable ).

2) After completing step 1, you can execute mm in your module at will. To use other quick commands, you can view envsetup. sh files, such as cgrep, jgrep, and resgrep, are queried in different types of files. And M, mmm, etc.

3) You can also use ADB push to push your APK to the simulator or mobile terminal, or generate a new system. img in the project root directory through make-Snod.

2. Modify the APK application: the application in packages can be compiled independently after modification. Run
$. Build/envsetup. Sh # Initialization
$ Mmm packages/providers/contactsprovider/
# The. APK compiled with mm/mmmwill not be packaged into system. IMG. You need to manually package the system folder as system. IMG through make Snod.
# You can use make Snod to package the module into system. IMG, or use ADB install *. APK to install the module.
Note: After you use Mmm packages/providers/contactsprovider/compiled apk in the out/target/product/generic/system/APP
In this case, use ADB install out/target/product/generic/system/APP/xxx.apk to install the APK you just modified and you will be able to see the modification effect on the simulator.

ADB push:

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 the framework is modified in contacts. Java, you must re-compile the framework. Run
$. Build/envsetup. Sh # Initialization
# If you want to execute make Update-API on the Internet, you can directly make product-SDK to compile the modified framework into the SDK. # After the framework is compiled, the modified applications do not need to be compiled separately. 4 ~ 6 minutes
$ Make product-SDK # regenerate SDK 10 ~ 20 minutes.

 


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.