Search code examples
androidandroid-2.2-froyoandroid-source

Integrating custom Android kernel builds with SDK


I'm extending a custom Android kernel fork that originated as a 2.2 Froyo kernel. The build process itself is no problem; just type "make" and its done. But I'm not sure of what I need to do to make the new kernel known to other tools in the Android SDK; particularly the emulator, adb, and the Eclipse debugger.

I've tried various things such as running the emulator with -system and -userdata arguments on the command line, and these appear to work, although I hit sporatic problems that leave me unsure. A common problem I've seen is that sometimes apps "hang", displaying their UI but refusing to go away even when the home or menu buttons are clicked. I've tried turning off caching. But the real problem here is that I don't have a good mental model of how kernel builds should be conveyed to the SDK.

Should I be copying the build results (.img files) to ~/.android/ perhaps? Or to somewhere in the SDK folder?

A working recipe would be nice, but better yet would be a understanding of how the kernel build and SDK tools work together. For example http://source.android.com/source/using-eclipse.html is great for recipes but I still don't see how adb and emulator know where to load .img files from.


Solution

  • When you've built android image the android webpage recommends to run it with emulator command. But you can run the built image in this way because android envsetup command has specified some paths before. For instance, to test my built image I run command:

    out/host/linux-x86/bin/emulator -sysdir out/target/product/generic/ -system out/target/product/generic/system.img -ramdisk out/target/product/generic/ramdisk.img -data out/target/product/generic/userdata.img -kernel prebuilt/android-arm/kernel/kernel-qemu -sdcard sdcard.img -skindir sdk/emulator/skins -skin WVGA800 -scale 0.7 -memory 512 -partition-size 1024
    

    So as you can see I specify all the images and all the paths explicitly. This is command to run image in emulator. Out folder is created during the build in your android source root folder.

    P.S. Kernel usually refers to Linux kernel of Android. In your case, I think you have changed Android framework.