Commit 3f5ec298 authored by Max Filippov's avatar Max Filippov Committed by Chris Zankel

xtensa: clean up boot make rules

- remove duplicate rules for binary and packed image
- use predefined macros for ld/objcopy/gzip
- remove build-id section from bootable elf image
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Signed-off-by: default avatarChris Zankel <chris@zankel.net>
parent 599bf77a
...@@ -31,3 +31,13 @@ $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \ ...@@ -31,3 +31,13 @@ $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
$(addprefix $(obj)/,$(host-progs)) $(addprefix $(obj)/,$(host-progs))
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary
vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy)
vmlinux.bin.gz: vmlinux.bin FORCE
$(call if_changed,gzip)
boot-elf: vmlinux.bin
boot-redboot: vmlinux.bin.gz
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
# for more details. # for more details.
# #
GZIP = gzip
GZIP_FLAGS = -v9fc
ifeq ($(BIG_ENDIAN),1) ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS := -O elf32-xtensa-be OBJCOPY_ARGS := -O elf32-xtensa-be
else else
...@@ -20,18 +17,17 @@ boot-y := bootstrap.o ...@@ -20,18 +17,17 @@ boot-y := bootstrap.o
OBJS := $(addprefix $(obj)/,$(boot-y)) OBJS := $(addprefix $(obj)/,$(boot-y))
vmlinux.tmp: vmlinux $(obj)/Image.o: vmlinux.bin $(OBJS)
$(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \ $(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
$^ $@ --add-section image=vmlinux.bin \
Image: vmlinux.tmp $(OBJS) arch/$(ARCH)/boot/boot-elf/boot.lds
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.tmp \
--set-section-flags image=contents,alloc,load,load,data \ --set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp $(OBJS) $@
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T arch/$(ARCH)/boot/boot-elf/boot.lds \
-o arch/$(ARCH)/boot/$@.elf $@.tmp
zImage: Image $(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
$(Q)$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T $(obj)/boot.lds \
--build-id=none \
-o $@ $(obj)/Image.o
$(Q)$(kecho) ' Kernel: $@ is ready'
zImage: $(obj)/../Image.elf
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
# for more details. # for more details.
# #
GZIP = gzip
GZIP_FLAGS = -v9fc
ifeq ($(BIG_ENDIAN),1) ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS := -O elf32-xtensa-be OBJCOPY_ARGS := -O elf32-xtensa-be
else else
...@@ -21,17 +19,17 @@ LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a ...@@ -21,17 +19,17 @@ LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
vmlinux.tmp: vmlinux $(obj)/zImage.o: vmlinux.bin.gz $(OBJS)
$(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \ $(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
$^ $@ --add-section image=vmlinux.bin.gz \
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@
vmlinux.tmp.gz: vmlinux.tmp $(obj)/zImage.elf: $(obj)/zImage.o $(LIBS)
$(GZIP) $(GZIP_FLAGS) $^ > $@ $(Q)$(LD) $(LD_ARGS) -o $@ $^ -L/xtensa-elf/lib $(LIBGCC)
zImage: vmlinux.tmp.gz $(OBJS) $(LIBS) $(obj)/../zImage.redboot: $(obj)/zImage.elf
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ $(Q)$(OBJCOPY) -S -O binary $< $@
--add-section image=vmlinux.tmp.gz \ $(Q)$(kecho) ' Kernel: $@ is ready'
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp zImage: $(obj)/../zImage.redboot
$(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC)
$(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/$@.redboot
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment