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
7*c425c546SMasahiro YamadaOBJCOPY_ARGS := -O $(if $(CONFIG_CPU_BIG_ENDIAN),elf32-xtensa-be,elf32-xtensa-le)
84bedea94SChris Zankel
9e7d163f7SChris ZankelLD_ARGS	= -T $(srctree)/$(obj)/boot.ld
104bedea94SChris Zankel
114bedea94SChris Zankelboot-y	:= bootstrap.o
128824c1afSMasahiro Yamadatargets	+= $(boot-y)
134bedea94SChris Zankel
144bedea94SChris ZankelOBJS	:= $(addprefix $(obj)/,$(boot-y))
15e7d163f7SChris ZankelLIBS	:= arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
164bedea94SChris Zankel
17a0f97e06SSam RavnborgLIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
184bedea94SChris Zankel
1965898b37SMax Filippov$(obj)/zImage.o: $(obj)/../vmlinux.bin.gz $(OBJS)
203f5ec298SMax Filippov	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
2165898b37SMax Filippov		--add-section image=$< \
224bedea94SChris Zankel		--set-section-flags image=contents,alloc,load,load,data \
233f5ec298SMax Filippov		$(OBJS) $@
243f5ec298SMax Filippov
253f5ec298SMax Filippov$(obj)/zImage.elf: $(obj)/zImage.o $(LIBS)
263f5ec298SMax Filippov	$(Q)$(LD) $(LD_ARGS) -o $@ $^ -L/xtensa-elf/lib $(LIBGCC)
273f5ec298SMax Filippov
283f5ec298SMax Filippov$(obj)/../zImage.redboot: $(obj)/zImage.elf
293f5ec298SMax Filippov	$(Q)$(OBJCOPY) -S -O binary $< $@
303f5ec298SMax Filippov	$(Q)$(kecho) '  Kernel: $@ is ready'
313f5ec298SMax Filippov
329a736fcbSMax Filippovall zImage: $(obj)/../zImage.redboot
33