Download and compile the source code

Source: Internet
Author: User

This chapter is divided into two parts: the first part is to download and test the Android source code, and the second part is to download and compile the Linux kernel source code.

The first part requires the configuration of the download environment before downloading the Android source code. The steps are as follows: 1) Create a directory to hold the download script file (repo). 2) Download the repo script file. 3) Create a directory to hold the Android source code. 4) Initialize. 5) Start downloading Android source code. After configuring the Android download environment, the structure of the Android source code directory is parsed to understand the meaning and content of the different sub-items of the Android source code.

Once you understand the structure of your directory, you can download parts of the Android source code if you need some Android source code. There are two ways to download a subproject in the Android source code: 1. Use the repo Syne method. 2. Download the specified command format using the git clone command.

After downloading, compile the Android source code. The compilation is divided into 3 parts: 1. Initialize the compilation environment. Executing the source build/envsetup.sh in the terminal can call these functions at the terminal. 2. Select the target. Use the lunch command to set the compilation target. 3. Compile the Android source code by executing the make command to compile the Android source code.

The Out directory is the default directory that holds the target files generated by the compiled Android source code. Out-of-directory structure analysis is essential. Then publish your apk as an Android built-in program. Test the System.img file with the simulator. Perform mkyaffs2image system system.img to regenerate the system.img file. Execute EMULATOR–AVD myavd–system system.img–data userdata.img using the file you just generated.

The Linux kernel source code is downloaded and compiled slightly different from the Android source code. First, the Linux kernel source code download does not need to download the pre-configuration download environment. Second, download the Linux kernel at the time of downloading, download the latest version of the Linux kernel. After the download is complete, there is a common directory under the current directory, enter the directory, and execute git branch–a to view the directory.

Then the same as the Android source code is the Linux kernel source code of the directory structure of understanding and parsing.

The third step is to install the Android kernel's build environment. Compiling the Linux kernel under Ubuntu Linux requires the installation of a cross compiler. A cross-compiler is a program that compiles on the CPU of a architecture to run on a B-schema CPU.

The cross compiler can be installed as follows:

1) Prepare for the job. Unzip two arm-linux-gcc-4.3.2.tgz and arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar.bz2 compressed files

2) unzip the compiler. Use tar zxvf arm-linux-gcc-4.3.2.tgz–c/and tar jxvf arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar.bz2–c/

3) Verify that the cross compiler is installed successfully ls/usr/local/arm–l

4) Install the libncurses. Apt–get Install Libncurses5–dev

Configure and compile the Linux kernel. A zimage file will be generated in the Linux kernel source root directory Arch/arm/boot directory after successful compilation. Can be installed directly on the board using the zimage.

Download and compile the source code

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.