Module 14 · Lesson 24 of 92

Early UART and earlycon

Configure early serial output in U-Boot and Linux, capture a reset-to-console log, and diagnose a device tree error that suppresses early kernel messages.

  • Beginner to advanced
  • 8 min read
  • 40 min lab
What you will need

Ubuntu 24.04 in WSL2 or a VM with access to a USB serial adapter, or a native Ubuntu 24.04 host. A BeagleBone Black, a 3.3 V TTL USB serial adapter, and the working U-Boot, kernel and device tree build setup from the previous lesson.

Your place in the module
By the end you can 4 objectives
  • Configure and verify U-Boot debug UART output before its normal console starts.
  • Select a Linux boot console using an explicit earlycon argument or the device tree stdout-path.
  • Distinguish U-Boot output, Linux boot-console output and regular Linux console output in a serial capture.
  • Diagnose and repair an injected stdout-path error using serial captures and a one-variable comparison.
Video coming soonEarly UART and earlycon
The video for this lesson is being recorded. Read the lesson below in the meantime.
Recall first from Booting the kernel and first install
  • An ITS describes the payloads and configurations that mkimage packages in an ITB.
  • bootcmd controls U-Boot autoboot, while bootargs carries the Linux command line.
  • The extlinux boot method reads kernel paths and command-line arguments from extlinux.conf.
01

Get output before the U-Boot console

4 min read

In the last lesson you installed U-Boot and booted the kernel, but a fresh port usually dies before any normal console appears. This lesson answers how early UART and earlycon give you output from the very first lines of a port.

A serial capture can go quiet as U-Boot transfers control to Linux, then resume when Linux registers the regular serial console. The kernel can generate messages during that gap and print them later from its log buffer. If the kernel stops during the gap, you can lose the chance to see those messages on the wire. Linux documents earlycon for exactly this interval. With early output enabled, the order in which bytes reach the host gives you evidence about when each console became usable. The kernel's command-line parameters

A needs a working input clock, accessible registers and a transmit pad routed to the serial connector. Both U-Boot and Linux can use the same UART. Each stage needs code that knows how to access it, and the UART must be usable when that code first writes. A wrong register layout can leave the terminal silent or stall a polling write. A baud mismatch can produce garbled characters even while the boot code keeps running.

Serial output during bootU-Bootdebug UARTdirectregisteraccessU-BootconsolenormalbootloaderoutputLinux bootconsoleearlykerneloutputRegularLinuxconsolecontinueskerneloutputU-Bootdebug UARTdirectregisteraccessU-BootconsolenormalbootloaderoutputLinux bootconsoleearlykerneloutputRegularLinuxconsolecontinueskerneloutput
The serial stream can contain output from four different points in the boot

Start with the BeagleBone Black's UART0 debug serial header and a 3.3 V TTL adapter. With the board powered off, connect board ground to adapter ground and board TX to adapter RX. Add adapter TX to board RX if you need to use the U-Boot prompt. Leave the adapter's power lead disconnected. Set the host terminal to the board's working console settings, typically 115200 baud, eight data bits, no parity, one stop bit and no flow control for this setup. Test against a known boot image first. If the host is Ubuntu under WSL2 or in a VM, confirm that the adapter is visible inside that environment before using its terminal program.

In the U-Boot build for the port, enable CONFIG_DEBUG_UART and select the backend for the UART you wired. For the BeagleBone Black UART0, U-Boot v2025.10 offers a generic NS16550 backend, CONFIG_DEBUG_UART_NS16550, and an OMAP one, CONFIG_DEBUG_UART_OMAP (it depends on CONFIG_OMAP_SERIAL). Both need parameters like these. The settings include CONFIG_DEBUG_UART_BASE for the UART register base, CONFIG_DEBUG_UART_CLOCK for the UART input clock and CONFIG_DEBUG_UART_SHIFT for the register spacing. The shift is two for registers spaced four bytes apart. Use the board's serial setup and the SoC documentation to check those settings. The input clock is the frequency supplied to the UART. The baud rate is the bit rate measured on the serial wire.

The option builds the debug path. The startup code in the image you're testing must also call debug_uart_init() after any clock and pad setup that the UART requires. Check the board's existing startup code for that call before adding one. In U-Boot v2025.10, arch/arm/mach-omap2/am33xx/board.c has a board_debug_uart_init() function under CONFIG_DEBUG_UART_BOARD_INIT for exactly this pad and clock setup. CONFIG_DEBUG_UART_ANNOUNCE enables an announcement from the debug UART initialisation path. That announcement gives you a recognisable marker before the normal U-Boot console, provided the init call runs early enough. To narrow the result further, add a short printascii() marker immediately after a specific early operation and compare its position with the rest of the capture.

Check which image actually executes the code you edited. A call in full U-Boot tells you about full U-Boot. For a marker in SPL, the debug UART code and the call must be present in the SPL build, and the UART must be usable at that point in SPL. Rebuild and boot the matching image from your test medium. Open the host capture before reset. Seeing the normal U-Boot banner proves the serial connection works by the time that banner is printed. Verify the early marker separately.

02

Select the Linux boot console

3 min read

Linux printk records messages in the kernel log. A gives you early output on the UART. On the device-tree boot used here, there are two ways to select one with earlycon. You can give the kernel the UART backend and address explicitly, or let it use the UART named by /chosen/stdout-path.

For an explicit selection on the BeagleBone Black's AM335x UART0, append the following argument to the existing kernel command line. Keep the arguments that let the image boot, including its working regular serial console= setting.

text
earlycon=uart8250,mmio32,0x44e09000

