How to download and compile Android4.0 kernel source code goldfish (image)

Source: Internet
Author: User

How to download the Android4.0 source code. Please refer to my blog post (also in the text 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


The following is the point of entry:

First step: Download Goldfish source code

Create a new kernel folder under the Android source code root folder

$mkdir KERNEL$CD Kernel
Download Source code:


Complete the download for example:

A goldfish folder is generated under the kernel folder. Go to this folder:

$CD Goldfish

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

$ls-al

You can see this folder:


View all branches:

Git  branch-a
For example, with:


Check out:

$git Checkout remotes/origin/android-goldfish-2.6.29


At this point you will see very many files appearing under the Goldfish folder:

$ls

This time goldfish source code has been down, the next thing is to compile.


Step two: Compile Goldfish

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

Export path= $PATH: ~/working_directory/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin

We will use the cross-compiler under this folder above arm-eabi-Gcc

Then open the makefile file with Gedit under the Glodfish folder and find the two lines of text:

# ARCH ? = (Subarch)

# Cross_compile ?

=
Change to:
ARCH ?

= Arm
Cross_compile ? = arm-eabi-

$gedit Makefile

Note: Arth =arm, there is no space behind arm, otherwise it will appear such as the following 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. In fact, it is also possible to complete the following command:
$ export arch=arm$ Export subarch=arm$ export cross_compile=arm-eabi-


To ensure that the environment is correct, run the following two instructions below, or you may not be able to start the emulator normally. (Note: The following two instructions are run under the Android source code root folder)
$ source build/envsetup.sh  //missing This instruction may result in an inability to compile through $ lunch Full-eng            //missing this instruction, which may cause the module to fail to boot and the system report cannot find the AVD. and ask you to create an AVD.

Close the gedit, then start make, run for example the following command:
$ make goldfish_armv7_defconfig$ make
Note: Use$make Goldfish_defconfigThis configuration can also be compiled, and the emulator can be started. But Android's boot machine will not show, $adb shell is dead and alive, the reason is this goldfish_defconfig this configuration file problem.

Tips:
$make goldfish_armv7_defconfig directive means to working_directory/kernel/goldfish/arch/arm/configs/a folder under Goldfish_armv7_ Copy the Kconfig configuration contents in the Defconfig file to working_directory/kernel/goldfish/ In the. config file under the folder, the. config file is a hidden folder that holds the configuration of the Kconfig file under each folder.
Finally the result is for example with what is seen:


This means that the compilation was successful.

$ ls arch/arm/boot/
Be able to see the zimage file.


Step three: Start the compiled kernel in the emulator

Press down again to execute its next instruction:
Simulator Launcher Interface:



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

From being able to see that the current Android version number is 4.0.1, the kernel version number is 2.6.29, which indicates success.

The same can also be done through the ADB shell to view the kernel version number information, for example:

$ADB SHELL#CD Proc#cat Version


Finish!

How to download and compile Android4.0 kernel source code goldfish (image)

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.