[G1 Android Development] joeko2202:
Here's what I've done in the past. This assumes you have already repo sync'ed and have a toolchain available. I also work with a fresh copy of the MSM kernel from git. You can use the repo you checked out with repo (which is in .repo), but I can't remember how to do it off the top of my head right now. I make some assumptions people are comfortable with a "standard" kernel compile and git. These steps also assume you're on a Unix-based OS (Linux, Mac OS X, and (possibily) Cygwin).

1) In your clone of the MSM kernel repo, switch to the commit that Google used for their RC30 kernel:

git checkout -b my-build c092738

This creates a branch named "my-build" from the commit ID that starts with c092738e. I got this from the vendor/htc/dream git log. There are more recent kernels, but this one seems to be OK. You also want to make sure you dont use 2.6.27 yet. Apparently some of the kernel bits moved around, and the non-cupcake userspace doesn't know about this...but I never confirmed that.

2) Extract a starting config.

Unzip an RC30 full update from somewhere, and extract the kernel from boot.img. (I use split_bootimg.pl from the android-dls wiki). Remember where boot.img-kernel is located. Go into the directory containing the kernel tree you checked out in step 1, and run:

scripts/extract-ikconfig > g1.config

You can read the resulting config (less g1.config), but to use/change it:

mv g1.config .config

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig

(Yes, run oldconfig twice!)

3) Apply patches. Apply any patches you want. JF's build sandbox has some good ones. I'd recommend the alarm driver fix at the very least (the uptime_fix.patch).

4) Edit your config. After patching, patches can give new config options. So the config needs to be updated. This is best done by:

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- oldconfig

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- menuconfig

If a new option is added, oldconfig will stop and wait for some input. Also, running oldconfig twice is a paranoid way to make sure any dependencies within the kernel config process are ironed out.

With menuconfig, you can change the config as you desire. Remember to TURN OFF "Automatically append version information to the version string", else your kernel version string will be horked. Make sure it is turned off (no * by the option)! Also, do not turn off PREEMPT or set SMP in the config. Doing so will cause the wlan module to not load at runtime(unless you can compile your own module...which can be done, but I haven't done it yet). (Actually, be careful setting options, you may cause symbols to not be exported and prebuilt modules may not work afterwards...)

5) Build the kernel. After making your changes to the config, save them off and type:

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- EXTRAVERSION=-018430-gfea26b0 zImage

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- EXTRAVERSION=-018430-gfea26b0 modules

make ARCH=arm CROSS_COMPILE=/path/to/android/repo/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- INSTALL_MOD_PATH=/tmp/modules modules_install

The kernel to use lives in arch/arm/boot/zImage. (note the case!)

6) Follow the instructions at http://android-dls.com/wiki/index.p...cking.2C_Editing.2C_and_Re-Packing_the_images Remember, in the JF releases, the extra modules are put into a cramfs. What I've done:

rm /tmp/modules/lib/modules/2.6.25-018430-gfea26b0 source

rm /tmp/modules/lib/modules/2.6.25-018430-gfea26b0 build

mkcramfs -b 8192 /tmp/modules/lib/modules modules.cramfs

You can also fastboot install the kernel image.