blob: a69eaf2ab1301466c662e27f37837c86d8193d61 [file] [log] [blame]
Geert Uytterhoeven8fad84c2013-11-12 20:22:44 +01001KBUILD_DEFCONFIG := mmu_defconfig
2
Michal Simek4b2368f2009-05-26 16:30:32 +02003ifeq ($(CONFIG_MMU),y)
4UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
5else
Michal Simek5f8ffb52009-03-27 14:25:51 +01006UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
Michal Simek4b2368f2009-05-26 16:30:32 +02007endif
Michal Simek5f8ffb52009-03-27 14:25:51 +01008
9# What CPU vesion are we building for, and crack it open
10# as major.minor.rev
Sam Ravnborg950b2602009-07-24 09:04:49 +020011CPU_VER := $(shell echo $(CONFIG_XILINX_MICROBLAZE0_HW_VER))
12CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1)
13CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2)
14CPU_REV := $(shell echo $(CPU_VER) | cut -d '.' -f 3)
Michal Simek5f8ffb52009-03-27 14:25:51 +010015
16export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
17
18# Use cpu-related CONFIG_ vars to set compile options.
Sam Ravnborg950b2602009-07-24 09:04:49 +020019# The various CONFIG_XILINX cpu features options are integers 0/1/2...
20# rather than bools y/n
Michal Simek5f8ffb52009-03-27 14:25:51 +010021
Michal Simek7f01af02011-01-03 11:35:28 +010022# Work out HW multipler support. This is tricky.
Lucas De Marchi25985ed2011-03-30 22:57:33 -030023# 1. Spartan2 has no HW multipliers.
Michal Simek5f8ffb52009-03-27 14:25:51 +010024# 2. MicroBlaze v3.x always uses them, except in Spartan 2
25# 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings
26ifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY)))
27 ifeq ($(CPU_MAJOR),3)
28 CPUFLAGS-1 += -mno-xl-soft-mul
29 else
Uwe Kleine-König732bee72010-06-11 12:16:59 +020030 # USE_HW_MUL can be 0, 1, or 2, defining a hierarchy of HW Mul support.
Michal Simek5f8ffb52009-03-27 14:25:51 +010031 CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high
32 CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul
33 endif
34endif
35CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
36CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
Michal Simek04e3a552009-04-20 09:56:24 +020037CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
Michal Simek5f8ffb52009-03-27 14:25:51 +010038
39CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
40
Michal Simek5f8ffb52009-03-27 14:25:51 +010041# r31 holds current when in kernel mode
John Williamse469b0e2009-09-17 21:21:23 +100042KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2)
Michal Simek5f8ffb52009-03-27 14:25:51 +010043
Thomas Chouc3055d12009-05-19 22:48:10 +080044LDFLAGS :=
45LDFLAGS_vmlinux :=
Michal Simek5f8ffb52009-03-27 14:25:51 +010046
Sam Ravnborg950b2602009-07-24 09:04:49 +020047head-y := arch/microblaze/kernel/head.o
48libs-y += arch/microblaze/lib/
Sam Ravnborg950b2602009-07-24 09:04:49 +020049core-y += arch/microblaze/kernel/
50core-y += arch/microblaze/mm/
51core-y += arch/microblaze/platform/
Michal Simeka6475c12010-01-18 15:27:10 +010052core-$(CONFIG_PCI) += arch/microblaze/pci/
Michal Simek5f8ffb52009-03-27 14:25:51 +010053
John Williams3540ce82009-11-24 20:27:54 +100054drivers-$(CONFIG_OPROFILE) += arch/microblaze/oprofile/
55
Sam Ravnborg950b2602009-07-24 09:04:49 +020056boot := arch/microblaze/boot
Michal Simek5f8ffb52009-03-27 14:25:51 +010057
Michal Simekf05131c2009-09-14 15:15:49 +020058# Are we making a simpleImage.<boardname> target? If so, crack out the boardname
59DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
60
61ifneq ($(DTB),)
Stephen Warren300db342012-11-27 16:29:15 -070062 core-y += $(boot)/dts/
Michal Simekf05131c2009-09-14 15:15:49 +020063endif
64
Michal Simek5f8ffb52009-03-27 14:25:51 +010065# defines filename extension depending memory management type
66ifeq ($(CONFIG_MMU),)
Sam Ravnborg950b2602009-07-24 09:04:49 +020067MMU := -nommu
Michal Simek5f8ffb52009-03-27 14:25:51 +010068endif
Sam Ravnborg950b2602009-07-24 09:04:49 +020069
Michal Simekf05131c2009-09-14 15:15:49 +020070export MMU DTB
Michal Simek5f8ffb52009-03-27 14:25:51 +010071
72all: linux.bin
73
74archclean:
75 $(Q)$(MAKE) $(clean)=$(boot)
76
Jason Wuec2eba52013-08-21 07:10:32 +020077linux.bin linux.bin.gz linux.bin.ub: vmlinux
Thomas Backlundb843e4e2010-10-21 13:19:10 +030078 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
Jason Wu5f5e3232013-01-31 13:59:09 +100079
80simpleImage.%: vmlinux
Michal Simek5f8ffb52009-03-27 14:25:51 +010081 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
82
83define archhelp
Michal Simekf05131c2009-09-14 15:15:49 +020084 echo '* linux.bin - Create raw binary'
85 echo ' linux.bin.gz - Create compressed raw binary'
Jason Wuec2eba52013-08-21 07:10:32 +020086 echo ' linux.bin.ub - Create U-Boot wrapped raw binary'
Michal Simekf05131c2009-09-14 15:15:49 +020087 echo ' simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in'
Arun Bhanu699d17b2010-03-12 16:31:40 +080088 echo ' - stripped elf with fdt blob'
Michal Simekf05131c2009-09-14 15:15:49 +020089 echo ' simpleImage.<dt>.unstrip - full ELF image with fdt blob'
90 echo ' *_defconfig - Select default config from arch/microblaze/configs'
91 echo ''
92 echo ' Targets with <dt> embed a device tree blob inside the image'
93 echo ' These targets support board with firmware that does not'
94 echo ' support passing a device tree directly. Replace <dt> with the'
95 echo ' name of a dts file from the arch/microblaze/boot/dts/ directory'
96 echo ' (minus the .dts extension).'
Michal Simek5f8ffb52009-03-27 14:25:51 +010097endef
Arun Bhanu8a8804f2010-03-17 16:06:03 +080098
99MRPROPER_FILES += $(boot)/simpleImage.*