Here uart8250 selects the generic 8250 early console, mmio32 selects 32-bit memory-mapped accesses with four-byte register spacing for this backend, and 0x44e09000 is the physical base of AM335x UART0. With this form and no baud option, the 8250 early console relies on the UART having already been configured. Leave U-Boot's UART clock, pin routing and serial settings usable at handoff. Use this address only for that UART on the AM335x. On another board, verify the backend, physical address and access mode from the board's hardware description and kernel documentation before issuing an explicit register access.

For selection from the device tree, replace the explicit argument with bare earlycon. Check the DTB that U-Boot will pass to Linux. In that tree, /chosen/stdout-path should name the intended UART by full node path or by an alias that resolves to it. For a tree in which serial0 maps to the wired UART, the property can read stdout-path = "serial0:115200n8";. The suffix supplies serial options. Linux uses the UART node's compatible string to find a matching early console backend, and gets the register location from the device tree. A spelling error in the alias, a different DTB at boot or a missing compatible match can each prevent this form from producing the intended output.

Two ways to select earlyconExplicitearlyconBare earlyconUART selectionCommand-lineaddressChosenstdout-pathBackendselectionCommand-linenameUART nodecompatibleRegisterlocationPhysical baseargumentTranslatedUART reg
Explicit earlycon supplies the UART location directly, while bare earlycon gets it from the boot device tree

Check the kernel configuration used to build the actual image. For this example, build in the 8250 serial driver and its console support with CONFIG_SERIAL_8250=y and CONFIG_SERIAL_8250_CONSOLE=y. Check that CONFIG_SERIAL_EARLYCON=y is present in the resulting configuration. For the AM335x OMAP 8250 driver path, also check CONFIG_SERIAL_8250_OMAP=y. Confirm that your regular console= argument uses the tty name of the wired port in your working image. The regular console needs its own working configuration so it can continue printing after the boot console is retired. A serial driver you plan to load later as a module is unavailable during early boot.

You will also encounter earlyprintk= and CONFIG_DEBUG_LL in board bring-up notes. earlyprintk= is an older, architecture-specific kernel command-line interface. On 32-bit ARM, the legacy early serial output support uses a low-level backend selected through CONFIG_DEBUG_LL, with CONFIG_EARLY_PRINTK enabling the early printk console where offered. The low-level backend is built for specific hardware and provides routines that early code can call directly. Check the architecture, build options and UART selection before using old instructions. earlycon uses its own built-in backend and works independently of CONFIG_DEBUG_LL.

03

Read the capture in boot order

3 min read

Keep the raw host-side serial log from reset through the regular Linux console. Record the U-Boot image, kernel image, DTB and effective boot arguments alongside it. If the terminal program can timestamp received data, use those timestamps to compare when output arrives on the wire. Kernel message timestamps record when messages were generated. A regular console can replay buffered messages, so an early kernel timestamp in a later burst of text is compatible with late serial delivery.

Find the U-Boot debug marker, the normal U-Boot output and the messages around the kernel transfer. In the Linux output, look for boot-console registration, regular serial console registration and boot-console retirement. Exact messages and the amount of visible output depend on the image and its log settings. Keep those settings consistent across comparisons. If needed during diagnosis, remove quiet from the test command line so that ordinary informational messages are easier to observe. An enabled boot console can only transmit once kernel execution reaches its setup code.

Isolate the early console faultCapturebaselinebareearlyconBreak UARTaliascompareserialoutputSelect UARTexplicitlyboot thefaulty treeRestorevalid aliasretest bareearlyconCapturebaselinebareearlyconBreak UARTaliascompareserialoutputSelect UARTexplicitlyboot thefaulty treeRestorevalid aliasretest bareearlycon
Compare the known-good, faulty and repaired boots from reset on the same serial connection

A misspelled stdout-path alias makes a controlled first-port fault. In a copy of the known-good DTB's source, make the property refer to an alias verified absent from /aliases. Leave the UART node intact and keep a working explicit console= argument for the regular serial console. Boot that test DTB with bare earlycon. Compare the capture against one made with the working DTB and the same command line. If the early Linux interval disappears and the regular console still prints, you have narrowed the problem to early output. The later console provides evidence that the kernel progressed through the gap.

To check the cause, boot the faulty DTB again with the explicit earlycon argument for the same UART. If early output returns, the UART, serial connection and explicit backend worked on that run. Compare the two versions of /chosen/stdout-path and resolve the alias against /aliases in the DTB actually loaded. Restore the valid property and repeat the bare earlycon boot. Recovery under the original command line ties the missing output to the alias error. Keep the captures and note exactly what changed between them.

Before you conclude that a port stopped at its last visible line, ask what the line actually proves. A U-Boot marker proves that execution reached its print in that U-Boot image. Early Linux output proves the kernel reached usable boot-console setup. When the last marker precedes the point you need to observe, the next lesson, Connecting JTAG and OpenOCD, explains how to connect a debugger and inspect execution while the serial terminal is silent.

Key takeaways

  • U-Boot debug UART and Linux earlycon are configured independently.
  • Bare earlycon can select a supported UART from /chosen/stdout-path on a device-tree boot.
  • Linux earlycon is a temporary output console. A built-in regular serial console can take over and continue printing.
  • A gap in serial output can come from console selection even when the kernel continues running.
Reflect
  1. Explain to a colleague, in two sentences: configure and verify U-Boot debug UART output before its normal console starts.
  2. Which objective are you least sure about? Re-read that section, then do its exercise in the practice pack.
  3. What surprised you when you ran the commands yourself?
On a real board

Repeat the key commands on your Raspberry Pi or lab board over SSH or the serial console. Note anything that behaves differently from your PC, such as missing tools, a BusyBox shell or a read-only filesystem.

References and further reading

Find your next step

↑ ↓ to move · Enter to open · Esc to close