Skip to contentSkip to conversation

xtensa: boot targets cleanup

PATCH In review Max Filippov 2 participants 5 messages Jul 22, 2020 – Jul 24, 2020 Tensilica Xtensa port (xtensa)

lore
Share & tools
lore

Max Filippov

author maintainer
#0 lore raw

cover xtensa: boot targets cleanup

Hello,

this small clean up in the xtensa boot subdirectory adds more targets to the 'targets' variable to avoid unnecessary rebuils.

Max Filippov (2):
xtensa: move vmlinux.bin[.gz] to boot subdirectory
xtensa: add uImage and xipImage to targets

 arch/xtensa/boot/Makefile              | 12 +++++++-----
 arch/xtensa/boot/boot-elf/Makefile     |  4 ++--
 arch/xtensa/boot/boot-redboot/Makefile |  4 ++--
 3 files changed, 11 insertions(+), 9 deletions(-)
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH 1/2 xtensa: move vmlinux.bin[.gz] to boot subdirectory

vmlinux.bin and vmlinux.bin.gz are always rebuilt in the kernel build process. Add them to 'targets' and move them to the boot subdirectory where their rules are. Update make rules that refer to them.

---
 arch/xtensa/boot/Makefile              | 11 ++++++-----
 arch/xtensa/boot/boot-elf/Makefile     |  4 ++--
 arch/xtensa/boot/boot-redboot/Makefile |  4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)
arch/xtensa/boot/Makefile +6 -5
index 1a14d38d9b33..801fe30b4dfe 100644
@@ -17,6 +17,7 @@ BIG_ENDIAN	:= $(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#")
 export BIG_ENDIAN
 
 subdir-y	:= lib
+targets		+= vmlinux.bin vmlinux.bin.gz
 
 # Subdirs for the boot loader(s)
 
@@ -35,19 +36,19 @@ boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y))
 
 OBJCOPYFLAGS = --strip-all -R .comment -R .notes -O binary
 
-vmlinux.bin: vmlinux FORCE
+$(obj)/vmlinux.bin: vmlinux FORCE
 	$(call if_changed,objcopy)
 
-vmlinux.bin.gz: vmlinux.bin FORCE
+$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
 	$(call if_changed,gzip)
 
-boot-elf: vmlinux.bin
-boot-redboot: vmlinux.bin.gz
+boot-elf: $(obj)/vmlinux.bin
+boot-redboot: $(obj)/vmlinux.bin.gz
 
 UIMAGE_LOADADDR = $(CONFIG_KERNEL_LOAD_ADDRESS)
 UIMAGE_COMPRESSION = gzip
 
-$(obj)/uImage: vmlinux.bin.gz FORCE
+$(obj)/uImage: $(obj)/vmlinux.bin.gz FORCE
 	$(call if_changed,uimage)
 	$(Q)$(kecho) '  Kernel: $@ is ready'
 
arch/xtensa/boot/boot-elf/Makefile +2 -2
index badee63dae27..0ebc9827f7e5 100644
@@ -19,9 +19,9 @@ targets		+= $(boot-y) boot.lds
 
 OBJS		:= $(addprefix $(obj)/,$(boot-y))
 
-$(obj)/Image.o: vmlinux.bin $(OBJS)
+$(obj)/Image.o: $(obj)/../vmlinux.bin $(OBJS)
 	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
-		--add-section image=vmlinux.bin \
+		--add-section image=$< \
 		--set-section-flags image=contents,alloc,load,load,data \
 		$(OBJS) $@
 
arch/xtensa/boot/boot-redboot/Makefile +2 -2
index 1a277dd57b2a..07cb24afedc2 100644
@@ -20,9 +20,9 @@ LIBS	:= arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
 
 LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
-$(obj)/zImage.o: vmlinux.bin.gz $(OBJS)
+$(obj)/zImage.o: $(obj)/../vmlinux.bin.gz $(OBJS)
 	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
-		--add-section image=vmlinux.bin.gz \
+		--add-section image=$< \
 		--set-section-flags image=contents,alloc,load,load,data \
 		$(OBJS) $@
 
Signature · 1 line
2.20.1
author maintainer
#3 lore raw

PATCH 2/2 xtensa: add uImage and xipImage to targets

In reply to Max Filippov

uImage and xipImage are always rebuilt in the xtensa kernel build process. Add them to 'targets' to avoid that.

---
 arch/xtensa/boot/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/xtensa/boot/Makefile +1 -0
