Kernel log messages are the primary source of information for diagnosing boot
failures, driver problems, and runtime errors. This page covers how to get those
messages out of the device: via serial console, early boot console, runtime log
commands, and log-level control.
Serial console
The Qualcomm® Linux kernel uses the Qualcomm Generic Interface (GENI) serial
driver to support the UART console on Qualcomm SoCs.
Required kernel configuration
Verify that the following Kconfig options are enabled:
zcat /proc/config.gz | grep -E "CONFIG_SERIAL_QCOM_GENI"
# Expected:
# CONFIG_SERIAL_QCOM_GENI=y
# CONFIG_SERIAL_QCOM_GENI_CONSOLE=y
If either is missing, enable them in the kernel defconfig or a .cfg fragment
and rebuild.
Add the serial console to the kernel command line
Add the console= parameter to KERNEL_CMDLINE_EXTRA in
meta-qcom/conf/machine/include/qcom-<SoC>.conf:
KERNEL_CMDLINE_EXTRA ?= "root=/dev/disk/by-partlabel/system rw rootwait \
console=ttyMSM0,115200n8 pcie_pme=nomsi earlycon"
| Parameter | Meaning |
|---|
console=ttyMSM0,115200n8 | Route kernel log output to the first Qualcomm GENI UART at 115200 baud, no parity, 8 data bits |
earlycon | Enable the early console before driver init (see below) |
Connect hardware
Connect a USB-to-UART cable between the device and the host:
Device UART header → USB-UART adapter → Host USB port
On the host, open the serial port at 115200 baud using any terminal emulator
(minicom, screen, PuTTY, or Tera Term):
# Linux example
minicom -D /dev/ttyUSB0 -b 115200
For upstream documentation, see
Linux Serial Console.
Early boot messages (earlycon)
The earlycon kernel parameter enables a minimal early console before the full
UART driver is initialised. It provides kernel messages from the very start of
the boot sequence, including the unpack of the initramfs and early device tree
processing, that would otherwise be invisible.
Add to the kernel command line:
On Qualcomm SoCs the early console uses the same ttyMSM0 UART. Messages
appear immediately from the first line of start_kernel().
earlycon and console=ttyMSM0,... are independent. Use both together
to get uninterrupted output from early boot through the login prompt.
printk log levels
printk is the kernel’s logging function. Every message carries a log level
that controls whether it appears on the console.
Table: printk log levels
| Level | Macro | Value | Meaning |
|---|
| Emergency | pr_emerg / KERN_EMERG | 0 | System is unusable |
| Alert | pr_alert / KERN_ALERT | 1 | Action must be taken immediately |
| Critical | pr_crit / KERN_CRIT | 2 | Critical conditions |
| Error | pr_err / KERN_ERR | 3 | Error conditions |
| Warning | pr_warn / KERN_WARNING | 4 | Warning conditions |
| Notice | pr_notice / KERN_NOTICE | 5 | Normal but significant condition |
| Info | pr_info / KERN_INFO | 6 | Informational |
| Debug | pr_debug / KERN_DEBUG | 7 | Debug-level messages |
Messages with a level numerically lower than the current console log level are
printed to the console. The default console log level on Qualcomm Linux is 7
(all messages printed). With the default console log level of 7, messages at
levels 0–6 (Emergency through Info) reach the console. Set the level to 8 to
include debug output.
Runtime log level control
Read and set the console log level at runtime via /proc/sys/kernel/printk.
The file contains four space-separated values:
<current> <default> <minimum> <boot-time-default>.
# Read current log level
cat /proc/sys/kernel/printk
# Example output: 7 4 1 7
# Set console log level to 4 (warnings and above only)
echo "4" > /proc/sys/kernel/printk
# Suppress all but emergencies (useful for release/performance tests)
echo "1" > /proc/sys/kernel/printk
Boot-time log level
Set the log level on the kernel command line to control verbosity before
/proc is mounted:
loglevel=4 # warnings and above
quiet # equivalent to loglevel=4 with reduced output
loglevel=0 # silence all output (only KERN_EMERG passes)
Read the kernel log buffer
dmesg
The most common way to read the kernel ring buffer:
dmesg # full buffer
dmesg | head -50 # first 50 lines (early boot)
dmesg | tail -50 # most recent 50 lines
dmesg --level=err,warn # errors and warnings only
dmesg -T # human-readable timestamps
dmesg -w # follow (like tail -f)
/proc/kmsg
virtual proc file that provides a live stream of kernel messages. Each read
returns new messages only:
cat /proc/kmsg # streams kernel log (Ctrl+C to stop)
Persistent logs across reboots
On systems running systemd-journald, kernel messages are stored persistently
and can be queried across boots:
journalctl -k # kernel messages from the current boot
journalctl -k -b -1 # kernel messages from the previous boot
On systems without journald, kernel messages may be written to syslog files:
cat /var/log/kern.log # Debian/Ubuntu style
cat /var/log/messages # RHEL/embedded style
Disable console logging
To silence the console for production or performance testing:
# Kernel command-line options (choose one):
quiet # suppress informational messages
console=null # discard all console output
loglevel=0 # only KERN_EMERG messages pass
Alternatively, disable the early console drivers in Kconfig for a fully silent
build:
# CONFIG_SERIAL_EARLYCON is not set
# CONFIG_SERIAL_MSM_CONSOLE is not set
Debug builds
To include debug symbols and extra debug Kconfig in the Yocto image, pass
DEBUG_BUILD=1 to the bitbake invocation. This enables debug.config fragments
in the kernel build:
# Inside the kas shell
DEBUG_BUILD=1 bitbake qcom-multimedia-image
Or add it permanently to build/conf/local.conf: