[openwrt/openwrt] build: image: add append-dtb-elf helper

LEDE Commits lede-commits at lists.infradead.org
Thu Oct 29 11:08:06 EDT 2020


981213 pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/9a168b51c3a60c95ccd349dd3010615ba6b0e033

commit 9a168b51c3a60c95ccd349dd3010615ba6b0e033
Author: John Thomson <git at johnthomson.fastmail.com.au>
AuthorDate: Thu Oct 15 19:06:41 2020 +1000

    build: image: add append-dtb-elf helper
    
    The mips kernel vmlinux image supports adding an empty ELF section
    for DTB to be later inserted into with MIPS_ELF_APPENDED_DTB.
    
    This ELF + inserted DTB image can then be directly booted on some
    devices.
    
    Example usage:
    image/subtarget.mk:
    KERNEL_NAME := vmlinux.elf
    KERNEL_INITRAMFS_NAME := vmlinux-initramfs.elf
    KERNEL := kernel-bin | append-dtb-elf
    
    On mt7621 memory size needed to be manually specified.
    
    Signed-off-by: John Thomson <git at johnthomson.fastmail.com.au>
---
 include/image-commands.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index 740d627fc7..ea94059d20 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -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), \



More information about the lede-commits mailing list