build: image: add append-dtb-elf helper
[openwrt/staging/wigyori.git] / include / image-commands.mk
index 740d627fc735cb32d9a5297fd688ab86481166db..ea94059d20c12b8cf4f62683b2281ed3daefbf6b 100644 (file)
@@ -142,6 +142,13 @@ define Build/append-dtb
        cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@
 endef
 
+define Build/append-dtb-elf
+       $(TARGET_CROSS)objcopy \
+               --set-section-flags=.appended_dtb=alloc,contents \
+               --update-section \
+               .appended_dtb=$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@
+endef
+
 define Build/install-dtb
        $(call locked, \
                $(foreach dts,$(DEVICE_DTS), \