Android 4.4 source code compilation process

Source: Internet
Author: User

The downloaded Android source code directory is as follows:


The size of the Code is 25.559 GB.


1. Build a system

The following commands are used to build the Android source code tree and apply them to all code branches, including the master branch. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + PGJyPgo8L3A + signature/Signature +/4sqxo6y/Signature + PGJyPgo8L3A + signature/CtcTD/Signature + signature + CjxwPjIus/Signature + Signature + 7t76zo6zXotLiv8nS1NPDobAuobHX1rf7wLS0 + szmc291cmNloaPI58/Co7o8L3A + cjxwp1_vcd4kphbyzsbjbgfzcz0 = "brush: java; "> $ source build/envsetup. sh
Or

$ . build/envsetup.sh

The latter short format is used more frequently in files.


3. Select a target

Use the lunch command to select which target to build. The exact configuration can be passed to the command as a parameter, as shown below:

$lunch aosp_arm-eng
The above example specifies the construction of a complete simulator, and all its debugging capabilities. After entering this command,



If there is no parameter after lunch, a directory will be used to prompt you to choose. As follows:


All BUILD goals are in the form of BUILD-BUILDTYPE where BUILD represents the combination of code names to indicate specific features, as shown below:


BUILDTYPE is as follows:


For more information about building and running on real hardware, see: http://source.android.com/source/building-devices.html


4. Build code

Using make to build everything, GNU make can process parallel tasks by using the-jN parameter. Here, N is specified based on the number of hardware cores of the computer used. Generally, N is 1 to 2 times the CPU core. For example, on a dual-5520 machine (two CPUs, each CPU has four cores and each core has two threads), the fastest build is to use make-j16 or make-j32.

$make -j4

5. Run

You can run the Android system built on the simulator and flash it to the device. Note that you have used the lunch command to build the target. It is best not to run the build target on another different target.

1) simulate an android device

Through the build process, the simulator has been automatically added to your path. Therefore, run the simulator by typing the following command:

$emulator

2) Flash to the device

Fastboot is required to Flash to the device. After the build is successful, the command is included in your path. During boot, you can either manually place the device to fastboot mode using the appropriate combination key. Or enter the following command from shell to enter fastboot Mode

$adb reboot bootloader

Once the device is in fastboot mode, run:

$fastboot flashall -w
The-w option is used to erase the/data part of the device. It is useful for a specific device in flash for the first time. Otherwise, it is not necessary.

For more information about building and running on real hardware, see: http://source.android.com/source/building-devices.html


Ii. Use ccache

Ccache is a compiler used for C and C ++. It makes building faster. In the root directory of the source code, perform the following operations:

$export USE_CCACHE=1$export CCACHE_DIR=/
 
  /.ccache$prebuilts/misc/linux-x86/ccache/ccache -M 50G
 
Recommended cache size: 50-100 GB


You can use the following operations to view the ccache size:

$watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s

If you use Ice Cream Sandwich (4.0.x) or an older version, you must use prebuilts instead of prebuilts/misc.

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.