1#
2# arch/blackfin/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
9ifeq ($(CROSS_COMPILE),)
10CROSS_COMPILE    := bfin-uclinux-
11endif
12LDFLAGS_vmlinux  := -X
13OBJCOPYFLAGS     := -O binary -R .note -R .comment -S
14GZFLAGS          := -9
15
16KBUILD_CFLAGS           += $(call cc-option,-mno-fdpic)
17ifeq ($(CONFIG_ROMKERNEL),y)
18KBUILD_CFLAGS           += -mlong-calls
19endif
20KBUILD_AFLAGS           += $(call cc-option,-mno-fdpic)
21KBUILD_CFLAGS_MODULE    += -mlong-calls
22LDFLAGS                 += -m elf32bfin
23
24KBUILD_DEFCONFIG := BF537-STAMP_defconfig
25
26# setup the machine name and the machine dependent settings
27machine-$(CONFIG_BF512)  := bf518
28machine-$(CONFIG_BF514)  := bf518
29machine-$(CONFIG_BF516)  := bf518
30machine-$(CONFIG_BF518)  := bf518
31machine-$(CONFIG_BF522)  := bf527
32machine-$(CONFIG_BF523)  := bf527
33machine-$(CONFIG_BF524)  := bf527
34machine-$(CONFIG_BF525)  := bf527
35machine-$(CONFIG_BF526)  := bf527
36machine-$(CONFIG_BF527)  := bf527
37machine-$(CONFIG_BF531)  := bf533
38machine-$(CONFIG_BF532)  := bf533
39machine-$(CONFIG_BF533)  := bf533
40machine-$(CONFIG_BF534)  := bf537
41machine-$(CONFIG_BF536)  := bf537
42machine-$(CONFIG_BF537)  := bf537
43machine-$(CONFIG_BF538)  := bf538
44machine-$(CONFIG_BF539)  := bf538
45machine-$(CONFIG_BF542)  := bf548
46machine-$(CONFIG_BF542M) := bf548
47machine-$(CONFIG_BF544)  := bf548
48machine-$(CONFIG_BF544M) := bf548
49machine-$(CONFIG_BF547)  := bf548
50machine-$(CONFIG_BF547M) := bf548
51machine-$(CONFIG_BF548)  := bf548
52machine-$(CONFIG_BF548M) := bf548
53machine-$(CONFIG_BF549)  := bf548
54machine-$(CONFIG_BF549M) := bf548
55machine-$(CONFIG_BF561)  := bf561
56machine-$(CONFIG_BF609)  := bf609
57MACHINE := $(machine-y)
58export MACHINE
59
60cpu-$(CONFIG_BF512)  := bf512
61cpu-$(CONFIG_BF514)  := bf514
62cpu-$(CONFIG_BF516)  := bf516
63cpu-$(CONFIG_BF518)  := bf518
64cpu-$(CONFIG_BF522)  := bf522
65cpu-$(CONFIG_BF523)  := bf523
66cpu-$(CONFIG_BF524)  := bf524
67cpu-$(CONFIG_BF525)  := bf525
68cpu-$(CONFIG_BF526)  := bf526
69cpu-$(CONFIG_BF527)  := bf527
70cpu-$(CONFIG_BF531)  := bf531
71cpu-$(CONFIG_BF532)  := bf532
72cpu-$(CONFIG_BF533)  := bf533
73cpu-$(CONFIG_BF534)  := bf534
74cpu-$(CONFIG_BF536)  := bf536
75cpu-$(CONFIG_BF537)  := bf537
76cpu-$(CONFIG_BF538)  := bf538
77cpu-$(CONFIG_BF539)  := bf539
78cpu-$(CONFIG_BF542)  := bf542
79cpu-$(CONFIG_BF542M) := bf542m
80cpu-$(CONFIG_BF544)  := bf544
81cpu-$(CONFIG_BF544M) := bf544m
82cpu-$(CONFIG_BF547)  := bf547
83cpu-$(CONFIG_BF547M) := bf547m
84cpu-$(CONFIG_BF548)  := bf548
85cpu-$(CONFIG_BF548M) := bf548m
86cpu-$(CONFIG_BF549)  := bf549
87cpu-$(CONFIG_BF549M) := bf549m
88cpu-$(CONFIG_BF561)  := bf561
89cpu-$(CONFIG_BF609)  := bf609
90
91rev-$(CONFIG_BF_REV_0_0)  := 0.0
92rev-$(CONFIG_BF_REV_0_1)  := 0.1
93rev-$(CONFIG_BF_REV_0_2)  := 0.2
94rev-$(CONFIG_BF_REV_0_3)  := 0.3
95rev-$(CONFIG_BF_REV_0_4)  := 0.4
96rev-$(CONFIG_BF_REV_0_5)  := 0.5
97rev-$(CONFIG_BF_REV_0_6)  := 0.6
98rev-$(CONFIG_BF_REV_NONE) := none
99rev-$(CONFIG_BF_REV_ANY)  := any
100
101CPU_REV := $(cpu-y)-$(rev-y)
102export CPU_REV
103
104KBUILD_CFLAGS += -mcpu=$(CPU_REV)
105KBUILD_AFLAGS += -mcpu=$(CPU_REV)
106
107# - we utilize the silicon rev from the toolchain, so move it over to the checkflags
108CHECKFLAGS_SILICON = $(shell echo "" | $(CPP) $(KBUILD_CFLAGS) -dD - 2>/dev/null | awk '$$2 == "__SILICON_REVISION__" { print $$3 }')
109CHECKFLAGS += -D__SILICON_REVISION__=$(CHECKFLAGS_SILICON) -D__bfin__
110
111core-y   += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ arch/$(ARCH)/mach-common/
112
113# If we have a machine-specific directory, then include it in the build.
114ifneq ($(machine-y),)
115core-y   += arch/$(ARCH)/mach-$(MACHINE)/
116core-y   += arch/$(ARCH)/mach-$(MACHINE)/boards/
117endif
118
119ifeq ($(CONFIG_MPU),y)
120core-y	+= arch/$(ARCH)/kernel/cplb-mpu/
121else
122core-y	+= arch/$(ARCH)/kernel/cplb-nompu/
123endif
124
125drivers-$(CONFIG_OPROFILE) += arch/$(ARCH)/oprofile/
126
127libs-y   += arch/$(ARCH)/lib/
128
129machdirs	:= $(patsubst %,arch/blackfin/mach-%/, $(machine-y))
130
131KBUILD_CFLAGS += -Iarch/$(ARCH)/include/
132KBUILD_CFLAGS += -Iarch/$(ARCH)/mach-$(MACHINE)/include
133
134KBUILD_CPPFLAGS	+= $(patsubst %,-I$(srctree)/%include,$(machdirs))
135
136CLEAN_FILES += \
137	arch/$(ARCH)/kernel/asm-offsets.s \
138
139archclean:
140	$(Q)$(MAKE) $(clean)=$(boot)
141
142INSTALL_PATH ?= /tftpboot
143boot := arch/$(ARCH)/boot
144BOOT_TARGETS = uImage uImage.bin uImage.bz2 uImage.gz uImage.lzma uImage.lzo uImage.xip
145PHONY += $(BOOT_TARGETS) install
146KBUILD_IMAGE := $(boot)/uImage
147
148all: uImage
149
150$(BOOT_TARGETS): vmlinux
151	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
152
153install:
154	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
155
156define archhelp
157  echo  '* vmImage         - Alias to selected kernel format (vmImage.gz by default)'
158  echo  '  vmImage.bin     - Uncompressed Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.bin)'
159  echo  '  vmImage.bz2     - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.bz2)'
160  echo  '* vmImage.gz      - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.gz)'
161  echo  '  vmImage.lzma    - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzma)'
162  echo  '  vmImage.lzo     - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzo)'
163  echo  '  vmImage.xip     - XIP Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.xip)'
164  echo  '  install         - Install kernel using'
165  echo  '                     (your) ~/bin/$(INSTALLKERNEL) or'
166  echo  '                     (distribution) PATH: $(INSTALLKERNEL) or'
167  echo  '                     install to $$(INSTALL_PATH)'
168endef
169