[<prev] [next>] [day] [month] [year] [list]
Message-ID: <oYZzkIPMANKiEDPCYkSSsKoesUf0A2V1IJr1XUOcUg@cp3-web-009.plabs.ch>
Date: Sun, 01 Nov 2020 15:12:52 +0000
From: Alexander Lobakin <alobakin@...me>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: Alexander Lobakin <alobakin@...me>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Paul Burton <paulburton@...nel.org>,
Paul Cercueil <paul@...pouillou.net>,
Huacai Chen <chenhc@...ote.com>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH mips-next 1/2] mips: boot: clean up self-extracting targets scenarios
1. All final targets like vmlinuz.{bin,ecoff,srec} etc. should reside in
$(objtree)/arch/mips/boot, not in the root $(objtree) directory.
The only file that should be left there is vmlinuz, similar to other
architectures.
2. Add all the targets to $(targets) variable, so they'll be properly
accounted by Kbuild. This also allows to remove redundant
$(clean-files) (which were missing uzImage BTW).
3. Prefix all targets with $(obj)/$(objtree), depending on their
locations.
Misc: fix the identation of the 'STRIP' quiet message.
Signed-off-by: Alexander Lobakin <alobakin@...me>
---
arch/mips/Makefile | 2 +-
arch/mips/boot/.gitignore | 1 +
arch/mips/boot/compressed/Makefile | 50 +++++++++++++++++++++---------
3 files changed, 37 insertions(+), 16 deletions(-)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 0d0f29d662c9..622ee83dbb9b 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -378,7 +378,7 @@ ifdef CONFIG_SYS_SUPPORTS_ZBOOT
# boot/compressed
$(bootz-y): $(vmlinux-32) FORCE
$(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
- $(bootvars-y) 32bit-bfd=$(32bit-bfd) $@
+ $(bootvars-y) 32bit-bfd=$(32bit-bfd) arch/mips/boot/$@
else
vmlinuz: FORCE
@echo ' CONFIG_SYS_SUPPORTS_ZBOOT is not enabled'
diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
index 2adc8581a175..1c7adddf2e60 100644
--- a/arch/mips/boot/.gitignore
+++ b/arch/mips/boot/.gitignore
@@ -2,6 +2,7 @@
mkboot
elf2ecoff
vmlinux.*
+vmlinuz.*
zImage
zImage.tmp
calc_vmlinuz_load_addr
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index d66511825fe1..fa2c1e1b303f 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -65,7 +65,9 @@ $(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
targets := $(notdir $(vmlinuzobjs-y))
targets += vmlinux.bin
+
OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
+
$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
$(call if_changed,objcopy)
@@ -78,12 +80,15 @@ tool_$(CONFIG_KERNEL_XZ) = xzkern
tool_$(CONFIG_KERNEL_ZSTD) = zstd22
targets += vmlinux.bin.z
+
$(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
$(call if_changed,$(tool_y))
targets += piggy.o dummy.o
+
OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \
--set-section-flags=.image=contents,alloc,load,readonly,data
+
$(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
$(call if_changed,objcopy)
@@ -102,14 +107,21 @@ UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
vmlinuzobjs-y += $(obj)/piggy.o
+targets += ../../../../vmlinuz
+
quiet_cmd_zld = LD $@
cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
-quiet_cmd_strip = STRIP $@
+quiet_cmd_strip = STRIP $@
cmd_strip = $(STRIP) -s $@
-vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
+
+$(objtree)/vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
$(call cmd,zld)
$(call cmd,strip)
+objboot := $(objtree)/arch/mips/boot
+
+$(objboot)/vmlinuz: $(objtree)/vmlinuz FORCE
+
#
# Some DECstations need all possible sections of an ECOFF executable
#
@@ -121,34 +133,42 @@ endif
hostprogs += ../elf2ecoff
ifdef CONFIG_32BIT
- VMLINUZ = vmlinuz
+ VMLINUZ = $(objtree)/vmlinuz
else
- VMLINUZ = vmlinuz.32
+ VMLINUZ = $(objboot)/vmlinuz.32
endif
+targets += ../vmlinuz.32
+
quiet_cmd_32 = OBJCOPY $@
cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
-vmlinuz.32: vmlinuz
+
+$(objboot)/vmlinuz.32: $(objtree)/vmlinuz
$(call cmd,32)
+targets += ../vmlinuz.ecoff
+
quiet_cmd_ecoff = ECOFF $@
cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag)
-vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ)
+
+$(objboot)/vmlinuz.ecoff: $(objboot)/elf2ecoff $(VMLINUZ)
$(call cmd,ecoff)
+targets += ../vmlinuz.bin
+
OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary
-vmlinuz.bin: vmlinuz
+
+$(objboot)/vmlinuz.bin: $(objtree)/vmlinuz
$(call cmd,objcopy)
+targets += ../vmlinuz.srec
+
OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec
-vmlinuz.srec: vmlinuz
+
+$(objboot)/vmlinuz.srec: $(objtree)/vmlinuz
$(call cmd,objcopy)
-uzImage.bin: vmlinuz.bin FORCE
- $(call if_changed,uimage,none)
+targets += ../uzImage.bin
-clean-files += $(objtree)/vmlinuz
-clean-files += $(objtree)/vmlinuz.32
-clean-files += $(objtree)/vmlinuz.ecoff
-clean-files += $(objtree)/vmlinuz.bin
-clean-files += $(objtree)/vmlinuz.srec
+$(objboot)/uzImage.bin: $(objboot)/vmlinuz.bin FORCE
+ $(call if_changed,uimage,none)
--
2.29.2
Powered by blists - more mailing lists