Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@pm.me>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Alexander Lobakin and committed by
Thomas Bogendoerfer
9d63bcb8 fe005201

+37 -16
+1 -1
arch/mips/Makefile
··· 378 378 # boot/compressed 379 379 $(bootz-y): $(vmlinux-32) FORCE 380 380 $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ 381 - $(bootvars-y) 32bit-bfd=$(32bit-bfd) $@ 381 + $(bootvars-y) 32bit-bfd=$(32bit-bfd) arch/mips/boot/$@ 382 382 else 383 383 vmlinuz: FORCE 384 384 @echo ' CONFIG_SYS_SUPPORTS_ZBOOT is not enabled'
+1
arch/mips/boot/.gitignore
··· 2 2 mkboot 3 3 elf2ecoff 4 4 vmlinux.* 5 + vmlinuz.* 5 6 zImage 6 7 zImage.tmp 7 8 calc_vmlinuz_load_addr
+35 -15
arch/mips/boot/compressed/Makefile
··· 65 65 targets := $(notdir $(vmlinuzobjs-y)) 66 66 67 67 targets += vmlinux.bin 68 + 68 69 OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S 70 + 69 71 $(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE 70 72 $(call if_changed,objcopy) 71 73 ··· 80 78 tool_$(CONFIG_KERNEL_ZSTD) = zstd22 81 79 82 80 targets += vmlinux.bin.z 81 + 83 82 $(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE 84 83 $(call if_changed,$(tool_y)) 85 84 86 85 targets += piggy.o dummy.o 86 + 87 87 OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \ 88 88 --set-section-flags=.image=contents,alloc,load,readonly,data 89 + 89 90 $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE 90 91 $(call if_changed,objcopy) 91 92 ··· 107 102 108 103 vmlinuzobjs-y += $(obj)/piggy.o 109 104 105 + targets += ../../../../vmlinuz 106 + 110 107 quiet_cmd_zld = LD $@ 111 108 cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@ 112 - quiet_cmd_strip = STRIP $@ 109 + quiet_cmd_strip = STRIP $@ 113 110 cmd_strip = $(STRIP) -s $@ 114 - vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr 111 + 112 + $(objtree)/vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr 115 113 $(call cmd,zld) 116 114 $(call cmd,strip) 115 + 116 + objboot := $(objtree)/arch/mips/boot 117 + 118 + $(objboot)/vmlinuz: $(objtree)/vmlinuz FORCE 117 119 118 120 # 119 121 # Some DECstations need all possible sections of an ECOFF executable ··· 133 121 hostprogs += ../elf2ecoff 134 122 135 123 ifdef CONFIG_32BIT 136 - VMLINUZ = vmlinuz 124 + VMLINUZ = $(objtree)/vmlinuz 137 125 else 138 - VMLINUZ = vmlinuz.32 126 + VMLINUZ = $(objboot)/vmlinuz.32 139 127 endif 128 + 129 + targets += ../vmlinuz.32 140 130 141 131 quiet_cmd_32 = OBJCOPY $@ 142 132 cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ 143 - vmlinuz.32: vmlinuz 133 + 134 + $(objboot)/vmlinuz.32: $(objtree)/vmlinuz 144 135 $(call cmd,32) 136 + 137 + targets += ../vmlinuz.ecoff 145 138 146 139 quiet_cmd_ecoff = ECOFF $@ 147 140 cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag) 148 - vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ) 141 + 142 + $(objboot)/vmlinuz.ecoff: $(objboot)/elf2ecoff $(VMLINUZ) 149 143 $(call cmd,ecoff) 150 144 145 + targets += ../vmlinuz.bin 146 + 151 147 OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary 152 - vmlinuz.bin: vmlinuz 148 + 149 + $(objboot)/vmlinuz.bin: $(objtree)/vmlinuz 153 150 $(call cmd,objcopy) 151 + 152 + targets += ../vmlinuz.srec 154 153 155 154 OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec 156 - vmlinuz.srec: vmlinuz 155 + 156 + $(objboot)/vmlinuz.srec: $(objtree)/vmlinuz 157 157 $(call cmd,objcopy) 158 158 159 - uzImage.bin: vmlinuz.bin FORCE 160 - $(call if_changed,uimage,none) 159 + targets += ../uzImage.bin 161 160 162 - clean-files += $(objtree)/vmlinuz 163 - clean-files += $(objtree)/vmlinuz.32 164 - clean-files += $(objtree)/vmlinuz.ecoff 165 - clean-files += $(objtree)/vmlinuz.bin 166 - clean-files += $(objtree)/vmlinuz.srec 161 + $(objboot)/uzImage.bin: $(objboot)/vmlinuz.bin FORCE 162 + $(call if_changed,uimage,none)