The Light Entertainment at the End of the Tunnel. Ridin' that train... yes, that train...

Saturday, May 16, 2009

Notes on tweaking the kernel for the G1 HTC Dream

Warning: Work in progress

First, here is a handy little script for kernel-building and testing: export ARCH=arm export CROSS_COMPILE=arm-eabi- export PATH=$PATH:$PWD/jdroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin:/$PWD/jdroid/out/host/linux-x86/bin

I have a directory, android, in which is rooted the android sources, the SDK, various other odds and ends, and this script, called 'env', which I use as . ./env After doing that, I can just to 'make -j2' in the kernel-tree and have the right things happen, and fastboot and adb and so forth are in my PATH. I keep a copy of ramdisk.img there and put my built kernels, so I can try them out easily with fastboot boot zImage-2.6.27-stripped ramdisk.img

There appears to be a bunch of cruft built into the kernel wasting memory. This could just be the case for the JesusFreke build I pulled the config from, but probably most of it came from the vanilla Android. There is for example to reason to have both ext2 and ext3 compiled in (ext3 is backwards-compatible). Once 2.6.29 builds, there will be no excuse for anything but ext4, which again can mount ext2 and ext3 (via 'mount -t ext4').

Unfortunately the Wifi code appears to come from HTC as a binary module, and more unfortunately it uses symbols defined in the SLAB allocator (there is an option for a SLOB allocator which would probably be much more appropriate), and even more unfortunately is built with preemption debugging code, requiring the whole damn kernel have either preemption debugging or preemption tracing, neither of which anyone but kernel debuggers want. From include/linux/preempt.h: #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) extern void add_preempt_count(int val); extern void sub_preempt_count(int val); #else

This latter is probably because I am using the HTC radio release for the Android Developer Phone (ADP). Hopefully they turn this cruft off for the G1 (I added PREEMPT_TRACER as the lesser evil and it still bloated the kernel a whole bunch).

... Oh bloody hell, the thing apparently hung trying to boot with PREEMPT_TRACER. Let's try DEBUG_PREEMPT instead...

I'm going to move this thread to my Google Site which is maybe a better place for it.

No comments: