Here some tips on how to get the source for a given Linux kernel that you would like to tweak. I needed to do this to play with the Android emulator. So when the kernel boots after decompression you’ll see a line like this:
Linux version 2.6.29-00177-g24ee4d2 (veenstra@jackv.mtv.corp.google.com) (gcc version 4.4.0 (GCC) ) #21 Thu Aug 6 20:39:45 PDT 2009
I’ve highlighted in bold the bits we need. The first tells us the kernel version so we know what branch to look for, but really all we need is the second bit which is the SHA1 git hash for the tree containing the kernel. So if we go to the right kernel repository (See my previous entry about that) all we have to do is checkout that tree:
git checkout 24ee4d2
Lastly, we need the configuration for the kernel. Luckily the Android kernel usually has a copy in the /proc directory called /proc/config.gz. All we have to do is copy that to the kernel directory, gunzip it, rename it .config and run:
make oldconfig
This command will prompt for any new options that are not defined in the .config file so if we found the right kernel tree and config file, there will be no prompts. If there are prompts, keep searching because you haven’t found it yet. I’m not sure exactly what happens when you patch the kernel, build it, and don’t commit it in because there wouldn’t be a SHA1 generated. Let’s just hope the Android developers don’t do that… seriously, that’s bad…
