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

Thursday, May 14, 2009

ah rolled mah very own kernel fur mah fone

I actually rut mah fone a few days ago. Just now I finally managed to build a kernel for it. The Android system source (hereinafter '...') (not to be confused with the SDK) comes with kernel source, but by default uses a pre-built image instead of compiling it. First thing one needs to do is follow the link above and install the source.

Then one needs to follow this Building for Dream link and do what it says.

The kernel source tree comes in various different flavors, at present including 2.6.2[579]. 2.6.29 wouldn't build for me, but 2.6.27 did and booted and runs. You select a version by editing the .../.repo/local_manifest.xml file which you installed while getting ready to build your dream.

Note that these are not vanilla kernel sources: there is a lot of source in .../arch/arm/mach-msm which is not in the vanilla tree. I was able to build and load a plausible kernel from the vanilla tree, but it didn't run.

One must get a .config file and put it at the root of the kernel tree. Get it from your phone (/proc/config.gz) either by way of your SD card or by something like adb pull /proc/config.gz config.gz; gunzip config.gz adb will be in .../out/host/linux-x86/bin/ which you can add to your path via cd .../out/host/linux-x86/bin/; export PATH=$PATH:`pwd`.

Assuming you have gotten the source, you must add .../prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin to your path, since you won't be building with generic gcc.

When everything is in place, one goes into the kernel tree and does make ARCH=arm CROSS_COMPILE=arm-eabi- oldconfig then make ARCH=arm CROSS_COMPILE=arm-eabi- all The kernel image ends up being "zimage" in kernel/arch/arm/boot

Having built the kernel and the rest of the source, one can use fastboot to load the kernel image and a ramdisk by doing something like cd /out/target/product/dream fastboot boot .../kernel/arch/arm/boot/zImage ramdisk.img which is as far as I have gotten so far. I'll worry about installing kernels later.

No comments: