blob: da75630c440da6528577d1561f2d3d4143506a26 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#
2# arch/arm/boot/Makefile
3#
Paul Smith4f193362006-03-05 17:14:10 -05004# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies.
6#
Linus Torvalds1da177e2005-04-16 15:20:36 -07007# 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
Mark Rutland3cb59582016-07-19 11:23:37 +010014OBJCOPYFLAGS :=-O binary -R .comment -S
15
Linus Torvalds1da177e2005-04-16 15:20:36 -070016ifneq ($(MACHINE),)
Masahiro Yamada7aacad52015-03-27 20:43:35 +090017include $(MACHINE)/Makefile.boot
Linus Torvalds1da177e2005-04-16 15:20:36 -070018endif
Benoit Gobyc792cb62013-11-08 15:24:19 -080019include $(srctree)/arch/arm/boot/dts/Makefile
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21# Note: the following conditions must always be true:
Russell King9e84ed62010-09-09 22:39:41 +010022# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
Linus Torvalds1da177e2005-04-16 15:20:36 -070023# PARAMS_PHYS must be within 4MB of ZRELADDR
24# INITRD_PHYS must be in RAM
Russell King9e84ed62010-09-09 22:39:41 +010025ZRELADDR := $(zreladdr-y)
Linus Torvalds1da177e2005-04-16 15:20:36 -070026PARAMS_PHYS := $(params_phys-y)
27INITRD_PHYS := $(initrd_phys-y)
28
Russell King9e84ed62010-09-09 22:39:41 +010029export ZRELADDR INITRD_PHYS PARAMS_PHYS
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
31targets := Image zImage xipImage bootpImage uImage
32
Colin Crossccd6cd32013-04-17 16:58:36 -070033DTB_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
Linus Torvalds1da177e2005-04-16 15:20:36 -070041ifeq ($(CONFIG_XIP_KERNEL),y)
42
43$(obj)/xipImage: vmlinux FORCE
44 $(call if_changed,objcopy)
Masahiro Yamadac6bbfbb72016-05-30 03:01:23 +010045 @$(kecho) ' Physical Address of xipImage: $(CONFIG_XIP_PHYS_ADDR)'
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
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)
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
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)
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
Colin Crossccd6cd32013-04-17 16:58:36 -070067$(obj)/zImage-dtb: $(obj)/zImage $(DTB_OBJS) FORCE
68 $(call if_changed,cat)
69 @echo ' Kernel: $@ is ready'
70
Linus Torvalds1da177e2005-04-16 15:20:36 -070071endif
72
Stephen Warrene3393642012-03-16 15:03:55 -060073ifneq ($(LOADADDR),)
74 UIMAGE_LOADADDR=$(LOADADDR)
Uwe Kleine-König0f980142008-03-06 16:22:33 +010075else
Stephen Warrene3393642012-03-16 15:03:55 -060076 ifeq ($(CONFIG_ZBOOT_ROM),y)
77 UIMAGE_LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
78 else
79 UIMAGE_LOADADDR=$(ZRELADDR)
80 endif
Uwe Kleine-König0f980142008-03-06 16:22:33 +010081endif
82
Sascha Hauercd227fb2011-08-17 14:23:46 +010083check_for_multiple_loadaddr = \
Olof Johansson938f94c2013-02-23 08:02:24 +010084if [ $(words $(UIMAGE_LOADADDR)) -ne 1 ]; then \
85 echo 'multiple (or no) load addresses: $(UIMAGE_LOADADDR)'; \
Sascha Hauercd227fb2011-08-17 14:23:46 +010086 echo 'This is incompatible with uImages'; \
87 echo 'Specify LOADADDR on the commandline to build an uImage'; \
88 false; \
89fi
90
Linus Torvalds1da177e2005-04-16 15:20:36 -070091$(obj)/uImage: $(obj)/zImage FORCE
Sascha Hauercd227fb2011-08-17 14:23:46 +010092 @$(check_for_multiple_loadaddr)
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 $(call if_changed,uimage)
Linus Torvalds1da177e2005-04-16 15:20:36 -070094
95$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
96 $(Q)$(MAKE) $(build)=$(obj)/bootp $@
Linus Torvalds1da177e2005-04-16 15:20:36 -070097
98$(obj)/bootpImage: $(obj)/bootp/bootp FORCE
99 $(call if_changed,objcopy)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100
Masahiro Yamadabc5ce152016-04-05 03:08:26 +0100101PHONY += initrd install zinstall uinstall
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102initrd:
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
Robert Richter19514fc2013-07-17 18:05:06 +0200108install:
109 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 $(obj)/Image System.map "$(INSTALL_PATH)"
111
Robert Richter19514fc2013-07-17 18:05:06 +0200112zinstall:
113 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 $(obj)/zImage System.map "$(INSTALL_PATH)"
115
Robert Richter19514fc2013-07-17 18:05:06 +0200116uinstall:
117 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
Russell Kinga65d2922011-01-08 16:18:51 +0000118 $(obj)/uImage System.map "$(INSTALL_PATH)"
119
Nishanth Menon9e25fe62013-01-22 15:27:29 -0600120subdir- := bootp compressed dts