During COVID-19, we remain open to serve you. Free shipping to USA 1

Droid Docs: Compilation of Android kernel

Posted by Sandy Baggs on

From Triled Wiki
Jump to: navigation, search

Tip applies to Linux systems

1. Get toolchains from CodeSourcery (Choose ARM EABI and IA32 GNU/Linux).

2. Get kernel source code from here.

3. Deploy toolchains and kernel source and enter in the kernel source tree.

$ mkdir -p android
$ cd android
$ tar xjvf ../arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
$ tar xzvf ../linux-2.6.23-android-m3-rc20.tar.gz
$ cd kernel

4. Get the config.gz from the running emulator by the following way.

$ adb pull /proc/config.gz .

5. Decommpress the config.gz and rename it as .config

$ gunzip config.gz
$ mv config .config

6. Specify CROSS_COMPILE in the Makefile.


7. Comment out LDFLAGS_BUILD_ID in the same Makefile. The LDFLAGS_BUILD_ID enables --build-id option of ld if available. The --build-id option is relatively new. The current emulator does not seem to support the kernel linked with this option. See here if you are interested in the detail of this option.

#LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
$(call ld-option, -Wl$(comma)--build-id,))

8. Make the kernel

$ make

9. Check zImage is created and the size is nearly same as the kernel-qemu in the Android SDK.

$ ls -l arch/arm/boot/zImage
-rwxrwxr-x 1 motz motz 1234712 2007-12-01 18:06 arch/arm/boot/zImage
$ ls -l $SDK/tools/lib/images/kernel-qemu
-rwxrwxr-x 1 motz motz 1245836 2007-11-12 5:59 ...sdk/tools/lib/images/kernel-qemu

10. Run emulator with the created kernel.

$ emulator -kernel arch/arm/boot/zImage

[edit] See also

  • Original article by Motoya Kurotsu
  • Code Sourcery GNU cross compile tool chain for ARM.
  • Android Linux kernel sources.
  • Latest Android Linux kernel sources, released via git.
  • Compilation of emulator on FreeBSD

Retrieved from "http://wiki.droiddocs.net/Compilation_of_Android_kernel"
Category: Tips


  • Article
  • Discussion
  • Edit
  • History

Personal tools

  • Log in / create account


  • Main Page
  • Community portal
  • Current events
  • Recent changes
  • Random page
  • Help
  • Donations



  • What links here
  • Related changes
  • Special pages
  • Printable version
  • Permanent link

In other languages

  • Русский

Powered by MediaWiki

  • This page was last modified 14:54, 22 February 2008.
  • This page has been accessed 3,442 times.
  • Privacy policy
  • About Triled Wiki
  • Disclaimers

Share this post

← Older Post Newer Post →

Leave a comment

Please note, comments must be approved before they are published.