index 801fe30b4dfe..f6bb352f94b4 100644
@@ -18,6 +18,7 @@ export BIG_ENDIAN
 
 subdir-y	:= lib
 targets		+= vmlinux.bin vmlinux.bin.gz
+targets		+= uImage xipImage
 
 # Subdirs for the boot loader(s)
 
Signature · 1 line
2.20.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] xtensa: add uImage and xipImage to targets

Quoted 6 lines · Max Filippov

uImage and xipImage are always rebuilt in the xtensa kernel build process. Add them to 'targets' to avoid that.

---

Quoted 18 lines
 arch/xtensa/boot/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/xtensa/boot/Makefile +1 -1
index 801fe30b4dfe..f6bb352f94b4 100644
@@ -18,6 +18,7 @@ export BIG_ENDIAN
 
 subdir-y       := lib
 targets                += vmlinux.bin vmlinux.bin.gz
+targets                += uImage xipImage
 
 # Subdirs for the boot loader(s)
 
--

2.20.1

Signature · 2 lines
Best Regards
Masahiro Yamada
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] xtensa: move vmlinux.bin[.gz] to boot subdirectory

In reply to Max Filippov
Quoted 7 lines · Max Filippov

vmlinux.bin and vmlinux.bin.gz are always rebuilt in the kernel build process. Add them to 'targets' and move them to the boot subdirectory where their rules are. Update make rules that refer to them.

---

Quoted 77 lines
 arch/xtensa/boot/Makefile              | 11 ++++++-----
 arch/xtensa/boot/boot-elf/Makefile     |  4 ++--
 arch/xtensa/boot/boot-redboot/Makefile |  4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)
arch/xtensa/boot/Makefile +6 -5
index 1a14d38d9b33..801fe30b4dfe 100644
@@ -17,6 +17,7 @@ BIG_ENDIAN    := $(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#")
 export BIG_ENDIAN
 
 subdir-y       := lib
+targets                += vmlinux.bin vmlinux.bin.gz
 
 # Subdirs for the boot loader(s)
 
@@ -35,19 +36,19 @@ boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y))
 
 OBJCOPYFLAGS = --strip-all -R .comment -R .notes -O binary
 
-vmlinux.bin: vmlinux FORCE
+$(obj)/vmlinux.bin: vmlinux FORCE
        $(call if_changed,objcopy)
 
-vmlinux.bin.gz: vmlinux.bin FORCE
+$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
        $(call if_changed,gzip)
 
-boot-elf: vmlinux.bin
-boot-redboot: vmlinux.bin.gz
+boot-elf: $(obj)/vmlinux.bin
+boot-redboot: $(obj)/vmlinux.bin.gz
 
 UIMAGE_LOADADDR = $(CONFIG_KERNEL_LOAD_ADDRESS)
 UIMAGE_COMPRESSION = gzip
 
-$(obj)/uImage: vmlinux.bin.gz FORCE
+$(obj)/uImage: $(obj)/vmlinux.bin.gz FORCE
        $(call if_changed,uimage)
        $(Q)$(kecho) '  Kernel: $@ is ready'
 
arch/xtensa/boot/boot-elf/Makefile +2 -2
index badee63dae27..0ebc9827f7e5 100644
@@ -19,9 +19,9 @@ targets               += $(boot-y) boot.lds
 
 OBJS           := $(addprefix $(obj)/,$(boot-y))
 
-$(obj)/Image.o: vmlinux.bin $(OBJS)
+$(obj)/Image.o: $(obj)/../vmlinux.bin $(OBJS)
        $(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
-               --add-section image=vmlinux.bin \
+               --add-section image=$< \
                --set-section-flags image=contents,alloc,load,load,data \
                $(OBJS) $@
 
arch/xtensa/boot/boot-redboot/Makefile +2 -3
index 1a277dd57b2a..07cb24afedc2 100644
@@ -20,9 +20,9 @@ LIBS  := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
 
 LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
-$(obj)/zImage.o: vmlinux.bin.gz $(OBJS)
+$(obj)/zImage.o: $(obj)/../vmlinux.bin.gz $(OBJS)
        $(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
-               --add-section image=vmlinux.bin.gz \
+               --add-section image=$< \
                --set-section-flags image=contents,alloc,load,load,data \
                $(OBJS) $@
 
--

2.20.1

Signature · 2 lines
Best Regards
Masahiro Yamada