Compilation of Android kernel

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 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 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 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
回應已關閉.

Hello Android.

台灣人寫的 Android 中文注音輸入法