xref: /linux-6.15/arch/xtensa/boot/Makefile (revision da844a81)
1#
2# arch/xtensa/boot/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License.  See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8#
9
10
11# KBUILD_CFLAGS used when building rest of boot (takes effect recursively)
12KBUILD_CFLAGS	+= -fno-builtin -Iarch/$(ARCH)/boot/include
13HOSTFLAGS	+= -Iarch/$(ARCH)/boot/include
14
15BIG_ENDIAN	:= $(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#")
16
17export ccflags-y
18export BIG_ENDIAN
19
20subdir-y	:= lib
21
22# Subdirs for the boot loader(s)
23
24bootdir-$(CONFIG_XTENSA_PLATFORM_ISS)	 += boot-elf
25bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf boot-uboot
26
27
28BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o
29ifneq ($(CONFIG_BUILTIN_DTB),"")
30obj-y += $(BUILTIN_DTB)
31endif
32
33# Rule to build device tree blobs
34$(obj)/%.dtb: $(src)/dts/%.dts FORCE
35	$(call if_changed_dep,dtc)
36
37clean-files := *.dtb.S
38
39zImage Image: $(bootdir-y)
40
41$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
42	      $(addprefix $(obj)/,$(host-progs))
43	$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
44
45OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary
46
47vmlinux.bin: vmlinux FORCE
48	$(call if_changed,objcopy)
49
50vmlinux.bin.gz: vmlinux.bin FORCE
51	$(call if_changed,gzip)
52
53boot-elf: vmlinux.bin
54boot-redboot: vmlinux.bin.gz
55boot-uboot: vmlinux.bin.gz
56