xref: /openbmc/linux/arch/xtensa/boot/boot-elf/Makefile (revision 5b828263)
1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License.  See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6
7OBJCOPY_ARGS := -O $(if $(CONFIG_CPU_BIG_ENDIAN),elf32-xtensa-be,elf32-xtensa-le)
8
9CPPFLAGS_boot.lds += -P -C
10KBUILD_AFLAGS += -mtext-section-literals
11
12boot-y		:= bootstrap.o
13targets		+= $(boot-y) boot.lds
14
15OBJS		:= $(addprefix $(obj)/,$(boot-y))
16
17$(obj)/Image.o: $(obj)/../vmlinux.bin $(OBJS)
18	$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
19		--add-section image=$< \
20		--set-section-flags image=contents,alloc,load,load,data \
21		$(OBJS) $@
22
23$(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
24	$(Q)$(LD) $(KBUILD_LDFLAGS) \
25		-T $(obj)/boot.lds \
26		--build-id=none \
27		-o $@ $(obj)/Image.o
28	$(Q)$(kecho) '  Kernel: $@ is ready'
29
30all Image: $(obj)/../Image.elf
31