14bedea94SChris Zankel#
24bedea94SChris Zankel# This file is subject to the terms and conditions of the GNU General Public
34bedea94SChris Zankel# License.  See the file "COPYING" in the main directory of this archive
44bedea94SChris Zankel# for more details.
54bedea94SChris Zankel#
64bedea94SChris Zankel
7c425c546SMasahiro YamadaOBJCOPY_ARGS := -O $(if $(CONFIG_CPU_BIG_ENDIAN),elf32-xtensa-be,elf32-xtensa-le)
84bedea94SChris Zankel
94bedea94SChris Zankelboot-y	:= bootstrap.o
108824c1afSMasahiro Yamadatargets	+= $(boot-y)
114bedea94SChris Zankel
124bedea94SChris ZankelOBJS	:= $(addprefix $(obj)/,$(boot-y))
13e7d163f7SChris ZankelLIBS	:= arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
144bedea94SChris Zankel
1565898b37SMax Filippov$(obj)/zImage.o: $(obj)/../vmlinux.bin.gz $(OBJS)
163f5ec298SMax Filippov	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
1765898b37SMax Filippov		--add-section image=$< \
184bedea94SChris Zankel		--set-section-flags image=contents,alloc,load,load,data \
193f5ec298SMax Filippov		$(OBJS) $@
203f5ec298SMax Filippov
213f5ec298SMax Filippov$(obj)/zImage.elf: $(obj)/zImage.o $(LIBS)
22*fe5775f2SMax Filippov	$(Q)$(LD) $(KBUILD_LDFLAGS) \
23*fe5775f2SMax Filippov		-T $(srctree)/$(obj)/boot.ld \
24*fe5775f2SMax Filippov		--build-id=none \
25*fe5775f2SMax Filippov		-o $@ $^
263f5ec298SMax Filippov
273f5ec298SMax Filippov$(obj)/../zImage.redboot: $(obj)/zImage.elf
283f5ec298SMax Filippov	$(Q)$(OBJCOPY) -S -O binary $< $@
293f5ec298SMax Filippov	$(Q)$(kecho) '  Kernel: $@ is ready'
303f5ec298SMax Filippov
319a736fcbSMax Filippovall zImage: $(obj)/../zImage.redboot
32