Troubleshooting KGDBoc Startup on Linux 3.2 Cortex-A8

Daniel Price8 min read
Other ManufacturerSerial CommunicationTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

The request path starts at the host GDB session, crosses the serial adapter and wiring, enters the target UART, passes through the active Linux TTY driver, and reaches the KGDB-over-console transport. Follow that path in order. In this case, the decisive break was before KGDB configuration or UART polling: the bootloader loaded a different kernel image from the one prepared for debugging.

What path must carry the GDB request?

KGDB cannot exchange packets until the target kernel has initialized the selected transport. For kgdboc=ttyO0,115200n8, the transport is the console-capable serial device named ttyO0. The host and target settings must agree, but matching serial settings cannot compensate for an incorrect kernel image or an inactive TTY driver.

Hop Required condition Reading or observation
Host debugger Uses the serial interface connected to the target Confirm the selected host device and that no terminal program owns it
Adapter and wiring Carry transmit, receive, and reference signals in both directions Observe boot text and test host-to-target reception
Target UART Operates as the device represented by ttyO0 Match the boot console identity against the board configuration
TTY driver Provides console polling callbacks in the running build Inspect the active driver and its registered UART operations
KGDB transport Parses kgdboc=ttyO0,115200n8 Look for a KGDB initialization or waiting message
KGDB core Stops after the transport becomes usable when kgdbwait is present Confirm that boot pauses for the remote debugger

The serial format in the attempted configuration is 115200n8: 115200 baud, no parity, and eight data bits. Flow control is not specified by that token. Read the target driver and host serial configuration rather than adding an assumed flow-control mode.

Does the physical serial path work in both directions?

Layer one first. Visible boot output proves that target transmit data reaches the host; it does not prove that bytes from the host reach the target UART. KGDB requires both directions. Check the target receive path with a monitor, bootloader input, or another receive test before treating a silent GDB session as a protocol fault.

The description calls the connection a “232 port” while also discussing a USB hub or converter. Do not infer the electrical interface from the connector or operating-system device name. Read the board schematic and adapter specification to determine whether level conversion is present. A signal-level mismatch can allow misleading partial behavior or damage hardware.

A USB-to-serial converter on the host side remains outside the target kernel. The host USB stack drives the converter, while the target still sees its hardware UART. The target therefore does not need USB polling callbacks merely because the host adapter plugs into USB. A target-side USB gadget console such as ttyGS0 is a different path: GDB packets would traverse the target USB gadget and serial-function stack instead of the hardware UART.

Observation Meaning Next check
No boot text at the host Target transmit path, baud format, console selection, or adapter path is wrong Correct the physical and console path before checking KGDB
Boot text is readable, but the target never receives host input The return path is open, crossed incorrectly, or owned by another host process Test host-to-target reception outside KGDB
Bidirectional serial traffic works The physical path can carry GDB packets Inspect the boot command line

Did the kernel receive the intended command line?

Read the command line printed by the running kernel, not only the bootloader environment. The captured line contains kgdboc=ttyO0,115200n8 and kgdbwait, so those tokens reached the kernel. It also contains ekgdboc=ttyO0,115200n8 and the suspicious neighboring text ip=nonen8. Remove duplicate, experimental, and misspelled tokens while diagnosing so the printed command line has one unambiguous transport selection.

Setting Purpose in this case Diagnostic interpretation
kgdboc=ttyO0,115200n8 Selects the serial console transport and format If printed intact, command-line delivery is not the first failure
kgdbwait Requests a boot stop after KGDB can provide its service No stop points to transport initialization, build configuration, or image identity
kgdb8250=ttyO0,115200n8 An alternative that was attempted Changing the token does not repair a wrong image or inactive driver
kgdbretry Another attempted command-line option It did not produce an initialization attempt in this installation
ekgdboc=ttyO0,115200n8 Extra token present in the captured line Remove it unless the running kernel explicitly implements that identifier

If either required token is absent or altered in the kernel log, correct the bootloader variable, quoting, spacing, and image-specific boot entry. If both are intact, continue to kernel identity. Repeatedly changing KGDB options at that point skips the stronger diagnostic.

Is the bootloader loading the kernel that was built?

Compare the complete Linux version banner with the build just produced. The first captured boot identifies Linux 3.2.18, compiler gcc 4.5.4 20120305 (prerelease), build host koen@dominion, build number #1, and timestamp Thu Jun 14 23:26:20 CEST 2012. That identity did not match the newly prepared debugging build.

A later boot identifies Linux 3.2.0, compiler 4.7.2 from Sourcery CodeBench Lite 2012.09-63, build host root@debian, build number #1, and timestamp Sun Jan 13 19:33:48 MSK 2013. These are different kernel artifacts, not two configurations of one running image.

Identity field First boot Later boot
Kernel release 3.2.18 3.2.0
Compiler gcc 4.5.4 20120305 (prerelease) gcc 4.7.2
Build identity koen@dominion root@debian
Build time Thu Jun 14 23:26:20 CEST 2012 Sun Jan 13 19:33:48 MSK 2013

