162306a36Sopenharmony_ci#
262306a36Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
362306a36Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
462306a36Sopenharmony_ci# for more details.
562306a36Sopenharmony_ci#
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciOBJCOPY_ARGS := -O $(if $(CONFIG_CPU_BIG_ENDIAN),elf32-xtensa-be,elf32-xtensa-le)
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciboot-y	:= bootstrap.o
1062306a36Sopenharmony_citargets	+= $(boot-y)
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciOBJS	:= $(addprefix $(obj)/,$(boot-y))
1362306a36Sopenharmony_ciLIBS	:= arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci$(obj)/zImage.o: $(obj)/../vmlinux.bin.gz $(OBJS)
1662306a36Sopenharmony_ci	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
1762306a36Sopenharmony_ci		--add-section image=$< \
1862306a36Sopenharmony_ci		--set-section-flags image=contents,alloc,load,load,data \
1962306a36Sopenharmony_ci		$(OBJS) $@
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci$(obj)/zImage.elf: $(obj)/zImage.o $(LIBS)
2262306a36Sopenharmony_ci	$(Q)$(LD) $(KBUILD_LDFLAGS) \
2362306a36Sopenharmony_ci		-T $(srctree)/$(obj)/boot.ld \
2462306a36Sopenharmony_ci		--build-id=none \
2562306a36Sopenharmony_ci		-o $@ $^
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci$(obj)/../zImage.redboot: $(obj)/zImage.elf
2862306a36Sopenharmony_ci	$(Q)$(OBJCOPY) -S -O binary $< $@
2962306a36Sopenharmony_ci	$(Q)$(kecho) '  Kernel: $@ is ready'
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciall zImage: $(obj)/../zImage.redboot
32