[Excerpt] Graphic tutorial on Google Android operating system kernel Compilation

Source: Internet
Author: User
Like the standard Linux development process, an important basic task of Android platform development is to compile and port its kernel. This article, in conjunction with Android development documents and my practical experience, briefly introduces the android kernel compilation process, hoping to help developers interested in internal nuclear transfer.
Android, as a mobile phone Development Platform launched by Google, is based on the Linux kernel. Google KernelSource codeExcept Linux In addition, a large part is related to the virtual processor qemu and the simulation hardware platform goldfish. Therefore, if you want to port android to the actual hardware platform, you needCodePeel . This is not the case.ArticleThe focus of our current goal is to compile a system kernel that can run on the simulator. Now let's start our work!
Work environment and required software packages
System Environment: RedHat Linux 9.0
Cross-compiler: GNU toolchain for ARM processors:
Http://www.codesourcery.com/gnu_toolchains/arm/download.html
The first option is arm Eabi or arm GNU/Linux, and the second option is ia32 GNU/Linux.

The image of this topic is as follows:

Android kernel source code: linux-2.6.23-android-m5-rc14.tar.gz:
Http://code.google.com/p/android/downloads/list
Note that the kernel version should be the same as the Simulator version you selected.

The image of this topic is as follows:

Android SDK:
Http://code.google.com/android/download_list.html

The image of this topic is as follows:

1. Build a cross-compilation environment
1) install Android SDK: Decompress android-sdk_m5-rc14_linux-x86.zip to the appropriate path. This article releases it to the/usr/local/android_sdk_linux path and adds its tools path to the path:
$ Export Path = $ path:/usr/local/android_sdk_linux/tools
2) install the cross compiler: extract arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 to the/usr/local/arm-2007q3 directory and add its bin path to the path:
$ Export Path = $ path:/usr/local/arm-2007q3/bin

The image of this topic is as follows:

3) decompress the kernel source code: extract linux-2.6.23-android-m5-rc14.tar.gz to get the kernel folder. In this article, place it in the/Android directory.
2. Obtain the kernel compilation configuration file
After the cross-compilation environment is set up, you need to obtain the configuration file of Android kernel compilation parameters, which must be obtained from the simulator in the android SDK. Start the android simulator and use ADB to obtain the Kernel configuration file provided by the simulator:
$ Emulator &
$ ADB pull/proc/config.gz
At this time, the ADB tool will connect to the simulator and download a file named config.gz to your current directory. Move it to the kernel directory, decompress the file to get config, and rename it as. config. In this way, you can skip make config and directly obtain the Kernel configuration file required by makefile.
$ Gunzip config.gz
$ MV config. config

The image of this topic is as follows:

3. Modify makefile
First, modify row 187th and change the cross_compile value to arm-None-Linux-gnueabi. This is the prefix of the Cross-compilation tool chain we have installed, this modification is intended to tell make to use the toolchain during compilation.

The image of this topic is as follows:

Modify lines 519th and 520 and comment out the build id value because the current Android kernel does not support this option.

The image of this topic is as follows:

4. Start Compilation
Run make in the kernel directory:
$ Make
Except for some warnings, the compilation process went smoothly. Finally, a zimage was generated under the/kernel/ARCH/ARM/boot Directory, which is the compiled kernel image.

The image of this topic is as follows:


The image of this topic is as follows:

5. Run the image
$ Emulator-kernel ~ /Android/kernel/ARCH/ARM/boot/zimage
Final effect.

The image of this topic is as follows:

Related Article

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.