diff mbox series

[09/20,WIP] build: split $(DTB_DIR) off of $(DTS_DIR)

Message ID a395678548ccf07e71eaf47614d5916f7dc940ca.1700010291.git.ehem+openwrt@m5p.com
State Not Applicable
Delegated to: Petr Štetiar
Headers show
Series Kernel build fixups, split object directory off (partial WIP) | expand

Commit Message

Elliott Mitchell Nov. 14, 2023, 6:46 a.m. UTC
This has an issue similar to $(LINUX_DIR), $(DTS_DIR) was being used
for both source and compiled.  Create $(DTB_DIR) for the compiled
binaries.

Signed-off-by: Elliott Mitchell <ehem+openwrt@m5p.com>
---
Issue with this commit is I'm unsure I've gotten everything and
unsure I've gotten the ones I found correct.
---
 include/image.mk                           |  3 ++-
 target/linux/archs38/image/Makefile        |  6 +++---
 target/linux/bcm27xx/image/Makefile        |  4 ++--
 target/linux/bcm4908/image/Makefile        |  2 +-
 target/linux/bcm53xx/image/Makefile        |  6 +++---
 target/linux/imx/image/common.mk           |  2 +-
 target/linux/imx/image/cortexa9.mk         |  4 ++--
 target/linux/layerscape/image/Makefile     |  8 ++++----
 target/linux/layerscape/image/armv7.mk     |  4 ++--
 target/linux/layerscape/image/armv8_64b.mk | 10 +++++-----
 target/linux/mediatek/image/mt7622.mk      |  4 ++--
 target/linux/mediatek/image/mt7623.mk      |  4 ++--
 target/linux/mxs/image/Makefile            |  2 +-
 target/linux/omap/image/Makefile           |  2 +-
 target/linux/pistachio/image/Makefile      |  2 +-
 target/linux/rockchip/image/Makefile       |  2 +-
 target/linux/sifiveu/image/Makefile        |  2 +-
 target/linux/sunxi/image/Makefile          |  2 +-
 target/linux/tegra/image/Makefile          |  4 ++--
 target/linux/zynq/image/Makefile           |  2 +-
 20 files changed, 38 insertions(+), 37 deletions(-)
diff mbox series

Patch

diff --git a/include/image.mk b/include/image.mk
index 4ebff2e9ae..635fad3584 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -31,7 +31,8 @@  mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call para
 
 KDIR=$(KERNEL_BUILD_DIR)
 KDIR_TMP=$(KDIR)/tmp
-DTS_DIR:=$(LINUX_DIR)/arch/$(LINUX_KARCH)/boot/dts
+DTS_DIR:=$(LINUX_SRC_DIR)/arch/$(LINUX_KARCH)/boot/dts
+DTB_DIR:=$(LINUX_OBJ_DIR)/arch/$(LINUX_KARCH)/boot/dts
 
 IMG_PREFIX_EXTRA:=$(if $(EXTRA_IMAGE_NAME),$(call sanitize,$(EXTRA_IMAGE_NAME))-)
 IMG_PREFIX_VERNUM:=$(if $(CONFIG_VERSION_FILENAMES),$(call sanitize,$(VERSION_NUMBER))-)
diff --git a/target/linux/archs38/image/Makefile b/target/linux/archs38/image/Makefile
index 55e16c37fc..42cff1c951 100644
--- a/target/linux/archs38/image/Makefile
+++ b/target/linux/archs38/image/Makefile
@@ -11,7 +11,7 @@  include $(INCLUDE_DIR)/image.mk
 kernel_ep = `$(KERNEL_CROSS)readelf -h $(1) | grep "Entry point address" | grep -o 0x.*`
 
 define Build/patch-dtb
-	$(STAGING_DIR_HOST)/bin/patch-dtb $@ $(DTS_DIR)/$(DEVICE_DTS).dtb
+	$(STAGING_DIR_HOST)/bin/patch-dtb $@ $(DTB_DIR)/$(DEVICE_DTS).dtb
 endef
 
 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
@@ -41,7 +41,7 @@  FAT32_BLOCKS=$(shell echo $$(($(CONFIG_AXS10X_SD_BOOT_PARTSIZE)*1024*1024/$(FAT3
 define Image/Prepare
 	# Build .dtb for all boards we may run on
 	$(foreach dts,$(DEVICE_DTS_LIST),
-		$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTS_DIR)/$(dts).dtb)
+		$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTB_DIR)/$(dts).dtb)
 	)
 endef
 
