From 56f409c4e4df8b365b39a0bf9d2919814cc556a4 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 6 Jun 2023 13:01:15 +0100 Subject: [PATCH] image: introduce DEVICE_DTC_FLAGS and DEVICE_DTCO_FLAGS Handle compiling device tree overlay blobs separate to allow for overlays being compiled with different parameters, mostly to safe space. Allow defining DEVICE_DTC_FLAGS and DEVICE_DTCO_FLAGS as per-device parameters to be passed to dtc. Previously some boards directly used DTC_FLAGS in their build recipe which then also affected other boards. Signed-off-by: Daniel Golle --- include/image.mk | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/include/image.mk b/include/image.mk index 0cf110df93..fae4d32a8b 100644 --- a/include/image.mk +++ b/include/image.mk @@ -146,7 +146,7 @@ endif # Disable noisy checks by default as in upstream -DTC_FLAGS += \ +DTC_WARN_FLAGS := \ -Wno-unit_address_vs_reg \ -Wno-simple_bus_reg \ -Wno-unit_address_format \ @@ -159,6 +159,9 @@ DTC_FLAGS += \ -Wno-graph_port \ -Wno-unique_unit_address +DTC_FLAGS += $(DTC_WARN_FLAGS) +DTCO_FLAGS += $(DTC_WARN_FLAGS) + define Image/pad-to dd if=$(1) of=$(1).new bs=$(2) conv=sync mv $(1).new $(1) @@ -174,7 +177,7 @@ endef # $(2) target dtb file # $(3) extra CPP flags # $(4) extra DTC flags -define Image/BuildDTB +define Image/BuildDTB/sub $(TARGET_CROSS)cpp -nostdinc -x assembler-with-cpp \ $(DTS_CPPFLAGS) \ -I$(DTS_DIR) \ @@ -183,12 +186,20 @@ define Image/BuildDTB -undef -D__DTS__ $(3) \ -o $(2).tmp $(1) $(LINUX_DIR)/scripts/dtc/dtc -O dtb \ - -i$(dir $(1)) $(DTC_FLAGS) $(4) \ + -i$(dir $(1)) $(4) \ $(if $(CONFIG_HAS_DT_OVERLAY_SUPPORT),-@) \ -o $(2) $(2).tmp $(RM) $(2).tmp endef +define Image/BuildDTB + $(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTC_FLAGS) $(DEVICE_DTC_FLAGS) $(4)) +endef + +define Image/BuildDTBO + $(call Image/BuildDTB/sub,$(1),$(2),$(3),$(DTCO_FLAGS) $(DEVICE_DTCO_FLAGS) $(4)) +endef + define Image/mkfs/jffs2/sub-raw $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \ $(2) \ @@ -400,6 +411,8 @@ define Device/Init DEVICE_DTS_LOADADDR := DEVICE_DTS_OVERLAY := DEVICE_FDT_NUM := + DEVICE_DTC_FLAGS := + DEVICE_DTCO_FLAGS := SOC := BOARD_NAME := @@ -422,9 +435,9 @@ endef DEFAULT_DEVICE_VARS := \ DEVICE_NAME KERNEL KERNEL_INITRAMFS KERNEL_INITRAMFS_IMAGE KERNEL_SIZE \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ - VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ - DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER DEVICE_DTS_DIR DEVICE_DTS_OVERLAY \ - DEVICE_DTS_LOADADDR \ + VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTC_FLAGS \ + DEVICE_DTCO_FLAGS DEVICE_DTS DEVICE_DTS_CONFIG DEVICE_DTS_DELIMITER \ + DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_DTS_LOADADDR \ DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ UIMAGE_TIME SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ UBOOT_PATH IMAGE_SIZE \ @@ -557,10 +570,10 @@ define Device/Build/dtb endef define Device/Build/dtbo - ifndef BUILD_DTS_$(1) - BUILD_DTS_$(1) := 1 + ifndef BUILD_DTSO_$(1) + BUILD_DTSO_$(1) := 1 $(KDIR)/image-$(1).dtbo: FORCE - $(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dtso,$$@) + $(call Image/BuildDTBO,$(strip $(2))/$(strip $(3)).dtso,$$@) image_prepare: $(KDIR)/image-$(1).dtbo endif -- 2.30.2