Android Deep Explore the fourth chapter

Source: Internet
Author: User

Fourth chapter source code download and compile

Android source code contains something: an app embedded in android : photos, calculators, calendars, albums, dialer and other source code;Android SDK With various tools: such as:adb, emulator mksdcard apt etc source code,android ndk source code. Hal source code.

First, download, compile and test the source code:

1. Configure the android source code download environment:

(1) Create a directory to hold the download script file (repo) (The script file can be placed in any directory, using ~/bin);

#madir ~/bin

#path ~/bin: $path

(2) Download repo script (for download source code);

# Curl Https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

#chmod a+x ~/bin/repo

(3) Create a directory to hold the android source code (can be placed in other directories);

# mkdir Android_reource

# CD Android_source

(4) initialization;# repo init-u https://android.googlesource.com/platform/manifest

(5) start to download android source code;# repo Sync

2.android Source code directory structure analysis;

Android part of the source code meaning:

ABI: application binary interface;

Device: equipment-related code;

Hardware: hardware layers and libraries.

SDK: Tools used in the development environment.

3. download part of the android source code,

To download the android Source code sub-project method:

Using the reop sync command # repo sync platform/bootable/recovery

Or use the git clone command:# git clone http://android.googlesourse.com/<project name>

4. To compile The Android source code: First Step: Initialize the compilation environment:

# source build/envsetup.sh or #. build/envsetup.sh the second step; select target: # Lunch Full-eng Step three: Build android Source code:# Make

5.out directory structure analysis; The Out directory is the default directory that holds the target files generated by the compiled Andriod source code. The image file can be tested using an android emulator or a real computer.

6. Publish your apk as a built-in program, and in order to test the file, you can embed an apk program you have built into the file.

7. Test The system.img file with the simulator .

Second, download and compile the Linux kernel source code:

Download linux kernel source code; git clone  http://android.googlesource.com.kernel/common.git git  branch - A  git checkout -b  android-3.0 remotes/origin/android-3.0 export android3.0 # git  clone  http://android,googlesourse.com/kernel/goldfish.git  

# git checkout-b android-goldfish-2.6.29 remotes/origin/android-goldfish-2.6.29// export goldfish

There are 4 stepsto install the android Kernel's build Environment :1. preparatory work

: Convert arm-linux-gcc-4.3.2.tgz files and arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar,bz2 files copied to the working directory

2. Unzip

3. Verify that the cross compiler is successfully installed # ls/user/local/arm-1

4. installing libncurses5# apt-get Install Libncurses5-dev

5. configure and compile the linux kernel.

Android Deep Explore the fourth chapter

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.