"Go" How to download and compile Android4.0 kernel source goldfish (graphics)

Source: Internet
Author: User

Original URL: http://blog.csdn.net/flydream0/article/details/7070392

For more information on how to download the Android4.0 source code, please check out another article in my blog (also a graphics tutorial):

http://blog.csdn.net/flydream0/article/details/7036156

How to compile Android4.0 source code please see:

http://blog.csdn.net/flydream0/article/details/7046612

Below to get to the chase:

First step: Download Goldfish source code

Create a new kernel folder under the Android source root directory

[HTML]View Plaincopy
    1. $mkdir kernel
    2. $CD kernel

Download Source:

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


Download completed such as:

A goldfish folder is generated under the kernel directory. Enter this directory:

[HTML]View Plaincopy
    1. $CD Goldfish


There is a hidden directory under this directory. Git, by

[HTML]View Plaincopy
    1. $ls-al


You can see this directory:

View all branches:

[HTML]View Plaincopy
    1. Git branch-a

Such as:

Check out:

[HTML]View Plaincopy
    1. $git Checkout remotes/origin/android-goldfish-2.6.29



At this point you will see a lot of files in the Goldfish directory:

[HTML]View Plaincopy
    1. $ls


This time goldfish source has been down, the next thing is compiled.

Step two: Compile Goldfish

Export the cross-compilation tool directory to the $PATH environment variable.

[HTML]View Plaincopy
    1. Export path= $PATH: ~/working_directory/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin


We will use the cross-compiler under this directory arm-eabi-gcc

Then open the makefile file with Gedit in the Glodfish directory and find the two lines of text:

# ARCH ? = (Subarch)

# Cross_compile ?=
Modified to:
ARCH? = Arm
cross_compile? = arm-eabi-
[HTML]View Plaincopy
    1. $gedit Makefile

Note: Arth =arm, do not have a space behind arm, or you will see the following similar error:
Make:...../kernel/goldfish/arch/arm:is a directory. Stop.
I wasted a few hours in vain.

The purpose of these operations is to specify the architecture and cross-compiler of the target device, which can be done by the following directives:
[Plain]View Plaincopy
    1. $ Export Arch=arm
    2. $ Export Subarch=arm
    3. $ Export cross_compile=arm-eabi-


To ensure that the environment parameters are correct, the following two instructions are executed, otherwise the emulator may not start properly. (Note: The following two instructions are executed under the Android source code root directory)
[CPP]View Plaincopy
    1. $ source build/envsetup.sh //missing This instruction may result in an inability to compile through
    2. $ lunch Full-eng //Missing This instruction may cause the module to fail to start, the system report cannot find the AVD and asks you to create the AVD.

Close the gedit, then start make, execute the following command:
[HTML]View Plaincopy
    1. $ make Goldfish_armv7_defconfig
    2. $ make
Note: With $make goldfish_defconfig This configuration can also be compiled through, the simulator can also start, but the Android boot machine will not show, $adb shell is dead and alive, the reason is this goldfish_ Defconfig This configuration file problem.

Tips:
The $make goldfish_armv7_defconfig directive means to working_directory/kernel/goldfish/arch/arm/configs/goldfish_armv7_ under the directory. Kconfig configuration content in the Defconfig file is copied to working_directory/kernel/goldfish/ In the. config file in the directory, the. config file is a hidden directory that holds the configuration of the Kconfig file under each directory.
The end result is as follows:


This means that the compilation was successful.

[HTML]View Plaincopy
    1. $ ls arch/arm/boot/
You can see the Zimage file.


Step three: Start the compiled kernel in the emulator

Press down again to run its next instruction:
[HTML]View Plaincopy
    1. $ export path= $PATH: ~/working_directory/out/host/linux-x86/bin
    2. $ export android_product_out=~/working_directory/out/target/product/generic
    3. $ Emulator-kernel ~/working_directory/kernel/goldfish/arch/arm/boot/zimage &
Simulator Launcher Interface:



Enter the simulator from the settings to see the version information:

It can be seen that the current Android version is 4.0.1, the kernel version is 2.6.29, indicating success.

It is also possible to view kernel version information through the ADB shell, such as:

[HTML]View Plaincopy
    1. $ADB Shell
    2. #cd proc
    3. #cat version

Finish!

"Go" How to download and compile Android4.0 kernel source goldfish (graphics)

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.