18c2ecf20Sopenharmony_ci#
28c2ecf20Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci# for more details.
58c2ecf20Sopenharmony_ci#
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciifeq ($(BIG_ENDIAN),1)
88c2ecf20Sopenharmony_ciOBJCOPY_ARGS 	:= -O elf32-xtensa-be
98c2ecf20Sopenharmony_cielse
108c2ecf20Sopenharmony_ciOBJCOPY_ARGS 	:= -O elf32-xtensa-le
118c2ecf20Sopenharmony_ciendif
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciLD_ARGS	= -T $(srctree)/$(obj)/boot.ld
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciboot-y	:= bootstrap.o
168c2ecf20Sopenharmony_citargets	+= $(boot-y)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciOBJS	:= $(addprefix $(obj)/,$(boot-y))
198c2ecf20Sopenharmony_ciLIBS	:= arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciLIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci$(obj)/zImage.o: $(obj)/../vmlinux.bin.gz $(OBJS)
248c2ecf20Sopenharmony_ci	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
258c2ecf20Sopenharmony_ci		--add-section image=$< \
268c2ecf20Sopenharmony_ci		--set-section-flags image=contents,alloc,load,load,data \
278c2ecf20Sopenharmony_ci		$(OBJS) $@
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci$(obj)/zImage.elf: $(obj)/zImage.o $(LIBS)
308c2ecf20Sopenharmony_ci	$(Q)$(LD) $(LD_ARGS) -o $@ $^ -L/xtensa-elf/lib $(LIBGCC)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci$(obj)/../zImage.redboot: $(obj)/zImage.elf
338c2ecf20Sopenharmony_ci	$(Q)$(OBJCOPY) -S -O binary $< $@
348c2ecf20Sopenharmony_ci	$(Q)$(kecho) '  Kernel: $@ is ready'
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciall zImage: $(obj)/../zImage.redboot
37