Install the following packages using your favorite package manager:
Debian based Linux distributions
32bit and 64bit systems:
git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev abootimg
64bit only:
ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
Download Code Sourcery ARM EABI Toolchain:
Use "./arm-2012.03-56-arm-none-eabi.bin" to install, then create an environment variable denoting the location of the toolchain as follows:
export CCOMPILER=[Install Folder]/bin/arm-none-eabi
Download Kernel Source Code
mkdir -p ~/android/kernel
cd ~/android/kernel
git clone git://github.com/cvpcs/android_kernel_omap.git --branch cm-sholes
cd android_kernel_omap
git reset --hard 470cb3613f8da9a2483d5592f750ef4ad7de29bf
Download cm-7.2.0-sholes.zip:
Extract, then copy boot.img to cm-kernel folder, then pull .config as follows:
scripts/extract-ikconfig boot.img > .config
The heart of this hack relies on a kernel configuration option that was created for situations when you can't change the command-line options of the boot loader, but you can change the kernel.
1) Open .config and replace:
------------------------------------
CONFIG_CMDLINE="root=/dev/nfs nfsroot=192.168.0.1:/home/user/buildroot ip=192.168.0.2:192.168.0.1:192.168.0.1:255.255.255.0:tgt:eth0:off rw console=ttyS2,115200n8"
------------------------------------
with
------------------------------------
CONFIG_CMDLINE="mem=244M@0x80C00000 mtdparts=omap2-nand.0:640k@128k(mbm),384k@1408k(cdt),384k@3328k(lbl),384k@6272k(misc),3584k(boot),4608k(recovery),143744k(system),94848k(cache),268032k(userdata),2m(kpanic) root=/dev/mmcblk0p2 console=tty1"
CONFIG_CMDLINE_FORCE=y
------------------------------------
2)
Open arch/arm/Kconfig and replace:
------------------------------------
time by entering them here. As a minimum, you should specify the
memory size and the root device (e.g., mem=64M root=/dev/nfs).
config XIP_KERNEL
bool "Kernel Execute-In-Place from ROM"
depends on !ZBOOT_ROM
------------------------------------
with
------------------------------------
time by entering them here. As a minimum, you should specify the
memory size and the root device (e.g., mem=64M root=/dev/nfs).
config CMDLINE_FORCE
bool "Always use the default kernel command string"
depends on CMDLINE != ""
help
Always use the default kernel command string, even if the boot
loader passes other arguments to the kernel.
This is useful if you cannot or don't want to change the
command-line options your boot loader passes to the kernel.
If unsure, say N.
config XIP_KERNEL
bool "Kernel Execute-In-Place from ROM"
depends on !ZBOOT_ROM
------------------------------------
3)
Open arch/arm/kernel/setup.c and replace:
------------------------------------
static int __init parse_tag_cmdline(const struct tag *tag)
{
strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);
return 0;
}
------------------------------------
with
------------------------------------
static int __init parse_tag_cmdline(const struct tag *tag)
{
#ifndef CONFIG_CMDLINE_FORCE
strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);
#else
pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
#endif /* CONFIG_CMDLINE_FORCE */
return 0;
}
------------------------------------
Actual Compiling!
make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`
Creating "boot.img"!
mkdir ~/android/boot/
mv boot.img ~/android/boot/boot.img
cd ~/android/boot/
abootimg -x boot.img
sed -i 8d bootimg.cfg
rm boot.img initrd.img zImage
cp ~/android/kernel/android_kernel_omap/arch/arm/boot/zImage ~/android/boot/zImage
echo > ~/android/boot/initrd.img
abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img
Flashing "bootimg"!
adb push boot.img /tmp/boot.img
adb shell flash_image boot /tmp/boot.img