xref: /linux/arch/xtensa/boot/boot-redboot/Makefile (revision e7d759f31ca295d589f7420719c311870bb3166f)
1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License.  See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6
7OBJCOPY_ARGS := -O $(if $(CONFIG_CPU_BIG_ENDIAN),elf32-xtensa-be,elf32-xtensa-le)
8
9boot-y	:= bootstrap.o
10targets	+= $(boot-y)
11
12OBJS	:= $(addprefix $(obj)/,$(boot-y))
13LIBS	:= arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
14
15$(obj)/zImage.o: $(obj)/../vmlinux.bin.gz $(OBJS)
16	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
17		--add-section image=$< \
18		--set-section-flags image=contents,alloc,load,load,data \
19		$(OBJS) $@
20
21$(obj)/zImage.elf: $(obj)/zImage.o $(LIBS)
22	$(Q)$(LD) $(KBUILD_LDFLAGS) \
23		-T $(srctree)/$(obj)/boot.ld \
24		--build-id=none \
25		-o $@ $^
26
27$(obj)/../zImage.redboot: $(obj)/zImage.elf
28	$(Q)$(OBJCOPY) -S -O binary $< $@
29	$(Q)$(kecho) '  Kernel: $@ is ready'
30
31all zImage: $(obj)/../zImage.redboot
32