1#
2# arch/arm/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) 1995-2001 by Russell King
9
10LINKFLAGS	:=-p -X -T arch/arm/vmlinux.lds
11OBJCOPYFLAGS	:=-O binary -R .note -R .comment -S
12GZFLAGS		:=-9
13CFLAGS		+=-Uarm -fno-common -pipe
14
15ifeq ($(CONFIG_FRAME_POINTER),y)
16CFLAGS		:=$(CFLAGS:-fomit-frame-pointer=-mapcs -mno-sched-prolog)
17endif
18
19CFLAGS		:=$(CFLAGS:-O2=-Os)
20
21ifeq ($(CONFIG_DEBUG_INFO),y)
22CFLAGS		+=-g
23endif
24
25# Select CPU dependent flags.  Note that order of declaration is important;
26# the options further down the list override previous items.
27#
28# Note!  For APCS-26 YOU MUST HAVE AN APCS-26 LIBGCC.A
29#
30apcs-y				:=-mapcs-32
31apcs-$(CONFIG_CPU_26)		:=-mapcs-26 -mcpu=arm3 -Os
32
33# This selects which instruction set is used.
34# Note that GCC is lame - it doesn't numerically define an
35# architecture version macro, but instead defines a whole
36# series of macros.
37arch-y				:=
38arch-$(CONFIG_CPU_32v3)		:=-D__LINUX_ARM_ARCH__=3 -march=armv3
39arch-$(CONFIG_CPU_32v4)		:=-D__LINUX_ARM_ARCH__=4 -march=armv4
40arch-$(CONFIG_CPU_32v5)		:=-D__LINUX_ARM_ARCH__=5 -march=armv5
41
42# This selects how we optimise for the processor.
43tune-y				:=
44tune-$(CONFIG_CPU_ARM610)	:=-mtune=arm610
45tune-$(CONFIG_CPU_ARM710)	:=-mtune=arm710
46tune-$(CONFIG_CPU_ARM720T)	:=-mtune=arm7tdmi
47tune-$(CONFIG_CPU_ARM920T)	:=-mtune=arm9tdmi
48tune-$(CONFIG_CPU_ARM922T)	:=-mtune=arm9tdmi
49tune-$(CONFIG_CPU_ARM926T)	:=-mtune=arm9tdmi
50tune-$(CONFIG_CPU_SA110)	:=-mtune=strongarm110
51tune-$(CONFIG_CPU_SA1100)	:=-mtune=strongarm1100
52
53CFLAGS_BOOT	:=$(apcs-y) $(arch-y) $(tune-y) -mshort-load-bytes -msoft-float -Uarm
54CFLAGS		+=$(apcs-y) $(arch-y) $(tune-y) -mshort-load-bytes -msoft-float -Uarm
55AFLAGS		+=$(apcs-y) $(arch-y) -mno-fpu -msoft-float
56
57ifeq ($(CONFIG_CPU_26),y)
58PROCESSOR	:= armo
59  ifeq ($(CONFIG_ROM_KERNEL),y)
60    DATAADDR	 = 0x02080000
61    TEXTADDR	 = 0x03800000
62    LDSCRIPT	 = arch/arm/vmlinux-armo-rom.lds.in
63  else
64    TEXTADDR	 = 0x02080000
65    LDSCRIPT	 = arch/arm/vmlinux-armo.lds.in
66  endif
67endif
68
69ifeq ($(CONFIG_CPU_32),y)
70PROCESSOR	 = armv
71TEXTADDR	 = 0xC0008000
72LDSCRIPT	 = arch/arm/vmlinux-armv.lds.in
73endif
74
75ifeq ($(CONFIG_ARCH_ARCA5K),y)
76MACHINE		 = arc
77endif
78
79ifeq ($(CONFIG_ARCH_RPC),y)
80MACHINE		 = rpc
81endif
82
83ifeq ($(CONFIG_ARCH_EBSA110),y)
84MACHINE		 = ebsa110
85CFLAGS_3c589_cs	:=-DISA_SIXTEEN_BIT_PERIPHERAL
86export CFLAGS_3c589_cs
87endif
88
89ifeq ($(CONFIG_ARCH_CLPS7500),y)
90MACHINE		 = clps7500
91INCDIR		 = cl7500
92endif
93
94ifeq ($(CONFIG_ARCH_RISCSTATION),y)
95MACHINE		 = riscstation
96endif
97
98ifeq ($(CONFIG_FOOTBRIDGE),y)
99MACHINE		 = footbridge
100INCDIR		 = ebsa285
101endif
102
103ifeq ($(CONFIG_ARCH_CO285),y)
104TEXTADDR	 = 0x60008000
105MACHINE		 = footbridge
106INCDIR		 = ebsa285
107endif
108
109ifeq ($(CONFIG_ARCH_FTVPCI),y)
110MACHINE		 = ftvpci
111INCDIR		 = nexuspci
112endif
113
114ifeq ($(CONFIG_ARCH_TBOX),y)
115MACHINE		 = tbox
116endif
117
118ifeq ($(CONFIG_ARCH_SHARK),y)
119MACHINE		 = shark
120endif
121
122ifeq ($(CONFIG_ARCH_SA1100),y)
123ifeq ($(CONFIG_SA1111),y)
124# SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
125TEXTADDR	 = 0xc0208000
126endif
127MACHINE		 = sa1100
128endif
129
130ifeq ($(CONFIG_ARCH_L7200),y)
131MACHINE		 = l7200
132endif
133
134ifeq ($(CONFIG_ARCH_INTEGRATOR),y)
135MACHINE		 = integrator
136endif
137
138ifeq ($(CONFIG_ARCH_AT91RM9200),y)
139MACHINE		 = at91rm9200
140endif
141
142ifeq ($(CONFIG_ARCH_MX1ADS),y)
143MACHINE		 = mx1ads
144endif
145
146ifeq ($(CONFIG_ARCH_CAMELOT),y)
147MACHINE          = epxa
148endif
149
150ifeq ($(CONFIG_ARCH_CLPS711X),y)
151TEXTADDR	 = 0xc0028000
152MACHINE		 = clps711x
153endif
154
155ifeq ($(CONFIG_ARCH_FORTUNET),y)
156TEXTADDR	 = 0xc0208000
157endif
158
159ifeq ($(CONFIG_ARCH_ANAKIN),y)
160MACHINE		 = anakin
161endif
162
163ifeq ($(CONFIG_ARCH_OMAHA),y)
164MACHINE                = omaha
165endif
166
167export	MACHINE PROCESSOR TEXTADDR GZFLAGS CFLAGS_BOOT OBJCOPYFLAGS
168
169# Only set INCDIR if its not already defined above
170# Grr, ?= doesn't work as all the other assignment operators do.  Make bug?
171ifeq ($(origin INCDIR), undefined)
172INCDIR		:=$(MACHINE)
173endif
174
175ifeq ($(origin DATAADDR), undefined)
176DATAADDR	:= .
177endif
178
179# If we have a machine-specific directory, then include it in the build.
180MACHDIR		:= arch/arm/mach-$(MACHINE)
181ifeq ($(MACHDIR),$(wildcard $(MACHDIR)))
182SUBDIRS		+= $(MACHDIR)
183CORE_FILES	:= $(MACHDIR)/$(MACHINE).o $(CORE_FILES)
184endif
185
186HEAD		:=arch/arm/kernel/head-$(PROCESSOR).o \
187		  arch/arm/kernel/init_task.o
188SUBDIRS		+=arch/arm/kernel arch/arm/mm arch/arm/lib arch/arm/nwfpe
189CORE_FILES	:=arch/arm/kernel/kernel.o arch/arm/mm/mm.o $(CORE_FILES)
190LIBS		:=arch/arm/lib/lib.a $(LIBS)
191
192ifeq ($(CONFIG_FPE_NWFPE),y)
193LIBS		:=arch/arm/nwfpe/math-emu.o $(LIBS)
194endif
195
196# Only include fastfpe if it is part of the kernel tree.
197FASTFPE		:=arch/arm/fastfpe
198ifeq ($(FASTFPE),$(wildcard $(FASTFPE)))
199SUBDIRS		+=$(FASTFPE)
200ifeq ($(CONFIG_FPE_FASTFPE),y)
201LIBS		:=arch/arm/fastfpe/fast-math-emu.o $(LIBS)
202endif
203endif
204
205ifeq ($(findstring y,$(CONFIG_USB_OHCI_SA1111) $(CONFIG_USB_OHCI_AT91)),y)
206   SUBDIRS	+=arch/arm/common
207   CORE_FILES	+=arch/arm/common/nopci.o
208endif
209
210ifeq ($(findstring y,$(CONFIG_ARCH_CLPS7500) $(CONFIG_ARCH_L7200)),y)
211SUBDIRS		+=drivers/acorn/char
212DRIVERS		+=drivers/acorn/char/acorn-char.o
213endif
214
215ifeq ($(CONFIG_ARCH_RISCSTATION),y)
216SUBDIRS		+=drivers/acorn/char
217DRIVERS		+=drivers/acorn/char/acorn-char.o
218endif
219
220MAKEBOOT	 =$(MAKE) -C arch/$(ARCH)/boot
221MAKETOOLS	 =$(MAKE) -C arch/$(ARCH)/tools
222
223# The following is a hack to get 'constants.h' up
224# to date before starting compilation
225
226$(patsubst %,_dir_%, $(SUBDIRS)): maketools
227$(patsubst %,_modsubdir_%,$(MOD_DIRS)): maketools
228
229symlinks: include/asm-arm/.arch include/asm-arm/.proc
230
231#	Update machine arch and proc symlinks if something which affects
232#	them changed.  We use .arch and .proc to indicate when they were
233#	updated last, otherwise make uses the target directory mtime.
234
235include/asm-arm/.arch: $(wildcard include/config/arch/*.h)
236ifneq ("$(INCDIR)","")
237	@echo '  Making asm-arm/arch -> asm-arm/arch-$(INCDIR) symlink'
238	@rm -f include/asm-arm/arch
239	@ln -sf arch-$(INCDIR) include/asm-arm/arch
240	@touch $@
241else
242	@echo '  No architecture defined.  You may want to use a pre-packaged config.  make a5k_config, ebsa110_config, footbridge_config, etc.'
243endif
244
245include/asm-arm/.proc: $(wildcard include/config/cpu/32.h) $(wildcard include/config/cpu/26.h)
246ifneq ("$(INCDIR)","")
247	@echo '  Making asm-arm/proc -> asm-arm/proc-$(PROCESSOR) symlink'
248	@rm -f include/asm-arm/proc
249	@ln -sf proc-$(PROCESSOR) include/asm-arm/proc
250	@touch $@
251else
252	@echo '  No architecture defined.  You may want to use a pre-packaged config.  make a5k_config, ebsa110_config, footbridge_config, etc.'
253endif
254
255.PHONY: maketools
256maketools: include/asm-arm/.arch include/asm-arm/.proc \
257        include/asm-arm/constants.h include/linux/version.h checkbin
258	@$(MAKETOOLS)
259
260vmlinux: arch/arm/vmlinux.lds
261
262arch/arm/vmlinux.lds: arch/arm/Makefile $(LDSCRIPT) \
263	$(wildcard include/config/cpu/32.h) \
264	$(wildcard include/config/cpu/26.h) \
265	$(wildcard include/config/arch/*.h)
266	@echo '  Generating $@'
267	@sed 's/TEXTADDR/$(TEXTADDR)/;s/DATAADDR/$(DATAADDR)/' $(LDSCRIPT) >$@
268
269arch/arm/kernel arch/arm/mm arch/arm/lib: dummy
270	$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" $(subst $@, _dir_$@, $@)
271
272bzImage zImage zinstall Image bootpImage install: vmlinux
273	@$(MAKEBOOT) $@
274
275CLEAN_FILES	+= \
276	arch/arm/vmlinux.lds
277
278MRPROPER_FILES	+= \
279	arch/arm/tools/constants.h* \
280	include/asm-arm/arch include/asm-arm/.arch \
281	include/asm-arm/proc include/asm-arm/.proc \
282	include/asm-arm/constants.h* \
283	include/asm-arm/mach-types.h
284
285# We use MRPROPER_FILES and CLEAN_FILES now
286archmrproper: FORCE
287	@/bin/true
288
289archclean: FORCE
290	@$(MAKEBOOT) clean
291
292archdep: scripts/mkdep symlinks
293	@$(MAKETOOLS) dep
294	@$(MAKEBOOT) dep
295
296# Ensure this is ld "2.9.5" or later
297NEW_LINKER	:= $(shell $(LD) --gc-sections --version >/dev/null 2>&1; echo $$?)
298
299ifneq ($(NEW_LINKER),0)
300checkbin: FORCE
301	@echo '*** ${VERSION}.${PATCHLEVEL} kernels no longer build correctly with old versions of binutils.'
302	@echo '*** Please upgrade your binutils to 2.9.5.'
303	@false
304else
305checkbin: FORCE
306	@true
307endif
308
309.PHONY: FORCE
310
311# My testing targets (that short circuit a few dependencies)
312zImg:;	@$(MAKEBOOT) zImage
313Img:;	@$(MAKEBOOT) Image
314i:;	@$(MAKEBOOT) install
315zi:;	@$(MAKEBOOT) zinstall
316bp:;	@$(MAKEBOOT) bootpImage
317
318#
319# Configuration targets.  Use these to select a
320# configuration for your architecture
321%_config:
322	@( \
323	CFG=$(@:_config=); \
324	if [ -f arch/arm/def-configs/$$CFG ]; then \
325	  [ -f .config ] && mv -f .config .config.old; \
326	  cp arch/arm/def-configs/$$CFG .config; \
327	  echo "*** Default configuration for $$CFG installed"; \
328	  echo "*** Next, you may run 'make oldconfig'"; \
329	else \
330	  echo "$$CFG does not exist"; \
331	fi; \
332	)
333