Android system porting and Platform development (i)

Source: Internet
Author: User
Tags using git

Android system porting and Platform development (i)Category: Android transplant 2012-09-05 14:16 16173 people read review (a) collection report Androidgitgooglejdkubuntu

Directory (?) [+]

+-------------------------------------------------+

+ This series is serialized, will be updated on a regular basis +

+-------------------------------------------------+

First, the Android4.0 system download and compile

Download and compile the Android system, Google's official website has given detailed instructions, please refer to the official Android website:

Http://source.android.com/source/index.html

The content is mainly divided into:

1. Preparing the Android download and compilation environment

2. Download the source code

3. Compiling source code and kernel source code

Let's explain the steps and precautions in turn.

1. Preparing the Android download and compilation environment

Android Source compiled Google only gives the Unix-like system, exactly the Ubuntu and MacOS on the detailed process, we only describe the compilation process on Ubuntu.

1.1 Hardware environment:

L fast enough PC, if conditional, preferably use physical pc

Memory minimum 1G, HDD minimum 30GB

Note: Virtual machine software such as VMware or VirtualBox can also be used, but the compilation speed is too slow, as for memory, if it is less than 1G, errors may occur when compiling the system.

1.2 Software Environment

We use Ubuntu12.04 as a compiled host system (officially not recommended for the Ubuntu12.04 version), because the Android system code is mostly written in the Java language, it is necessary to install the JDK, however, different versions of the JDK version has different requirements:

L in Gingerbread (2.3.x) and later versions, use JDK6.0, and compile with 64-bit system

L In previous versions of Gingerbread (2.3.x), using JDK5.0, and can be compiled on 32-bit systems

Note: Of course, we compile the 32-bit system by modifying some of the configuration files, but we cannot guarantee that the compiled system will not have any problems in the future.

JDK6.0 recommends downloading directly from the Sun Company's website:

http://java.sun.com/javase/downloads/

To install a package that is dependent on compilation:

[Plain]View Plaincopy
    1. $ sudo apt-get install Git-core GnuPG Flex Bison gperf build-essential \
    2. Zip curl Libc6-dev libncurses5-dev:i386 x11proto-core-dev \
    3. libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
    4. Libgl1-mesa-dev g++-multilib mingw32 tofrodos \
    5. Python-markdown libxml2-utils Xsltproc zlib1g-dev:i386

Execute the following command:

[Plain]View Plaincopy
    1. $ sudo ln-s/usr/lib/i386-linux-gnu/mesa/libgl.so.1/usr/lib/i386-linux-gnu/libgl.so
2. Download Android4.0 and Goldfish source 2.1 download and initialize the Repo tool

Execute the following command in turn:

[Plain]View Plaincopy
    1. $ mkdir ~/bin
    2. $ Path=~/bin: $PATH

Download the repo tool by using the Curl command:

[Plain]View Plaincopy
    1. $ Curl Https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

Add the Execute permission to the Repo tool:

[Plain]View Plaincopy
    1. $ chmod a+x ~/bin/repo

To create our source directory:

[Plain]View Plaincopy
    1. $ mkdir working_directory
    2. $ CD Working_directory

Initialize the repo tool and prepare to access the Google Source repository:

[Plain]View Plaincopy
    1. $ repo init-u https://android.googlesource.com/platform/manifest-b ANDROID-4.0.1_R1

Sometimes using the above command can not connect to the Android server, we can use the following command to connect:

[Plain]View Plaincopy
    1. $ repo init-u https://android.googlesource.com/a/platform/manifest-b ANDROID-4.0.1_R1

This time, to ensure that your Ubuntu Internet access and normal connection to the Android server, after the initialization of the repo tool, will let you enter the Gmail mailbox and user name verification.

2.2 Download Android source code

Start downloading the Android source code by executing the following command:

[Plain]View Plaincopy
    1. $repo Sync

If your PC is strong enough, you can add –jn,n to the command to indicate that multiple threads are downloading at the same time, which can increase the download speed.

Then is the long wait, the source of Android4.0.1 is about 6GB, usually one or two nights of time.

Sometimes, the network may be broken, we can use the following script to download, when the connection error, will be automatically downloaded.

[Plain]View Plaincopy
    1. #!/bin/bash
    2. Path=~/bin: $PATH
    3. Repo Init-u https://android.googlesource.com/a/platform/manifest-b ANDROID-4.0.1_R1
    4. Repo Sync
    5. While [$?! = 0]; Do
    6. echo "**error:sync failed, Re-sync again"
    7. Sleep 5
    8. Repo Sync
    9. Done
2.3 Other source of source download

The download step described earlier is Google releasing an official version of the Android code, which is usually only the simulator and some of the Google has a partnership with the source of equipment, If you want to compile a target device Android4.0.1 system, we must customize it, but there are some well-known equipment manufacturers or third-party vendors, but also open source for their own devices, Android systems, such as: Samsung, Qualcomm, etc., more professional, the URL is as follows:

www.linaro.org

Linaro website is mainly arm chip's newest Android solution, such as: Based on the Samsung Orion chip Origen Development Board, based on TI's OMAP system chip PandaBoard Board, based on Nova A9500 ARM dual-core cortex A9 of the Snowball Development Board and so on.

If you download the source code from the above website, follow the instructions of the above website.

2.4 Download simulator Goldfish kernel source

While developing Android, Google has developed a simulator for each version using QEMU, which greatly reduces developer costs and facilitates the promotion of Android technology. QEMU is an open source analog processor software, and Google uses QEMU to simulate the Arm926ej-s goldfish processor, if the developer in the absence of the target Development Board, to operate the hardware, it is necessary to operate the android underlying driver, We can use the simulator's kernel source code.

Ø Download Goldfish Kernel source code

First go to the Android source directory, create the source directory kernel:

[Plain]View Plaincopy
    1. $ CD Working_directory
    2. $ mkdir Kernel

Download the source code from the Android remote source repository:

[Plain]View Plaincopy
    1. $git Clone Http://android.googlesource.com/kernel/goldfish.git

Of course, if you want to compile the kernel of the target platform, you can also download it from the designated repository, and the kernel of the following processors are given:

[Plain]View Plaincopy
    1. $ git clone https://android.googlesource.com/kernel/common.git
    2. $ git clone https://android.googlesource.com/kernel/exynos.git
    3. $ git clone https://android.googlesource.com/kernel/goldfish.git
    4. $ git clone https://android.googlesource.com/kernel/msm.git
    5. $ git clone https://android.googlesource.com/kernel/omap.git
    6. $ git clone https://android.googlesource.com/kernel/samsung.git
    7. $ git clone https://android.googlesource.com/kernel/tegra.git

After about 10 minutes, the download is finished, as shown in:

In the kernel directory, generate a goldfish directory that goes into the directory:

[Plain]View Plaincopy
    1. $ CD Goldfish
    2. $ ls-al

View the current directory with the Ls–al command to see the hidden. Git.

Using Git branch–a to view the branch:

[Plain]View Plaincopy
    1. $ git branch-a

Use git checkout to get the source code:

[Plain]View Plaincopy
    1. $ git checkout remotes/origin/android-goldfish-2.6.29

As shown, the directory structure of the Linux kernel source code appears in the current directory:

Android system porting and Platform development (i)

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.