RSS

Search Engine

Friday, May 21, 2010

Compile Android kernel from the source

I confirmed the following procedure only on my linux host (FC8). Sorry for Windows and Mac users.

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

2. Get kernl source code from here.

3. Deploy toolcains 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.

CROSS_COMPILE=../arm-2007q3/bin/arm-none-linux-gnueabi-

7. Comment out LDFLAGS_BUILD_ID[*1] in the same Makefile.

#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 Andorid 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
$ emulator -kernel arch/arm/boot/zImage

0 comments:

Post a Comment