Build a custom kernel
From Android Wiki
0. Install an Ubuntu linux system
1. Install packages
$ sudo apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
2. Make an A688 directory, and download the cross compiler tools
$ mkdir ~/A688 $ cd A688 $ git clone git://android.git.kernel.org/platform/frameworks/base.git $ git clone git://android.git.kernel.org/platform/hardware/libhardware.git $ git clone git://android.git.kernel.org/platform/hardware/libhardware_legacy.git $ git clone git://android.git.kernel.org/platform/hardware/msm7k.git $ git clone git://android.git.kernel.org/platform/prebuilt.git
3. Download Motorola Xt5 source code, and put into ~/A688 directory
https://opensource.motorola.com/sf/frs/do/viewRelease/projects.quenchxt/frs.xt5.xt502
4. Unpack source code
$ cd A688 $ tar –zxvf bionic.tar.gz $ tar –zxvf dalvik.tar.gz $ tar –zxvf external.tar.gz $ tar –zxvf kernel.tar.gz
5. Grab kernel.gz from mobile, and put the config into ~/A688/Kernel/ direcotry
(1) connect your mobile to your computer
(2) cd ~/A688/Kernel/
(3) adb pull /proc/config.gz config.gz
(4) gunzip config.gz
(5) mv config .config
6. Setup environment variable
$ export PLATFORM_DIR=~/A688 $ export ARCH=arm $ export CROSS_COMPILE=arm-eabi- $ export PATH=~/A688/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin:$PATH
7. Modify Makefile
$ vi Makefile
find
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror \
-Werror-implicit-function-declaration
and replace with
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common
# -Werror \
# -Werror-implicit-function-declaration
8. Start to make your kernel
$ make ANDROID_BUILD_TOP=
You will find your kernel image at ~/A688/kernel/arch/arm/boot/zImage
9. Unpack boot.img, and replace the kernel with new one
$ cd ~/RomRepackTools_Linux $ cp ~/A688/kernel/arch/arm/boot/zImage . $ ./unpack-bootimg.pl boot.img $ ./repack-bootimg.pl zImage boot.img-ramdisk boot_newkernel.img
10. Flash the boot partition on your mobile
$ fastboot flash boot boot_newkernel.img