xref: /openbmc/linux/arch/xtensa/boot/boot-elf/Makefile (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
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 
7 OBJCOPY_ARGS := -O $(if $(CONFIG_CPU_BIG_ENDIAN),elf32-xtensa-be,elf32-xtensa-le)
8 
9 CPPFLAGS_boot.lds += -P -C
10 KBUILD_AFLAGS += -mtext-section-literals
11 
12 boot-y		:= bootstrap.o
13 targets		+= $(boot-y) boot.lds
14 
15 OBJS		:= $(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 
30 all Image: $(obj)/../Image.elf
31