Kgdb with aosp kernel



Hi. I’ve just started working with the hikey960. I’m trying to achieve kernel debugging with an aosp kernel. I’m close but my issue is that the board reboots (possibly a watchdog in the bootloader, maybe???). I’m using the uart daughter board for my serial connection

Here are my steps

  1. Following directions on aosp site for buiding with the hikey for kernel version 4.9
  2. Built modified kernel v4.9 for hikey with kgdb enabled in the .config
  3. Copy .dtb and image files to hikey-kernel in aosp and build
  4. Modified the boot args to add “kgdboc=ttyFIQ0,115200 kgdbretry=4”
  5. Flash images to board with fastboot
  6. Through the serial connection on my host (/dev/ttyUSB0), I can see all the bootup messages
  7. adb shell to my device, run su and then echo -n g > /proc/sysrq-trigger
  8. I see in my serial output “sysrq: SysRq : DEBUG” and “KGDB: Entering KGDB”
  9. Wait about 10 secs and the board reboots into fastboot mode

Do I need to disable a timer somewhere???

Note: If I’m fast enough, I can connect with gdb and set breakpoints and call “info reg” and “where” commands. But eventually, the board hangs and gdb no longer gets responses to commands. I have to power cycle the board if I had attached gdb. If I hadn’t attached gdb, the board just reboots into fastboot.

Thanks for your help


It appears I found the answer.
In the kernel .config, disable the CONFIG_WATCHDOG_* as well as the CONFIG_ARM_SP805_WATCHDOG parameters
Rebuild the kernel and boot image and flash to the hikey