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_ciexport OBJCOPY_ARGS
148c2ecf20Sopenharmony_ciexport CPPFLAGS_boot.lds += -P -C
158c2ecf20Sopenharmony_ciexport KBUILD_AFLAGS += -mtext-section-literals
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciboot-y		:= bootstrap.o
188c2ecf20Sopenharmony_citargets		+= $(boot-y) boot.lds
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciOBJS		:= $(addprefix $(obj)/,$(boot-y))
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci$(obj)/Image.o: $(obj)/../vmlinux.bin $(OBJS)
238c2ecf20Sopenharmony_ci	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
248c2ecf20Sopenharmony_ci		--add-section image=$< \
258c2ecf20Sopenharmony_ci		--set-section-flags image=contents,alloc,load,load,data \
268c2ecf20Sopenharmony_ci		$(OBJS) $@
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci$(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
298c2ecf20Sopenharmony_ci	$(Q)$(LD) $(KBUILD_LDFLAGS) \
308c2ecf20Sopenharmony_ci		-T $(obj)/boot.lds \
318c2ecf20Sopenharmony_ci		--build-id=none \
328c2ecf20Sopenharmony_ci		-o $@ $(obj)/Image.o
338c2ecf20Sopenharmony_ci	$(Q)$(kecho) '  Kernel: $@ is ready'
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciall Image: $(obj)/../Image.elf
36