Browse Source

build: allow calling append-dtb from image build commands

mpc85xx uses this for firmware image files, since the dtb data is not
directly part of the kernel image. This causes build failures in the
image builder.

Fix this by adding a separate build step that runs this call earlier,
reusing the generated file for any calls from kernel or image build
commands.

Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau 8 years ago
parent
commit
986d9deb3b
2 changed files with 17 additions and 2 deletions
  1. 1 2
      include/image-commands.mk
  2. 16 0
      include/image.mk

+ 1 - 2
include/image-commands.mk

@@ -102,8 +102,7 @@ define Build/tplink-safeloader
 endef
 endef
 
 
 define Build/append-dtb
 define Build/append-dtb
-	$(call Image/BuildDTB,$(if $(DEVICE_DTS_DIR),$(DEVICE_DTS_DIR),$(DTS_DIR))/$(DEVICE_DTS).dts,[email protected])
-	cat [email protected] >> $@
+	cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@
 endef
 endef
 
 
 define Build/install-dtb
 define Build/install-dtb

+ 16 - 0
include/image.mk

@@ -435,7 +435,23 @@ define Device/Build/compile
 
 
 endef
 endef
 
 
+ifndef IB
+define Device/Build/dtb
+  $(KDIR)/image-$(1).dtb: FORCE
+	$(call Image/BuildDTB,$(2)/$(1).dts,$$@)
+
+  $(3): $(KDIR)/image-$(1).dtb
+endef
+endif
+
 define Device/Build/kernel
 define Device/Build/kernel
+  $$(eval $$(foreach dts,$$(DEVICE_DTS), \
+	$$(call Device/Build/dtb,$$(dts), \
+		$$(if $$(DEVICE_DTS_DIR),$$(DEVICE_DTS_DIR),$$(DTS_DIR)),\
+		$$(KDIR_KERNEL_IMAGE) $(KDIR)/$$(KERNEL_INITRAMFS_NAME) \
+	) \
+  ))
+
   $(KDIR)/$$(KERNEL_NAME):: image_prepare
   $(KDIR)/$$(KERNEL_NAME):: image_prepare
   $$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE))
   $$(_TARGET): $$(if $$(KERNEL_INSTALL),$(BIN_DIR)/$$(KERNEL_IMAGE))
   $(call Device/Export,$$(KDIR_KERNEL_IMAGE),$(1))
   $(call Device/Export,$$(KDIR_KERNEL_IMAGE),$(1))