If the release, build identity, timestamp, or other deliberately changed marker differs from the expected artifact, stop. Locate the image address, filename, storage partition, or boot entry actually selected by the bootloader. Replace that artifact and reboot. Configuration analysis of a file that did not produce the running kernel cannot explain runtime behavior.

Does the running build contain the required KGDB features?

After confirming image identity, inspect the configuration belonging to that exact image. The documented menu selections used here are Kernel hacking, Kernel debugging, KGDB: kernel debugger, and KGDB: use kgdb over the serial console. The UART polling code is guarded by CONFIG_CONSOLE_POLL, so that setting must also be active in the build that boots.

Built-in timing matters. kgdbwait acts during startup only after the KGDB core and selected transport initialize. If a required component is deferred until a loadable module becomes available, it cannot service an earlier boot-time stop. Check the link form in the kernel configuration rather than assuming that a selected menu item is built into the image.

The boot messages omap_hwmod: gfx: failed to hardreset, omap_hwmod: pruss: failed to hardreset, and hw-breakpoint: debug architecture 0x4 unsupported. identify other subsystems. They do not replace the missing KGDB transport message. Track them separately unless the boot fails before the serial driver and KGDB transport can initialize.

Does the active UART driver register polling operations?

The source shown for drivers/tty/serial/omap-serial.c implements serial_omap_poll_get_char and serial_omap_poll_put_char under CONFIG_CONSOLE_POLL. The receive function reads UART_LSR, returns NO_POLL_CHAR when UART_LSR_DR is clear, and otherwise reads UART_RX. The transmit function waits for the transmitter and writes through UART_TX.

Function definitions alone are not the whole check. The active UART driver's operations table must register callbacks through .poll_get_char and .poll_put_char, and the conditional code must be compiled. An example for another UART driver adds both functions under CONFIG_CONSOLE_POLL and assigns them in its UART operations table. Apply that structural check to the driver actually bound to the port.

The installation descriptions mention both the OMAP serial driver and a Serial: 8250/16550 driver. Resolve that ambiguity from the running kernel: inspect the boot registration, active console, device binding, and port identity. Checking polling functions in omap-serial.c proves nothing if ttyO0 is served by a different compiled driver, and checking the 8250/16550 implementation proves nothing if it is not bound to the selected port.

What procedure resolves and verifies the startup failure?

  1. Connect a serial terminal at 115200n8 and confirm readable boot output.
  2. Verify host-to-target traffic through the same adapter and wiring. Close any program that retains exclusive ownership of the host serial device.
  3. Capture the running kernel command line. Reduce it to one intended kgdboc=ttyO0,115200n8 token plus kgdbwait while testing.
  4. Capture the full Linux version banner and compare its release, compiler identity, build marker, and timestamp with the kernel just built.
  5. If the identities differ, correct the bootloader's image filename, address, partition, or boot entry, then reboot. This was the resolving branch for the recorded failure.
  6. For the confirmed image, check the four KGDB-related menu selections and CONFIG_CONSOLE_POLL. Confirm that the serial-console transport is built into the boot image.
  7. Identify the driver actually bound to ttyO0. Verify that its compiled UART operations register .poll_get_char and .poll_put_char.
  8. Reboot and watch for KGDB transport initialization followed by the waiting state requested by kgdbwait.
  9. Release the terminal's ownership of the serial device, connect the host GDB session through that same device, and verify that the target leaves the waiting state under debugger control.

KGDB is a kernel service, so it cannot debug instructions that execute before enough of the kernel exists to initialize KGDB and its transport. A graphical GDB front end does not move that boundary to the first instruction of start_kernel(). Use an earlier-stage debugging method when execution must stop before KGDB initialization.

FAQ

Can I stop at start_kernel() with kgdbwait?

No. kgdbwait can stop only after the kernel has initialized the KGDB core, the TTY layer, and the selected transport. A GDB graphical front end does not change that initialization boundary.

Does a host USB-to-serial adapter require a target USB driver?

No. The host USB stack manages the adapter while the target communicates through its hardware UART. Verify bidirectional serial traffic at 115200n8.

Can I use ttyGS0 instead of ttyO0?

Only when the target exposes a USB gadget serial function and the required target USB stack is available at the intended stop point. ttyGS0 and the hardware UART ttyO0 are different transport paths.

Does CONFIG_CONSOLE_POLL alone activate KGDB over serial?

No. CONFIG_CONSOLE_POLL compiles guarded polling support, but the running image also needs the KGDB debugger and serial-console transport selections, plus an active UART driver that registers both polling callbacks.

Can I verify that the correct KGDB kernel is running?

Compare the booted Linux version banner with the intended build, then confirm the printed command line contains kgdboc=ttyO0,115200n8 kgdbwait. The final verification is a KGDB waiting state followed by a successful host GDB connection through that serial path.

Back to blog