[source] ar71xx: add relocation loader

LEDE Commits lede-commits at lists.infradead.org
Tue Oct 11 14:00:35 PDT 2016


neoraider pushed a commit to source.git, branch master:
https://git.lede-project.org/0d1fb7224196d1e4c829687550b343546829d760

commit 0d1fb7224196d1e4c829687550b343546829d760
Author: Matthias Schiffer <mschiffer at universe-factory.net>
AuthorDate: Tue Oct 11 20:32:25 2016 +0200

    ar71xx: add relocation loader
    
    Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 target/linux/ar71xx/image/Makefile  | 9 +++++++++
 target/linux/ar71xx/image/legacy.mk | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index bce5cd3..56e07d8 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -78,6 +78,15 @@ define Build/loader-okli
 	mv "$@.new" "$@"
 endef
 
+define Build/relocate-kernel
+	( \
+		dd if=$(KDIR)/relocate.bin bs=32 conv=sync && \
+		perl -e '@s = stat("$@"); print pack("N", @s[7])' && \
+		cat "$@" \
+	) > "$@.new"
+	mv "$@.new" "$@"
+endef
+
 define Build/copy-file
 	cat "$(1)" > "$@"
 endef
diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk
index 92f3469..ed01dc7 100644
--- a/target/linux/ar71xx/image/legacy.mk
+++ b/target/linux/ar71xx/image/legacy.mk
@@ -1103,6 +1103,12 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 	$(call Image/BuildLoader,generic,elf,,,-initramfs)
 endif
 	$(call Image/BuildLoader,generic,elf)
+
+	# Note: not only used for legacy images
+	rm -rf $(KDIR)/relocate
+	$(CP) ../../generic/image/relocate $(KDIR)
+	$(MAKE) -C $(KDIR)/relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
+	$(CP) $(KDIR)/relocate/loader.bin $(KDIR)/relocate.bin
 endef
 
 define Image/Prepare/Profile



More information about the lede-commits mailing list