blob: da75630c440da6528577d1561f2d3d4143506a26 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#
2# arch/arm/boot/Makefile
3#
4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies.
6#
7# This file is subject to the terms and conditions of the GNU General Public
8# License. See the file "COPYING" in the main directory of this archive
9# for more details.
10#
11# Copyright (C) 1995-2002 Russell King
12#
13
14OBJCOPYFLAGS :=-O binary -R .comment -S
15
16ifneq ($(MACHINE),)
17include $(MACHINE)/Makefile.boot
18endif
19include $(srctree)/arch/arm/boot/dts/Makefile
20
21# Note: the following conditions must always be true:
22# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
23# PARAMS_PHYS must be within 4MB of ZRELADDR
24# INITRD_PHYS must be in RAM
25ZRELADDR := $(zreladdr-y)
26PARAMS_PHYS := $(params_phys-y)
27INITRD_PHYS := $(initrd_phys-y)
28
29export ZRELADDR INITRD_PHYS PARAMS_PHYS
30
31targets := Image zImage xipImage bootpImage uImage
32
33DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES))
34ifneq ($(DTB_NAMES),)
35DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES))
36else
37DTB_LIST := $(dtb-y)
38endif
39DTB_OBJS := $(addprefix $(obj)/dts/,$(DTB_LIST))
40
41ifeq ($(CONFIG_XIP_KERNEL),y)
42
43$(obj)/xipImage: vmlinux FORCE
44 $(call if_changed,objcopy)
45 @$(kecho) ' Physical Address of xipImage: $(CONFIG_XIP_PHYS_ADDR)'
46
47$(obj)/Image $(obj)/zImage: FORCE
48 @echo 'Kernel configured for XIP (CONFIG_XIP_KERNEL=y)'
49 @echo 'Only the xipImage target is available in this case'
50 @false
51
52else
53
54$(obj)/xipImage: FORCE
55 @echo 'Kernel not configured for XIP (CONFIG_XIP_KERNEL!=y)'
56 @false
57
58$(obj)/Image: vmlinux FORCE
59 $(call if_changed,objcopy)
60
61$(obj)/compressed/vmlinux: $(obj)/Image FORCE
62 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
63
64$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
65 $(call if_changed,objcopy)
66
67$(obj)/zImage-dtb: $(obj)/zImage $(DTB_OBJS) FORCE
68 $(call if_changed,cat)
69 @echo ' Kernel: $@ is ready'
70
71endif
72
73ifneq ($(LOADADDR),)
74 UIMAGE_LOADADDR=$(LOADADDR)
75else
76 ifeq ($(CONFIG_ZBOOT_ROM),y)
77 UIMAGE_LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
78 else
79 UIMAGE_LOADADDR=$(ZRELADDR)
80 endif
81endif
82
83check_for_multiple_loadaddr = \
84if [ $(words $(UIMAGE_LOADADDR)) -ne 1 ]; then \
85 echo 'multiple (or no) load addresses: $(UIMAGE_LOADADDR)'; \
86 echo 'This is incompatible with uImages'; \
87 echo 'Specify LOADADDR on the commandline to build an uImage'; \
88 false; \
89fi
90
91$(obj)/uImage: $(obj)/zImage FORCE
92 @$(check_for_multiple_loadaddr)
93 $(call if_changed,uimage)
94
95$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
96 $(Q)$(MAKE) $(build)=$(obj)/bootp $@
97
98$(obj)/bootpImage: $(obj)/bootp/bootp FORCE
99 $(call if_changed,objcopy)
100
101PHONY += initrd install zinstall uinstall
102initrd:
103 @test "$(INITRD_PHYS)" != "" || \
104 (echo This machine does not support INITRD; exit -1)
105 @test "$(INITRD)" != "" || \
106 (echo You must specify INITRD; exit -1)
107
108install:
109 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
110 $(obj)/Image System.map "$(INSTALL_PATH)"
111
112zinstall:
113 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
114 $(obj)/zImage System.map "$(INSTALL_PATH)"
115
116uinstall:
117 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
118 $(obj)/uImage System.map "$(INSTALL_PATH)"
119
120subdir- := bootp compressed dts