ctxis / kgdb-android

Patches to the Nexus 6 (Shamu) kernel source to allow KGDB over serial debug cable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kgdb-android

Kernel patches to get KGDB working on the Nexus 6.

For background, please see associated blog post at http://www.contextis.com/resources/blog/kgdb-android-debugging-kernel-boss

  1. Root your Nexus 6!

  2. Download and build the stock Nexus 6 kernel (kernel/msm) using instructions from https://source.android.com/source/building.html

  3. Download this directory structure into the root of your kernel source (kernel/msm/) including the .config file.

  4. Re-build your kernel source.

  5. Create your boot image, passing console arguments e.g. to update a stock image I used: abootimg -u boot.img -k zImage-dtb -c 'cmdline=console=ttyHSL0,115200,n8 kgdboc=ttyHSL0,115200 kgdbretry=4'

  6. Boot your phone into the bootloader (adb reboot bootloader) and on your host run:

    fastboot oem config console enable

  7. Reboot into bootloader again

  8. Plug in your debug cable (see blog)

  9. Boot your image e.g. fastboot boot boot.img

  10. Open a shell (adb shell), su to root, then type:

    echo -n g > /proc/sysrq-trigger

  11. Hit enter

  12. On your host machine fire up GDB (you'll need a working version of GDB cross-compiled for ARM):

    arm-eabi-gdb ./vmlinux
    (gdb) set remoteflow off
    (gdb) set remotebaud 115200
    (gdb) target remote /dev/ttyUSB0

You should hit the KGDB breakpoint and be able to continue, examine memory, etc.

About

Patches to the Nexus 6 (Shamu) kernel source to allow KGDB over serial debug cable


Languages

Language:C 100.0%