xref: /linux-6.15/arch/xtensa/boot/boot-elf/Makefile (revision 7c94fe4a)
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
7GZIP = gzip
8GZIP_FLAGS = -v9fc
9
10ifeq ($(BIG_ENDIAN),1)
11OBJCOPY_ARGS    := -O elf32-xtensa-be
12else
13OBJCOPY_ARGS    := -O elf32-xtensa-le
14endif
15
16export OBJCOPY_ARGS
17export CPPFLAGS_boot.lds += -P -C
18
19boot-y		:= bootstrap.o
20
21OBJS		:= $(addprefix $(obj)/,$(boot-y))
22
23vmlinux.tmp: vmlinux
24	$(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
25		$^ $@
26
27Image:	vmlinux.tmp $(OBJS) arch/$(ARCH)/boot/boot-elf/boot.lds
28	$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
29		--add-section image=vmlinux.tmp \
30		--set-section-flags image=contents,alloc,load,load,data \
31		$(OBJS) $@.tmp
32	$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
33		-T arch/$(ARCH)/boot/boot-elf/boot.lds \
34		-o arch/$(ARCH)/boot/$@.elf $@.tmp
35
36Image.initrd:	vmlinux $(OBJS)
37	$(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
38		--add-section .initrd=arch/$(ARCH)/boot/ramdisk \
39		--set-section-flags .initrd=contents,alloc,load,load,data \
40		vmlinux vmlinux.tmp
41	$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
42		--add-section image=vmlinux.tmp \
43		--set-section-flags image=contents,alloc,load,load,data \
44		$(OBJS) $@.tmp
45	$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
46		-T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \
47		-o arch/$(ARCH)/boot/$@.elf $@.tmp
48#rm -f [email protected] vmlinux.tmp
49
50
51zImage:	Image
52
53zImage.initrd:	Image.initrd
54
55