xref: /linux/arch/sh/boot/Makefile (revision e66ac3f26aef131f5ca60350d25fba95f43acd0d)
1#
2# arch/sh/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# Copyright (C) 1999 Stuart Menefy
9#
10
11MKIMAGE := $(srctree)/scripts/mkuboot.sh
12
13#
14# Assign safe dummy values if these variables are not defined,
15# in order to suppress error message.
16#
17CONFIG_PAGE_OFFSET	?= 0x80000000
18CONFIG_MEMORY_START	?= 0x0c000000
19CONFIG_BOOT_LINK_OFFSET	?= 0x00800000
20CONFIG_ZERO_PAGE_OFFSET	?= 0x00001000
21CONFIG_ENTRY_OFFSET	?= 0x00001000
22CONFIG_PHYSICAL_START	?= $(CONFIG_MEMORY_START)
23
24suffix-y := bin
25suffix-$(CONFIG_KERNEL_GZIP)	:= gz
26suffix-$(CONFIG_KERNEL_BZIP2)	:= bz2
27suffix-$(CONFIG_KERNEL_LZMA)	:= lzma
28suffix-$(CONFIG_KERNEL_XZ)	:= xz
29suffix-$(CONFIG_KERNEL_LZO)	:= lzo
30
31targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz \
32	   uImage.bz2 uImage.lzma uImage.xz uImage.lzo uImage.bin
33extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
34	   vmlinux.bin.xz vmlinux.bin.lzo
35subdir- := compressed romimage
36
37$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
38	$(call if_changed,objcopy)
39	@echo '  Kernel: $@ is ready'
40
41$(obj)/compressed/vmlinux: FORCE
42	$(Q)$(MAKE) $(build)=$(obj)/compressed $@
43
44$(obj)/romImage: $(obj)/romimage/vmlinux FORCE
45	$(call if_changed,objcopy)
46	@echo '  Kernel: $@ is ready'
47
48$(obj)/romimage/vmlinux: $(obj)/zImage FORCE
49	$(Q)$(MAKE) $(build)=$(obj)/romimage $@
50
51KERNEL_MEMORY	:= $(shell /bin/bash -c 'printf "0x%08x" \
52		     $$[$(CONFIG_PHYSICAL_START) & 0x1fffffff]')
53
54KERNEL_LOAD	:= $(shell /bin/bash -c 'printf "0x%08x" \
55		     $$[$(CONFIG_PAGE_OFFSET)  + \
56			$(KERNEL_MEMORY) + \
57			$(CONFIG_ZERO_PAGE_OFFSET)]')
58
59KERNEL_ENTRY	:= $(shell /bin/bash -c 'printf "0x%08x" \
60		     $$[$(CONFIG_PAGE_OFFSET)  + \
61			$(KERNEL_MEMORY) + \
62			$(CONFIG_ZERO_PAGE_OFFSET) + $(CONFIG_ENTRY_OFFSET)]')
63
64quiet_cmd_uimage = UIMAGE  $@
65      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
66		   -C $(2) -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \
67		   -n 'Linux-$(KERNELRELEASE)' -d $< $@
68
69$(obj)/vmlinux.bin: vmlinux FORCE
70	$(call if_changed,objcopy)
71
72$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
73	$(call if_changed,gzip)
74
75$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
76	$(call if_changed,bzip2)
77
78$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
79	$(call if_changed,lzma)
80
81$(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
82	$(call if_changed,xzkern)
83
84$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
85	$(call if_changed,lzo)
86
87$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2
88	$(call if_changed,uimage,bzip2)
89
90$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz
91	$(call if_changed,uimage,gzip)
92
93$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma
94	$(call if_changed,uimage,lzma)
95
96$(obj)/uImage.xz: $(obj)/vmlinux.bin.xz
97	$(call if_changed,uimage,xz)
98
99$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo
100	$(call if_changed,uimage,lzo)
101
102$(obj)/uImage.bin: $(obj)/vmlinux.bin
103	$(call if_changed,uimage,none)
104
105OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec
106$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux
107	$(call if_changed,objcopy)
108
109OBJCOPYFLAGS_uImage.srec := -I binary -O srec
110$(obj)/uImage.srec: $(obj)/uImage
111	$(call if_changed,objcopy)
112
113$(obj)/uImage: $(obj)/uImage.$(suffix-y)
114	@ln -sf $(notdir $<) $@
115	@echo '  Image $@ is ready'
116
117export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
118       CONFIG_PHYSICAL_START CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET \
119       KERNEL_MEMORY suffix-y
120