xref: /linux/arch/sh/boot/Makefile (revision a9de18eb761f7c1c860964b2e5addc1a35c7e861)
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
22
23export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
24       CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET
25
26targets := zImage vmlinux.srec uImage uImage.srec
27subdir- := compressed
28
29$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
30	$(call if_changed,objcopy)
31	@echo '  Kernel: $@ is ready'
32
33$(obj)/compressed/vmlinux: FORCE
34	$(Q)$(MAKE) $(build)=$(obj)/compressed $@
35
36ifeq ($(CONFIG_32BIT),y)
37KERNEL_LOAD	:= $(shell /bin/bash -c 'printf "0x%08x" \
38		     $$[$(CONFIG_PAGE_OFFSET)  + \
39			$(CONFIG_ZERO_PAGE_OFFSET)]')
40else
41KERNEL_LOAD	:= $(shell /bin/bash -c 'printf "0x%08x" \
42		     $$[$(CONFIG_PAGE_OFFSET)  + \
43			$(CONFIG_MEMORY_START) + \
44			$(CONFIG_ZERO_PAGE_OFFSET)]')
45endif
46
47KERNEL_ENTRY	:= $(shell /bin/bash -c 'printf "0x%08x" \
48		     $$[$(CONFIG_PAGE_OFFSET)  + \
49			$(CONFIG_MEMORY_START) + \
50			$(CONFIG_ZERO_PAGE_OFFSET) + $(CONFIG_ENTRY_OFFSET)]')
51
52quiet_cmd_uimage = UIMAGE  $@
53      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
54		   -C gzip -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \
55		   -n 'Linux-$(KERNELRELEASE)' -d $< $@
56
57$(obj)/uImage: $(obj)/vmlinux.bin.gz FORCE
58	$(call if_changed,uimage)
59	@echo '  Image $@ is ready'
60
61$(obj)/vmlinux.bin: vmlinux FORCE
62	$(call if_changed,objcopy)
63
64$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
65	$(call if_changed,gzip)
66
67OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec
68$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux
69	$(call if_changed,objcopy)
70
71OBJCOPYFLAGS_uImage.srec := -I binary -O srec
72$(obj)/uImage.srec: $(obj)/uImage
73	$(call if_changed,objcopy)
74
75clean-files	+= uImage uImage.srec vmlinux.srec \
76		   vmlinux.bin vmlinux.bin.gz
77