Thursday, June 2, 2011

Debugging Output

The main goal for this week has been to get debugging output coming from the kernel. I first focused on the android-kmsg system, which involved merging over 'android/hw-kmsg.*' and 'charpipe.*', but that approach was incorrect. With further testing, I found that kernel output from the Android Emulator could be obtained even with bypassing that message passing system and instead utilizing the existing system in QEMU with the command line arguments "-append "console=ttyS0" -serial stdio", so those elements weren't needed at this time.

The needed elements for setting up correct outputs are contained in 'hw/goldfish_tty.c' and 'hw/goldfish_device.c'. After moving those files and including necessary dependencies, I added the needed initializing function calls into the init function for the arm machine and managed to get some output. As of now, however, I am only able to get the "Uncompressing Linux....done, booting the kernel." message and nothing else. This message does not show up without these changes, and uses the ported system to produce output, so I am on the right track, I'm just busy tracing through that system to see what I missed.

The patch can be found here, applied to mainline QEMU it will produce output when run with the below command. The files 'kernel-qemu' and 'ramdisk.img' can be found under platforms/android-[version]/images/ in the SDK after installing a version of the SDK Platform.

qemu-system-arm -kernel /path/to/kernel-qemu -initrd /path/to/ramdisk.img -append "console=ttyS0" -serial stdio

**Note: The option "-append "console=ttyS0"" does not affect the output at this time because it dictates to the kernel where to send it's messages and I'm not seeing those yet.

1 comment:

  1. The reason for this is that the goldfish virtual tty devices are never initialized by your change. As such, the goldfish kernel never sees a tty device to connect to.

    In the Android emulator codebase, this initialization is done by hw/android_arm.c, you may need to port this to whichever ARM board you're currently trying to emulator.