Download, compile, and run the android 4.0.1 source code

Source: Internet
Author: User

Download Android 4.0.1 source code, compile and run the simulator
Http://blog.csdn.net/rambo2188/article/details/6943382
Http://www.linuxidc.com/Linux/2011-11/47808.htm
Note: This article was first launched by rambo2188 on csdn. It seems that this article is reprinted on linuxidc.

----------------------------------------------------------------
[1] Download Android ICs
----------------------------------------------------------------

The http://source.android.com/source/downloading.html has the latest ICS Source Code Synchronization address. If the environment has been set up, it is very easy to synchronize the latest code:
$ Mkdir working_directory
$ CD working_directory

$ Repo init-u https://android.googlesource.com/platform/manifest-B android-4.0.1_r1
$ Repo sync

Note:

Trunk: $ repo init-u https://android.googlesource.com/platform/manifest.git
4.03: $ repo init-u https://android.googlesource.com/platform/manifest.git-B android-4.0.3_r1

After the download is complete, it mainly contains the following directories:

Abi bionic bootable build CTS Dalvik development device docs external frameworks hardware libcore makefile ndk out packages prebuilt SDK System

Android4.01 kernel kernel3.0 download
$ Git clone http://android.git.kernel.org/kernel/common.git
$ Git branch-
$ Git checkout remotes/ORIGIN/Android-3.0

----------------------------------------------------------------
[2] compilation of Android ICs
----------------------------------------------------------------
Source./build/envsetup. Sh
Lunch SDK-Eng
Make

After compilation, a log file v8.log is added to the working directory ($ top ).

Note:

(1) compilation errors may occur due to stdio2.h during compilation. The correct stdio2.h is. /prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/bits/stdio2.h file, Please reset PATH environment variable, set. /prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr put at the beginning of the path.

(2) during compilation, you may be prompted to require Java 1.6 se. In fact, you only need to have Java 1.6 JDK

(3) When the make parameter is included, toolchain indicates that absolute paths are preferred, for example: make-J2 arch = arm cross_compile =/home/Hyla/ICs/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/ARM-Eabi-

----------------------------------------------------------------
[3] latest Android 4.0.1 simulator kernel and compilation steps
----------------------------------------------------------------
URL: http://www.linuxidc.com/Linux/2011-11/47809.htm

Due to some closed policies of Android kernel, kernel Org has kicked Android kernel out of the main line. The original synchronization address has been redirected, and the structure of the android kernel itself has been adjusted, many of the original synchronization methods are no longer available. The following is the latest method for compiling the kernel (qemu kernel, Goldfish Branch) of the android 4.0.1 simulator ).

Most of the original methods use the following address Synchronization
$ Git clone git: // android.git.kernel.org/kernel/common.git
$ CD common
$ Git branch-
$ Git checkout remotes/ORIGIN/archive/Android-gldfish-2.6.29

However, you can enter
Android.git.kernel.org/kernel/common.git
It has actually been redirected
Android.googlesource.com/kernel/common.git

However, this repo does not contain the branch of goldfish. If we use git branch-A after synchronization, we will see only the latest 3.0 and 2.6.39 branches:
$ Git branch-
* (No Branch)
Master
Remotes/ORIGIN/head-> origin/Master
Remotes/ORIGIN/Android-2.6.39
Remotes/ORIGIN/Android-3.0
Remotes/ORIGIN/Master

In fact, the goldfish Branch has been separate into a separate repo: http://android.googlesource.com/kernel/goldfish.git
The following are the latest and correct synchronization steps:

$ Git clone http://android.googlesource.com/kernel/goldfish.git
$ CD goldfish
$ Git branch-
* (No Branch)
Master
Remotes/ORIGIN/head-> origin/Master
Remotes/ORIGIN/Android-goldfsh-2.6.29
Remotes/ORIGIN/Master
$ Git checkout remotes/ORIGIN/Android-goldfish-2.6.29

The compilation steps are basically not changed, but the new config is required:
$ Make arch = arm goldfish_armv7_defconfig
$ Make arch-arm cross_compile = arm-Eabi-

...
Objcopy ARCH/ARM/boot/zimage
Kernel: ARCH/ARM/boot/zimage is ready

Then you can start the simulator with the new kernel IMG:

----------------------------------------------------------------
[4] startup of Android ICS Simulator
----------------------------------------------------------------
Command: List AVD platforms
$ CD out/host/linux-x86/sdks/android-sdk_eng.xxx_linux-x86/tools
$ Android list targets
Available Android targets:
----------
ID: 1 or "Android-14"
Name: IOS 4.0
Type: Platform
API level: 14
Revision: 2
Skins: qvga, wsvga, hvga, wvga854, wxga720, wqvga432, wvga800 (default), wqvga400, wxga800
Abis: armeabi-v7a

Command: Customize AVD
$ Android create AVD-T 1-N ICs
Auto-selecting single Abi armeabi-v7a
The android 4.0 is a basic Android platform.
Do you wish to create a custom hardware profile [No]
Created AVD 'ics 'based on Android 4.0, arm (armeabi-v7a) processor,
With the following hardware config:
HW. LCD. density = 240
VM. heapsize = 24
HW. ramsize = 512

Command: Start the simulator and load the custom AVD.
$ Emulator-AVD ICs

Command: run the self-compiled kernel to start the simulator.

$ Emulator-kernel.../kernel/goldfish/ARCH/ARM/boot/zimage &

Start the simulator and go to setting => about to check whether the kernel is a self-compiled version.

Command: Use the self-compiled kernel and images to start the simulator.

Export droidroot = ~ Android-sdk-v14-x86
Export avdroot = ~ Android-sdk-v14-x86/tools

CD 'pwd'/out/target/product/generic
$ Avdroot/emulator-kernel .. /.. /.. /.. /kernel/ARCH/ARM/boot/zimage-show-kernel-partition-size 256-memory 256-skindir $ droidroot/platforms/Android-14/skins-skin wvga800-shell- sysdir. /-data userdata. IMG-ramdisk. IMG-system. IMG-sdcard
/~ /. Android/AVD/wvga800v14/sdcard. img

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.