blob: 78efb04c28f3dfb2362e6610318491a99e08ce54 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#
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
Paul Mundtcf00e202006-12-07 17:00:32 +090011MKIMAGE := $(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
Paul Mundtd27e0852008-07-29 09:15:01 +090021CONFIG_ENTRY_OFFSET ?= 0x00001000
Paul Mundtcf00e202006-12-07 17:00:32 +090022
Paul Mundtcf00e202006-12-07 17:00:32 +090023targets := zImage vmlinux.srec uImage uImage.srec
Linus Torvalds1da177e2005-04-16 15:20:36 -070024subdir- := compressed
25
26$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
27 $(call if_changed,objcopy)
Paul Mundtcf00e202006-12-07 17:00:32 +090028 @echo ' Kernel: $@ is ready'
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
30$(obj)/compressed/vmlinux: FORCE
31 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
32
Yoshihiro Shimoda2f47f442009-03-10 15:49:54 +090033KERNEL_MEMORY := 0x00000000
34ifeq ($(CONFIG_PMB_FIXED),y)
35KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \
36 $$[$(CONFIG_MEMORY_START) & 0x1fffffff]')
Chris Smith664718a2008-09-05 16:24:13 +090037endif
Yoshihiro Shimoda2f47f442009-03-10 15:49:54 +090038ifeq ($(CONFIG_29BIT),y)
39KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \
40 $$[$(CONFIG_MEMORY_START)]')
41endif
42
Paul Mundtb2088352009-05-10 00:55:45 +090043export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
44 CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET KERNEL_MEMORY
45
Yoshihiro Shimoda2f47f442009-03-10 15:49:54 +090046KERNEL_LOAD := $(shell /bin/bash -c 'printf "0x%08x" \
47 $$[$(CONFIG_PAGE_OFFSET) + \
48 $(KERNEL_MEMORY) + \
49 $(CONFIG_ZERO_PAGE_OFFSET)]')
Thomas Betker453ec9c2007-11-30 18:22:10 +090050
Paul Mundt66b5bf42008-03-14 17:19:38 +090051KERNEL_ENTRY := $(shell /bin/bash -c 'printf "0x%08x" \
Paul Mundt6fc51532007-12-17 16:08:49 +090052 $$[$(CONFIG_PAGE_OFFSET) + \
Yoshihiro Shimoda2f47f442009-03-10 15:49:54 +090053 $(KERNEL_MEMORY) + \
Yoshihiro Shimoda82cb1f62008-07-23 16:49:06 +090054 $(CONFIG_ZERO_PAGE_OFFSET) + $(CONFIG_ENTRY_OFFSET)]')
Paul Mundtcf00e202006-12-07 17:00:32 +090055
56quiet_cmd_uimage = UIMAGE $@
57 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
Yoshihiro Shimoda26b63e92008-03-28 15:03:39 +090058 -C gzip -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \
Paul Mundtcf00e202006-12-07 17:00:32 +090059 -n 'Linux-$(KERNELRELEASE)' -d $< $@
60
Thomas Betker453ec9c2007-11-30 18:22:10 +090061$(obj)/uImage: $(obj)/vmlinux.bin.gz FORCE
Paul Mundtcf00e202006-12-07 17:00:32 +090062 $(call if_changed,uimage)
63 @echo ' Image $@ is ready'
64
Thomas Betker453ec9c2007-11-30 18:22:10 +090065$(obj)/vmlinux.bin: vmlinux FORCE
66 $(call if_changed,objcopy)
67
68$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
69 $(call if_changed,gzip)
70
Paul Mundtcf00e202006-12-07 17:00:32 +090071OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec
72$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux
73 $(call if_changed,objcopy)
74
75OBJCOPYFLAGS_uImage.srec := -I binary -O srec
76$(obj)/uImage.srec: $(obj)/uImage
77 $(call if_changed,objcopy)
78
Thomas Betker453ec9c2007-11-30 18:22:10 +090079clean-files += uImage uImage.srec vmlinux.srec \
80 vmlinux.bin vmlinux.bin.gz