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_ciCPPFLAGS_boot.lds += -P -C
1062306a36Sopenharmony_ciKBUILD_AFLAGS += -mtext-section-literals
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciboot-y		:= bootstrap.o
1362306a36Sopenharmony_citargets		+= $(boot-y) boot.lds
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciOBJS		:= $(addprefix $(obj)/,$(boot-y))
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci$(obj)/Image.o: $(obj)/../vmlinux.bin $(OBJS)
1862306a36Sopenharmony_ci	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
1962306a36Sopenharmony_ci		--add-section image=$< \
2062306a36Sopenharmony_ci		--set-section-flags image=contents,alloc,load,load,data \
2162306a36Sopenharmony_ci		$(OBJS) $@
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci$(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
2462306a36Sopenharmony_ci	$(Q)$(LD) $(KBUILD_LDFLAGS) \
2562306a36Sopenharmony_ci		-T $(obj)/boot.lds \
2662306a36Sopenharmony_ci		--build-id=none \
2762306a36Sopenharmony_ci		-o $@ $(obj)/Image.o
2862306a36Sopenharmony_ci	$(Q)$(kecho) '  Kernel: $@ is ready'
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciall Image: $(obj)/../Image.elf
31