build: dtc: Disable noisy warnings by default

While helping with review and build testing of a few 4.19 pull requests,
I've noticed, that dtc compiler in OpenWrt uses different options then
upstream kernel, which is leading to a very noisy output[1]. It wouldn't
be that bad per se, but a lot of such warnings aren't easily fixable so
I think, that we should follow what upstream does and simply ignore^W
silence those noisy warnings.

So this patch tries to syncs dtc compiler flags with upstream kernel
till version 4.19.13, disabling those warnings as they were added in
upstream kernel:

 v4.6-rc1-2-gbc55398 dtc: turn off dtc unit address warnings by default

  The newly added dtc warning to check DT unit-address without reg
  property and vice-versa generates lots of warnings. Turn off the check
  unless building with W=1 or W=2.

 v4.11-rc2-11-g8654cb8 dtc: update warning settings for new bus and node/property

  dtc gained new warnings checking PCI and simple buses, unit address
  formatting, and stricter node and property name checking. Disable the
  new dtc warnings by default as there are 1000s. As before, warnings are
  enabled with W=1 or W=2. The strict node and property name checks are a
  bit subjective, so they are only enabled for W=2.

 v4.16-rc3-9-g4fd98e3 scripts: turn off some new dtc warnings by default

  The latest dtc update adds some new noisy warnings, so turn them off by
  default. Disable 'avoid_unnecessary_addr_size' and 'alias_paths'. They
  can be re-enabled by building with 'W=1'.

 v4.17-rc1-27-g74656b6 kbuild: disable new dtc graph and unit-address warnings

  dtc gained some new warnings for OF graphs and unique unit addresses,
  but they are currently much too noisy. So turn off
  'graph_child_address', 'graph_port', and 'unique_unit_address' warnings
  by default. They can be enabled by building dtbs with W=1.

Build tested on imx6 and ath79 with 4.14 and 4.19.

1. https://github.com/openwrt/openwrt/pull/1694#issuecomment-450864335

Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
Petr Štetiar 2019-01-07 01:08:05 +01:00 committed by Hauke Mehrtens
parent 7d188fb4db
commit cbbef976e2

View File

@ -152,6 +152,32 @@ ifdef CONFIG_TARGET_IMAGES_GZIP
endef
endif
# Disable noisy checks by default as in upstream
ifeq ($(strip $(call kernel_patchver_ge,4.6.0)),1)
DTC_FLAGS += -Wno-unit_address_vs_reg
endif
ifeq ($(strip $(call kernel_patchver_ge,4.11.0)),1)
DTC_FLAGS += \
-Wno-unit_address_vs_reg \
-Wno-simple_bus_reg \
-Wno-unit_address_format \
-Wno-pci_bridge \
-Wno-pci_device_bus_num \
-Wno-pci_device_reg
endif
ifeq ($(strip $(call kernel_patchver_ge,4.16.0)),1)
DTC_FLAGS += \
-Wno-avoid_unnecessary_addr_size \
-Wno-alias_paths
endif
ifeq ($(strip $(call kernel_patchver_ge,4.17.0)),1)
DTC_FLAGS += \
-Wno-graph_child_address \
-Wno-graph_port \
-Wno-unique_unit_address
endif
# $(1) source dts file
# $(2) target dtb file
# $(3) extra CPP flags
@ -164,7 +190,7 @@ define Image/BuildDTB
-undef -D__DTS__ $(3) \
-o $(2).tmp $(1)
$(LINUX_DIR)/scripts/dtc/dtc -O dtb \
-i$(dir $(1)) $(4) \
-i$(dir $(1)) $(DTC_FLAGS) $(4) \
-o $(2) $(2).tmp
$(RM) $(2).tmp
endef