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
- $mkdir kernel
- $CD kernel
Download Source:
[HTML]View Plaincopy
- $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
- $CD Goldfish
There is a hidden directory under this directory. Git, by
[HTML]View Plaincopy
- $ls-al
You can see this directory:
View all branches:
[HTML]View Plaincopy
- Git branch-a
Such as:
Check out:
[HTML]View Plaincopy
- $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
- $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
- 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
- $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
- $ Export Arch=arm
- $ Export Subarch=arm
- $ 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
- $ source build/envsetup.sh //missing This instruction may result in an inability to compile through
- $ 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
- $ make Goldfish_armv7_defconfig
- $ 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
- $ 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
- $ export path= $PATH: ~/working_directory/out/host/linux-x86/bin
- $ export android_product_out=~/working_directory/out/target/product/generic
- $ 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
- $ADB Shell
- #cd proc
- #cat version
Finish!
"Go" How to download and compile Android4.0 kernel source goldfish (graphics)