Debugging Android Kernel

2,710 views
Skip to first unread message

Marc Marí

unread,
Dec 18, 2013, 12:20:28 PM12/18/13
to android...@googlegroups.com
Hello

I am new to Android and to Kernel development, but I would like to test some things. I just finished compiling the first version of my modified kernel, and put it in a phone. Obviously, it doesn't work. How can I debug the kernel on the mobile phone? I read things about kgdb, but I have not been able to make it work, any quick guides? Can I print messages to phone screen?

(I am using msm kernel)

Thank you in advance

Marc Marí

unread,
Dec 19, 2013, 5:55:26 AM12/19/13
to android...@googlegroups.com
I'll add more data about my problem, and what I already tested:

I'm working over a Nexus 5 (MSM architecture, Linux 3.4.0 based). The .config used is the one by default (hammerhead_defconfig). When the kernel is booted, it only shows the Google screen, and stops there, forever.

I tried (with a working boot image) changing the 'console' parameter when generating the image with mkbootimg (tty, tty0, ttyHSL0), and I tried with different .config options as MSM_SERIAL_DEBUGGER (compilation error), FIQ_DEBUGGER (compilation error) and SERIAL_MSM (compiled, but no difference). I was looking for the addition of a device in my computer.


2013/12/18 Marc Marí <5.mar...@gmail.com>

--
--
unsubscribe: android-kerne...@googlegroups.com
website: http://groups.google.com/group/android-kernel
---
You received this message because you are subscribed to the Google Groups "Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-kerne...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ramesh rama

unread,
Dec 19, 2013, 6:21:38 AM12/19/13
to android...@googlegroups.com
I am also new to ANdroid and kernel development . i am doing for x86  plase give me some suggestions.


Thanks in advance 

Eric

unread,
Jan 1, 2014, 9:56:54 PM1/1/14
to android...@googlegroups.com
Well, since you are using a real device, i would suggest you try connecting to
it using ADB (android debug bridge). I've found that even when the google
screen is still up you can connect using adb and examine the logs or poke
around with a text terminal.



Marc Marí

unread,
Jan 2, 2014, 4:44:58 AM1/2/14
to android-kernel

When the Google screen is up, if I execute "adb devices" there are no devices listed. In a working Kernel, I can use adb in the inmediately next screen, the boot animation.

I'm woking on other ideas that involve electronics and seem promising. In the next days I'll be able to try it.

Thank you for your answer!

Max von E

unread,
Jan 5, 2014, 6:17:51 PM1/5/14
to android...@googlegroups.com
First you have to check if developer options -> USB Debuging is enabled.
Then you can (if you are root or by issuing su command in adb shell) use dmesg to see kernel messages aswell as logcat.
If you have the sources and it's the kernel you have compiled by yourself you can add prinkt("my messgage") to the lines you want to check, then find it in dmesg output. 
if your device is not booting and you have no chance to trace the failure - you can check like this in the adb shell : cat /proc/last_kmesg 
This will show you the last output before the device died. But in most cases in the -user releases of kernel this option is disabled, so the best debugging output you can get if you compile an -eng variant.

Marc Marí

unread,
Jan 15, 2014, 1:06:23 PM1/15/14
to android-kernel
I finally managed to get a low-level debugging option using a UART terminal. And it works perfectly:


(Note that Nexus 5 needs a higher input voltage, like 3.3V)


2014/1/6 Max von E <max...@gmail.com>

jduck

unread,
Jan 31, 2014, 12:35:35 PM1/31/14
to android...@googlegroups.com
Thanks Mark. Glad you like the cable and we hope it works well for you!
Reply all
Reply to author
Forward
0 new messages