Jump
Http://blog.chinaunix.net/uid-25033252-id-3641350.html
This article is based on ubuntu10.10.
1. Because we need an android simulator, We need to install the android SDK and create an AVD,
You can name it avd15, avd22, avd23 ,...
Avd15 corresponds to 1.5, avd22 corresponds to 2.2, and avd23 corresponds to 2.3 ,...
Get the. config file:
Start the simulator avd15:
$ Emulator-AVD avd15
$ Pull/proc/config.gz. // copy the/proc/config.gz file to a local directory, corresponding to the current working directory on Linux, the same below
Decompress the package and save it as. config for later use.
2 arm Compiler
Download the arm tool chain from the website
Note that when selecting an earlier version, it is very likely that the Google team chose the latest version at the time of compilation, but it was always used later.
Http://www.codesourcery.com/sgpp/lite/arm/portal/subscription? @ Template = Lite
Previous versions: Click All versions to view all release versions. The 2008q3-41 version is available for use by many tests.
After decompression, set the environment variable to add/usr/local/arm-2008q3/bin to $ path
/Usr/local/is the root directory of the unzipped arm-tools-chain.
3. Download the android Linux Kernel
Remember that it is the android Linux kernel (GIT clone git: // android.git.kernel.org/kernel/common.git), rather than the general linuxe kernel source code (GIT clone git: // android.git.kernel.org/kernel/linux-2.6.git)
$ Git clone git: // android.git.kernel.org/kernel/common.git kernel-common
// The kernel-common directory stores the code from the code library, the same below
This step is a long wait...
$ Cd ~ /Kernel-common
$ Git Branch
$ Android 2.6.36
// The version changes.
4. After downloading the android Linux kernel source code, you will find that there is no goldfish_defconfig file under/ARCH/ARM/configs/. Well, we need the check_out gold_fish version (the hardware configuration of the simulator is gold_fish)
$ Cd ~ /Kernel_common
$ Git branch-
$ * Android-2.6.36
Remotes/ORIGIN/head-> origin/Android-2.6.36
Remotes/ORIGIN/Android-2.6.35
Remotes/ORIGIN/Android-2.6.36
Remotes/ORIGIN/archive/Android-2.6.25.
Remotes/ORIGIN/archive/Android-2.6.27.
Remotes/ORIGIN/archive/Android-2.6.29.
Remotes/ORIGIN/archive/Android-2.6.32.
Remotes/ORIGIN/archive/android-gldfish-2.6.29
Remotes/ORIGIN/archive/Android-goldfsh-2.6.27
// The above information is currently displayed. It may be a bit different in the future, and even the branch name of the old version will be modified.
// Pay special attention to this
$ Git checkout remotes/ORIGIN/archive/android-gldfish-2.6.29
Git checkout remotes/ORIGIN/Android-goldfish-3.4
// This process is much faster, waiting for the data to be downloaded.
// Git is really not easy to use. I miss tortoisesvn on Windows.
After downloading, you can see the file goldfish_defconfig under kernel-Common/ARCH/ARM/configs /.
5. Compile
1) copy the. config file in 1 ~ /Kernel_common directory
2) Modify ~ /Makefile under the kernel_common directory (modify two places) -- it is best to back up this file if you modify this file and use git to get the new version.
The MAKEFILE file is modified.
Arch? = Arm // set the CPU architecture to arm
Cross_compile? = Arm-None-Linux-gnueabi-// arm compilation tool prefix
3)
$ Make goldfish_defconfig
$ Make-J2 // The current machine is dual-core, so that code compilation is faster.
Compile the last two lines of information:
Objcopy ARCH/ARM/boot/zimage
Kernel: ARCH/ARM/boot/zimage is ready
6. Start the simulator with the kernel we just compiled (this will not affect the original simulator)
$ Emulator-AVD avd15-kernel ~ /Kernel_common/ARCH/ARM/boot/zimage
If the simulator can be up, it means it is successful.
Open another terminal, so that the terminal can be used when the above terminal is occupied.
$ ADB Shell
# Cd/proc
# Cat version
Linux version 2.6.29-00262-gb0d93fb-dirty (dream @ dream-VGN-FW351J) (GCC version 4.3.2 (sourcery g ++ lite 2008q3-41) #1 Fri Dec 24 12:31:28 CST 2010
# Cat cupinfo
Cupinfo: no such file or directory
# Cat cpuinfo
Processor: ARM926EJ-S Rev 5 (v5l)
Bogomips: 272.79
Features: SWP half thumb fastmult vfp edsp Java
CPU Implementer: 0x41
CPU architecture: 5tej
CPU variant: 0x0
CPU part: 0x926
CPU revision: 5
Hardware: goldfish
Revision: 0000
Serial: 0000000000000000
Note: dream @ dream-VGN-FW351J, where dream is the user name currently logged on to Ubuntu, And the dream-VGN-FW351J is the machine name
Sourcery g ++ lite 2008q3-41. This is the arm tools chain version.
References:
1. Android kernel Compilation Method
2. Download and compile Android Kernel
3. Android kernel Compilation Method
4. Specify branch in Git-clone
5. http://android.git.kernel.org/
# Android