linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mips: boot compressed: preprocess linker script
@ 2020-10-15 20:10 John Thomson
  2020-10-15 20:11 ` [PATCH 2/2] mips: boot compressed: add support for vlinuz ELF DTB John Thomson
  0 siblings, 1 reply; 3+ messages in thread
From: John Thomson @ 2020-10-15 20:10 UTC (permalink / raw)
  To: linux-mips; +Cc: Thomas Bogendoerfer, linux-kernel, John Thomson

Preprocess vmlinuz (self-decompressing kernel ELF) linker script
to avoid using ld -Ttext $(address)
https://lkml.kernel.org/lkml/20200413153453.zi4jvu3c4ul23e23@google.com/

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
---
 arch/mips/boot/compressed/.gitignore                   | 1 +
 arch/mips/boot/compressed/Makefile                     | 8 ++++++--
 arch/mips/boot/compressed/{ld.script => vmlinuz.lds.S} | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)
 rename arch/mips/boot/compressed/{ld.script => vmlinuz.lds.S} (96%)

diff --git a/arch/mips/boot/compressed/.gitignore b/arch/mips/boot/compressed/.gitignore
index d358395614c..1c367a2efb9 100644
--- a/arch/mips/boot/compressed/.gitignore
+++ b/arch/mips/boot/compressed/.gitignore
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 ashldi3.c
 bswapsi.c
+vmlinuz.lds
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 6e56caef69f..49d1adceade 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -96,11 +96,15 @@ UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
 
 vmlinuzobjs-y += $(obj)/piggy.o
 
+targets += vmlinuz.lds
+$(obj)/vmlinuz.lds: $(obj)/calc_vmlinuz_load_addr $(obj)/vmlinux.bin
+CPPFLAGS_vmlinuz.lds = -DVMLINUZ_LOAD_ADDRESS="$(VMLINUZ_LOAD_ADDRESS)"
+
 quiet_cmd_zld = LD      $@
-      cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
+      cmd_zld = $(LD) $(KBUILD_LDFLAGS) -T $< $(vmlinuzobjs-y) -o $@
 quiet_cmd_strip = STRIP	  $@
       cmd_strip = $(STRIP) -s $@
-vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
+vmlinuz: $(obj)/vmlinuz.lds $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
 	$(call cmd,zld)
 	$(call cmd,strip)
 
diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/vmlinuz.lds.S
similarity index 96%
rename from arch/mips/boot/compressed/ld.script
rename to arch/mips/boot/compressed/vmlinuz.lds.S
index 2ed08fbef8e..890c31c55c1 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/vmlinuz.lds.S
@@ -14,7 +14,7 @@ PHDRS {
 SECTIONS
 {
 	/* Text and read-only data */
-	/* . = VMLINUZ_LOAD_ADDRESS; */
+	. = VMLINUZ_LOAD_ADDRESS;
 	.text : {
 		*(.text)
 		*(.rodata)
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-17 22:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 20:10 [PATCH 1/2] mips: boot compressed: preprocess linker script John Thomson
2020-10-15 20:11 ` [PATCH 2/2] mips: boot compressed: add support for vlinuz ELF DTB John Thomson
2020-10-17 22:13   ` John Thomson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).