blob: a3af4dc08c3e94a67ef0c06d8f9402ca1910f420 [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
19
20# Note: the following conditions must always be true:
Russell King9e84ed62010-09-09 22:39:41 +010021# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
Linus Torvalds1da177e2005-04-16 15:20:36 -070022# PARAMS_PHYS must be within 4MB of ZRELADDR
23# INITRD_PHYS must be in RAM
Russell King9e84ed62010-09-09 22:39:41 +010024ZRELADDR := $(zreladdr-y)
Linus Torvalds1da177e2005-04-16 15:20:36 -070025PARAMS_PHYS := $(params_phys-y)
26INITRD_PHYS := $(initrd_phys-y)
27
Russell King9e84ed62010-09-09 22:39:41 +010028export ZRELADDR INITRD_PHYS PARAMS_PHYS
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
30targets := Image zImage xipImage bootpImage uImage
31
32ifeq ($(CONFIG_XIP_KERNEL),y)
33
Nicolas Pitreca8b5d92017-08-25 00:54:18 -040034cmd_deflate_xip_data = $(CONFIG_SHELL) -c \
35 '$(srctree)/$(src)/deflate_xip_data.sh $< $@ || { rm -f $@; false; }'
36
37ifeq ($(CONFIG_XIP_DEFLATED_DATA),y)
38quiet_cmd_mkxip = XIPZ $@
39cmd_mkxip = $(cmd_objcopy) && $(cmd_deflate_xip_data)
40else
41quiet_cmd_mkxip = $(quiet_cmd_objcopy)
42cmd_mkxip = $(cmd_objcopy)
43endif
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045$(obj)/xipImage: vmlinux FORCE
Nicolas Pitreca8b5d92017-08-25 00:54:18 -040046 $(call if_changed,mkxip)
Masahiro Yamadac6bbfbb72016-05-30 03:01:23 +010047 @$(kecho) ' Physical Address of xipImage: $(CONFIG_XIP_PHYS_ADDR)'
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
49$(obj)/Image $(obj)/zImage: FORCE
50 @echo 'Kernel configured for XIP (CONFIG_XIP_KERNEL=y)'
51 @echo 'Only the xipImage target is available in this case'
52 @false
53
54else
55
56$(obj)/xipImage: FORCE
57 @echo 'Kernel not configured for XIP (CONFIG_XIP_KERNEL!=y)'
58 @false
59
60$(obj)/Image: vmlinux FORCE
61 $(call if_changed,objcopy)
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
63$(obj)/compressed/vmlinux: $(obj)/Image FORCE
64 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
65
66$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
67 $(call if_changed,objcopy)
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
69endif
70
Stephen Warrene3393642012-03-16 15:03:55 -060071ifneq ($(LOADADDR),)
72 UIMAGE_LOADADDR=$(LOADADDR)
Uwe Kleine-König0f980142008-03-06 16:22:33 +010073else
Stephen Warrene3393642012-03-16 15:03:55 -060074 ifeq ($(CONFIG_ZBOOT_ROM),y)
75 UIMAGE_LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
76 else
77 UIMAGE_LOADADDR=$(ZRELADDR)
78 endif
Uwe Kleine-König0f980142008-03-06 16:22:33 +010079endif
80
Sascha Hauercd227fb2011-08-17 14:23:46 +010081check_for_multiple_loadaddr = \
Olof Johansson938f94c2013-02-23 08:02:24 +010082if [ $(words $(UIMAGE_LOADADDR)) -ne 1 ]; then \
83 echo 'multiple (or no) load addresses: $(UIMAGE_LOADADDR)'; \
Sascha Hauercd227fb2011-08-17 14:23:46 +010084 echo 'This is incompatible with uImages'; \
85 echo 'Specify LOADADDR on the commandline to build an uImage'; \
86 false; \
87fi
88
Linus Torvalds1da177e2005-04-16 15:20:36 -070089$(obj)/uImage: $(obj)/zImage FORCE
Sascha Hauercd227fb2011-08-17 14:23:46 +010090 @$(check_for_multiple_loadaddr)
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 $(call if_changed,uimage)
Linus Torvalds1da177e2005-04-16 15:20:36 -070092
93$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
94 $(Q)$(MAKE) $(build)=$(obj)/bootp $@
Linus Torvalds1da177e2005-04-16 15:20:36 -070095
96$(obj)/bootpImage: $(obj)/bootp/bootp FORCE
97 $(call if_changed,objcopy)
Linus Torvalds1da177e2005-04-16 15:20:36 -070098
Masahiro Yamadabc5ce152016-04-05 03:08:26 +010099PHONY += initrd install zinstall uinstall
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100initrd:
101 @test "$(INITRD_PHYS)" != "" || \
102 (echo This machine does not support INITRD; exit -1)
103 @test "$(INITRD)" != "" || \
104 (echo You must specify INITRD; exit -1)
105
Robert Richter19514fc2013-07-17 18:05:06 +0200106install:
107 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 $(obj)/Image System.map "$(INSTALL_PATH)"
109
Robert Richter19514fc2013-07-17 18:05:06 +0200110zinstall:
111 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 $(obj)/zImage System.map "$(INSTALL_PATH)"
113
Robert Richter19514fc2013-07-17 18:05:06 +0200114uinstall:
115 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
Russell Kinga65d2922011-01-08 16:18:51 +0000116 $(obj)/uImage System.map "$(INSTALL_PATH)"
117
Nishanth Menon9e25fe62013-01-22 15:27:29 -0600118subdir- := bootp compressed dts