@@ -51,7 +51,7 @@  define Image/Build/SDCard
 	mkimage -C none -A arc -T script -d uEnv.txt $(BIN_DIR)/uEnv.scr
 	mkenvimage -s 0x4000 -o $(BIN_DIR)/uboot.env ./uboot.env.txt
 	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/uEnv.scr ::boot.scr
-	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(DTS_DIR)/*.dtb ::
+	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(DTB_DIR)/*.dtb ::
 	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage
 	mcopy -i $(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img $(BIN_DIR)/uboot.env ::uboot.env
 
diff --git a/target/linux/bcm27xx/image/Makefile b/target/linux/bcm27xx/image/Makefile
index ad79ac7d0c..7fcb78c8f7 100644
--- a/target/linux/bcm27xx/image/Makefile
+++ b/target/linux/bcm27xx/image/Makefile
@@ -23,9 +23,9 @@  define Build/boot-common
 	mcopy -i $@.boot config.txt ::
 	mcopy -i $@.boot distroconfig.txt ::
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_IMG)
-	$(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::;)
+	$(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTB_DIR)/$(dts).dtb ::;)
 	mmd -i $@.boot ::/overlays
-	mcopy -i $@.boot $(DTS_DIR)/overlays/*.dtbo ::/overlays/
+	mcopy -i $@.boot $(DTB_DIR)/overlays/*.dtbo ::/overlays/
 	mcopy -i $@.boot $(DTS_DIR)/overlays/README ::/overlays/
 endef
 
diff --git a/target/linux/bcm4908/image/Makefile b/target/linux/bcm4908/image/Makefile
index 658ec810d1..5d113919e8 100644
--- a/target/linux/bcm4908/image/Makefile
+++ b/target/linux/bcm4908/image/Makefile
@@ -32,7 +32,7 @@  define Build/bcm4908img
 	mkdir -p $@-bootfs
 	cp -r $(DEVICE_NAME)/* $@-bootfs/
 	touch $@-bootfs/1-openwrt
-	cp $(DTS_DIR)/$(firstword $(DEVICE_DTS)).dtb $@-bootfs/94908.dtb
+	cp $(DTB_DIR)/$(firstword $(DEVICE_DTS)).dtb $@-bootfs/94908.dtb
 	cp $(KDIR)/bcm63xx-cfe/$(subst _,$(comma),$(DEVICE_NAME))/cferam.000 $@-bootfs/
 	cp $(IMAGE_KERNEL) $@-bootfs/vmlinux.lz
 
diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile
index 8799f50057..75040e40e5 100644
--- a/target/linux/bcm53xx/image/Makefile
+++ b/target/linux/bcm53xx/image/Makefile
@@ -146,7 +146,7 @@  define Device/Default
   PROFILES = Generic $$(DEVICE_NAME)
   # .dtb files are prefixed by SoC type, e.g. bcm4708- which is not included in device/image names
   # extract the full dtb name based on the device info
-  DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(subst _,-,$(1)).dtb)))
+  DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTB_DIR))/*-$(subst _,-,$(1)).dtb)))
   KERNEL := kernel-bin | append-dtb | lzma-d16
   KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
   KERNEL_INITRAMFS_SUFFIX := .trx
@@ -407,9 +407,9 @@  define Device/meraki_mr32
   KERNEL_INITRAMFS_SUFFIX := .bin
   DEVICE_DTS_DELIMITER := @
   DEVICE_DTS_CONFIG := config@1
-  KERNEL_INITRAMFS := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb | \
+  KERNEL_INITRAMFS := kernel-bin | fit none $$(DTB_DIR)/$$(DEVICE_DTS).dtb | \
 	pad-to 10362880
-  KERNEL := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL := kernel-bin | fit none $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   IMAGES += sysupgrade.bin
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
 
diff --git a/target/linux/imx/image/common.mk b/target/linux/imx/image/common.mk
index 3b528a02b1..1399ef8517 100644
--- a/target/linux/imx/image/common.mk
+++ b/target/linux/imx/image/common.mk
@@ -12,7 +12,7 @@  define Build/imx-combined-image
 
 	$(foreach dts,$(DEVICE_DTS), \
 		$(CP) \
-			$(DTS_DIR)/$(dts).dtb \
+			$(DTB_DIR)/$(dts).dtb \
 			$@.boot/;
 	)
 
diff --git a/target/linux/imx/image/cortexa9.mk b/target/linux/imx/image/cortexa9.mk
index 2edbbaac47..6720576270 100644
--- a/target/linux/imx/image/cortexa9.mk
+++ b/target/linux/imx/image/cortexa9.mk
@@ -11,7 +11,7 @@  define Build/boot-overlay
 
 	$(foreach dts,$(DEVICE_DTS), \
 		$(CP) \
-			$(DTS_DIR)/$(dts).dtb \
+			$(DTB_DIR)/$(dts).dtb \
 			$@.boot/$(IMG_PREFIX)-$(dts).dtb; \
 		ln -sf \
 			$(IMG_PREFIX)-$(dts).dtb \
@@ -58,7 +58,7 @@  define Build/ventana-img
 	$(CP) $(IMAGE_KERNEL) $@.boot/boot/uImage
 	$(foreach dts,$(DEVICE_DTS), \
 		$(CP) \
-			$(DTS_DIR)/$(dts).dtb \
+			$(DTB_DIR)/$(dts).dtb \
 			$@.boot/boot/;
 	)
 	mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile
index f2ac9b6f04..27d64c81a0 100644
--- a/target/linux/layerscape/image/Makefile
+++ b/target/linux/layerscape/image/Makefile
@@ -20,7 +20,7 @@  LS_SYSUPGRADE_IMAGE_SIZE = 49m
 define Image/Prepare
 	# Build .dtb for all boards we may run on
 	$(foreach dts,$(DEVICE_DTS_LIST),
-		$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTS_DIR)/$(dts).dtb)
+		$(call Image/BuildDTB,$(DTS_DIR)/$(dts).dts,$(DTB_DIR)/$(dts).dtb)
 	)
 endef
 
@@ -33,7 +33,7 @@  define Build/ls-append
 endef
 
 define Build/ls-append-dtb
-	dd if=$(DTS_DIR)/$(1).dtb >> $@
+	dd if=$(DTB_DIR)/$(1).dtb >> $@
 endef
 
 define Build/ls-append-kernel
@@ -59,9 +59,9 @@  define Build/traverse-fit-ls1088
 	-v $(LINUX_VERSION) -k $@ -a $(KERNEL_LOADADDR) \
 	-e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
 	-C gzip -c 1 -c 2 \
-	-d $(DTS_DIR)/freescale/fsl-ls1088a-ten64.dtb \
+	-d $(DTB_DIR)/freescale/fsl-ls1088a-ten64.dtb \
 	-D "TEN64" -n "ten64" -a $(FDT_LOADADDR) -c 1 \
-	-d $(DTS_DIR)/freescale/fsl-ls1088a-rdb.dtb \
+	-d $(DTB_DIR)/freescale/fsl-ls1088a-rdb.dtb \
 	-D "LS1088ARDB" -n "ls1088ardb" -a $(FDT_LOADADDR) -c 2
 	PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
 	@mv -f $@.new $@
diff --git a/target/linux/layerscape/image/armv7.mk b/target/linux/layerscape/image/armv7.mk
index fe396212e7..9c9ec426a4 100644
--- a/target/linux/layerscape/image/armv7.mk
+++ b/target/linux/layerscape/image/armv7.mk
@@ -7,7 +7,7 @@  define Device/Default
   FILESYSTEMS := squashfs
   IMAGES := firmware.bin sysupgrade.bin
   KERNEL := kernel-bin | uImage none
-  KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   KERNEL_NAME := zImage
   KERNEL_LOADADDR := 0x80008000
   DEVICE_DTS = $(lastword $(subst _, ,$(1)))
@@ -20,7 +20,7 @@  define Device/Default
 endef
 
 define Device/fsl-sdboot
-  KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   IMAGES := sdcard.img.gz sysupgrade.bin
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
 endef
diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk
index 259bacee31..77ff4984ff 100644
--- a/target/linux/layerscape/image/armv8_64b.mk
+++ b/target/linux/layerscape/image/armv8_64b.mk
@@ -7,7 +7,7 @@  define Device/Default
   IMAGES := firmware.bin sysupgrade.bin
   FILESYSTEMS := squashfs
   KERNEL := kernel-bin | gzip | uImage gzip
-  KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   KERNEL_LOADADDR := 0x80000000
   DEVICE_DTS = freescale/$(subst _,-,$(1))
   IMAGE_SIZE := 64m
@@ -19,7 +19,7 @@  define Device/Default
 endef
 
 define Device/fsl-sdboot
-  KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   IMAGES := sdcard.img.gz sysupgrade.bin
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
 endef
@@ -45,7 +45,7 @@  define Device/fsl_ls1012a-frdm
     append-kernel | pad-to $$(BLOCKSIZE) | \
     append-rootfs | pad-rootfs | \
     check-size $(LS_SYSUPGRADE_IMAGE_SIZE) | append-metadata
-  KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL := kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
 endef
 TARGET_DEVICES += fsl_ls1012a-frdm
 
@@ -103,7 +103,7 @@  define Device/fsl_ls1028a-rdb
   DEVICE_MODEL := LS1028A-RDB
   DEVICE_VARIANT := Default
   DEVICE_DTS := freescale/fsl-ls1028a-rdb
-  KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   DEVICE_PACKAGES += \
     trusted-firmware-a-ls1028a-rdb \
     kmod-hwmon-ina2xx \
@@ -440,7 +440,7 @@  define Device/traverse_ten64_mtd
   KERNEL_SUFFIX := -kernel.itb
   DEVICE_DTS := freescale/fsl-ls1088a-ten64
   IMAGES := nand.ubi sysupgrade.bin
-  KERNEL := kernel-bin | gzip | traverse-fit-ls1088 gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR)
+  KERNEL := kernel-bin | gzip | traverse-fit-ls1088 gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb $$(FDT_LOADADDR)
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
   IMAGE/nand.ubi := append-ubi
   KERNEL_IN_UBI := 1
diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index e362e7428b..755b3d1a49 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -111,8 +111,8 @@  ifeq ($(DUMP),)
   IMAGE_SIZE := $$(shell expr 45 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
 endif
   KERNEL			:= kernel-bin | gzip
-  KERNEL_INITRAMFS		:= kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
-  IMAGE/sysupgrade.itb		:= append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
+  KERNEL_INITRAMFS		:= kernel-bin | lzma | fit lzma $$(DTB_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
+  IMAGE/sysupgrade.itb		:= append-kernel | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
   DEVICE_COMPAT_VERSION := 1.1
   DEVICE_COMPAT_MESSAGE := Device tree overlay mechanism needs bootloader update
 endef
diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk
index 2c4402da66..d9f7d19f53 100644
--- a/target/linux/mediatek/image/mt7623.mk
+++ b/target/linux/mediatek/image/mt7623.mk
@@ -95,11 +95,11 @@  define Device/bananapi_bpi-r2
   IMAGES := sysupgrade.itb
   KERNEL := kernel-bin | gzip
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
-  KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd
+  KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb with-initrd
 ifeq ($(DUMP),)
   IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
 endif
-  IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
+  IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
   ARTIFACT/preloader.bin := mt7623-mbr emmc |\
 			    pad-to 2k | append-preloader $$(UBOOT_TARGET)
   ARTIFACT/u-boot.bin := append-uboot
diff --git a/target/linux/mxs/image/Makefile b/target/linux/mxs/image/Makefile
index f1847dec1e..620765c2ed 100644
--- a/target/linux/mxs/image/Makefile
+++ b/target/linux/mxs/image/Makefile
@@ -22,7 +22,7 @@  define Build/mxs-sdcard-vfat-ext4
 	rm -f $@.boot
 	mkfs.fat $@.boot -C $(FAT32_BLOCKS)
 
-	mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::$(DEVICE_DTS).dtb
+	mcopy -i $@.boot $(DTB_DIR)/$(DEVICE_DTS).dtb ::$(DEVICE_DTS).dtb
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
 
 	./gen_sdcard_vfat_ext4.sh \
diff --git a/target/linux/omap/image/Makefile b/target/linux/omap/image/Makefile
index 507c91b2cc..44796c6eff 100644
--- a/target/linux/omap/image/Makefile
+++ b/target/linux/omap/image/Makefile
@@ -19,7 +19,7 @@  define Build/omap-sdcard
 	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/u-boot.img ::u-boot.img
 	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/boot.scr ::boot.scr
 	mmd -i $@.boot ::/dtbs
-	mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::/dtbs/$(DEVICE_DTS).dtb
+	mcopy -i $@.boot $(DTB_DIR)/$(DEVICE_DTS).dtb ::/dtbs/$(DEVICE_DTS).dtb
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::/zImage
 	./gen_omap_sdcard_img.sh $@ \
 		$@.boot \
diff --git a/target/linux/pistachio/image/Makefile b/target/linux/pistachio/image/Makefile
index 64898b46e0..8f6c82799a 100644
--- a/target/linux/pistachio/image/Makefile
+++ b/target/linux/pistachio/image/Makefile
@@ -11,7 +11,7 @@  define Device/Default
   PROFILES := Default
   FILESYSTEMS := squashfs
   KERNEL_DEPENDS = $$(wildcard $$(DTS_DIR)/$$(DEVICE_DTS).dts)
-  KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   KERNEL_SUFFIX := -kernel.itb
   KERNEL_INSTALL := 1
   KERNEL_IN_UBI := 1
diff --git a/target/linux/rockchip/image/Makefile b/target/linux/rockchip/image/Makefile
index 3b118201b6..e7fe7178a6 100644
--- a/target/linux/rockchip/image/Makefile
+++ b/target/linux/rockchip/image/Makefile
@@ -47,7 +47,7 @@  endef
 ### Devices ###
 define Device/Default
   PROFILES := Default
-  KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  KERNEL = kernel-bin | lzma | fit lzma $$(DTB_DIR)/$$(DEVICE_DTS).dtb
   IMAGES := sysupgrade.img.gz
   DEVICE_DTS = rockchip/$$(SOC)-$(lastword $(subst _, ,$(1)))
   UBOOT_DEVICE_NAME = $(lastword $(subst _, ,$(1)))-$$(SOC)
diff --git a/target/linux/sifiveu/image/Makefile b/target/linux/sifiveu/image/Makefile
index ef3b13eeec..86839c3118 100644
--- a/target/linux/sifiveu/image/Makefile
+++ b/target/linux/sifiveu/image/Makefile
@@ -15,7 +15,7 @@  define Build/riscv-sdcard
 	mkfs.fat $@.boot  -C $(FAT32_BLOCKS)
 
 	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr
-	mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::dtb
+	mcopy -i $@.boot $(DTB_DIR)/$(DEVICE_DTS).dtb ::dtb
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::Image
 
 	./gen_sifiveu_sdcard_img.sh \
diff --git a/target/linux/sunxi/image/Makefile b/target/linux/sunxi/image/Makefile
index 738585accc..8dd98cd7af 100644
--- a/target/linux/sunxi/image/Makefile
+++ b/target/linux/sunxi/image/Makefile
@@ -17,7 +17,7 @@  define Build/sunxi-sdcard
 	mkfs.fat $@.boot -C $(FAT32_BLOCKS)
 
 	mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr
-	mcopy -i $@.boot $(DTS_DIR)/$(SUNXI_DTS).dtb ::dtb
+	mcopy -i $@.boot $(DTB_DIR)/$(SUNXI_DTS).dtb ::dtb
 	mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
 	./gen_sunxi_sdcard_img.sh $@ \
 		$@.boot \
diff --git a/target/linux/tegra/image/Makefile b/target/linux/tegra/image/Makefile
index 82394f4ab6..a304a6ef07 100644
--- a/target/linux/tegra/image/Makefile
+++ b/target/linux/tegra/image/Makefile
@@ -10,8 +10,8 @@  define Build/tegra-sdcard
 	mkdir -p $@.boot
 	$(CP) $(KDIR)/$(KERNEL_NAME) $@.boot
 	$(if $(DEVICE_DTS),\
-		$(foreach dtb,$(DEVICE_DTS),$(CP) $(DTS_DIR)/$(dtb).dtb $@.boot), \
-		$(CP) $(DTS_DIR)/*.dtb $@.boot)
+		$(foreach dtb,$(DEVICE_DTS),$(CP) $(DTB_DIR)/$(dtb).dtb $@.boot), \
+		$(CP) $(DTB_DIR)/*.dtb $@.boot)
 	mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
 		-n '$(DEVICE_TITLE) OpenWrt bootscript' \
 		-d $(BOOT_SCRIPT) \
diff --git a/target/linux/zynq/image/Makefile b/target/linux/zynq/image/Makefile
index 0931871624..3150072954 100644
--- a/target/linux/zynq/image/Makefile
+++ b/target/linux/zynq/image/Makefile
@@ -38,7 +38,7 @@  endef
 
 define Device/FitImageGzip
 	KERNEL_SUFFIX := -fit-uImage.itb
-	KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+	KERNEL = kernel-bin | gzip | fit gzip $$(DTB_DIR)/$$(DEVICE_DTS).dtb
 	KERNEL_NAME := Image
 endef