Skip to content
systemcoding.dev
Embedded Linux

Turn off one dtc warning with -Wno-unit_address_vs_reg

Silence one noisy dtc warning with -Wno-unit_address_vs_reg while keeping the other checks on, using dtc 1.7 flags on a board device tree.

1 min read
Summarize in AI

When dtc prints a warning you have already decided to live with, switching all warnings off hides real mistakes later. The compiler lets you turn off exactly one check by name.

Shell
dtc -I dts -O dtb -Wno-unit_address_vs_reg -o board.dtb board.dts

The command prints nothing when it succeeds, which is why there is no output to show. Without the flag, a node written as serial@12000 that has no reg property, or a mismatch between the two, produces a warning such as Warning (unit_address_vs_reg): /soc/serial@12000: node has a unit name, but no reg or ranges property. Every check has a name, and the warning text shows it in the parentheses, so you can copy it into a -Wno- option.

The opposite also works. -Werror turns every remaining warning into an error, so -Wno-unit_address_vs_reg -Werror is a strict build that tolerates one known issue. In the kernel tree you rarely call dtc yourself: the per-directory DTC_FLAGS variable in a Makefile carries the same options, as in DTC_FLAGS_board := -Wno-unit_address_vs_reg.

Use it for vendor trees you cannot fix, not for your own. The warning is usually right, because a unit address that disagrees with reg breaks the way tools and the kernel name the device. See the dtc manual.

Also inKernels
Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.