How to debug a custom Linux Kernel on a remote machine?
I have a remote machine with a custom-built Linux Kernel originally from 5.6.8. The system under the kernel is running into problems which I want to fix. The kgdb-related options are
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
# CONFIG_KGDB_TESTS is not set
CONFIG_KGDB_LOW_LEVEL_TRAP=y
CONFIG_KGDB_KDB=y
The kgdboc module is compiled builtin. The documentation of kgdb describes how to use terminal with a serial port. Here is how it is configured on the remote machine:
root@remote-pc:# cat /sys/module/kgdboc/parameters/kgdboc
ttyS0,115200
Using ssh I issued
root@remote-pc:~# echo g > /proc/sysrq-trigger
And after running gdb vminux what port should I use to connect to the remote Kernel?
(gdb) target remote remote-pc:__what_port?__
You cannot connect to a literally remote machine through a serial port. What you want to use is KGDB Over Ethernet (kdgboe). See How to use kgdb over ethernet (kgdboe)?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With