xref: /linux/arch/xtensa/boot/boot-elf/Makefile (revision c425c546c0f149560c778595c1a20a88a444711f)
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
94bedea94SChris Zankelexport OBJCOPY_ARGS
1036dffadbSChris Zankelexport CPPFLAGS_boot.lds += -P -C
11e85e335fSMax Filippovexport KBUILD_AFLAGS += -mtext-section-literals
124bedea94SChris Zankel
134bedea94SChris Zankelboot-y		:= bootstrap.o
148824c1afSMasahiro Yamadatargets		+= $(boot-y) boot.lds
154bedea94SChris Zankel
164bedea94SChris ZankelOBJS		:= $(addprefix $(obj)/,$(boot-y))
174bedea94SChris Zankel
1865898b37SMax Filippov$(obj)/Image.o: $(obj)/../vmlinux.bin $(OBJS)
193f5ec298SMax Filippov	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
2065898b37SMax Filippov		--add-section image=$< \
214bedea94SChris Zankel		--set-section-flags image=contents,alloc,load,load,data \
223f5ec298SMax Filippov		$(OBJS) $@
234bedea94SChris Zankel
243f5ec298SMax Filippov$(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
253ec8a5b3SMasahiro Yamada	$(Q)$(LD) $(KBUILD_LDFLAGS) \
263f5ec298SMax Filippov		-T $(obj)/boot.lds \
273f5ec298SMax Filippov		--build-id=none \
283f5ec298SMax Filippov		-o $@ $(obj)/Image.o
293f5ec298SMax Filippov	$(Q)$(kecho) '  Kernel: $@ is ready'
304bedea94SChris Zankel
319a736fcbSMax Filippovall Image: $(obj)/../Image.elf
32