blob: 740f2b82a182a9761b79028d38bde746ba7131c3 [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/
Michal Simeka6475c12010-01-18 15:27:10 +010051core-$(CONFIG_PCI) += arch/microblaze/pci/
Michal Simek5f8ffb52009-03-27 14:25:51 +010052
John Williams3540ce82009-11-24 20:27:54 +100053drivers-$(CONFIG_OPROFILE) += arch/microblaze/oprofile/
54
Sam Ravnborg950b2602009-07-24 09:04:49 +020055boot := arch/microblaze/boot
Michal Simek5f8ffb52009-03-27 14:25:51 +010056
Michal Simekf05131c2009-09-14 15:15:49 +020057# Are we making a simpleImage.<boardname> target? If so, crack out the boardname
58DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
59
60ifneq ($(DTB),)
Stephen Warren300db342012-11-27 16:29:15 -070061 core-y += $(boot)/dts/
Michal Simekf05131c2009-09-14 15:15:49 +020062endif
63
Michal Simek5f8ffb52009-03-27 14:25:51 +010064# defines filename extension depending memory management type
65ifeq ($(CONFIG_MMU),)
Sam Ravnborg950b2602009-07-24 09:04:49 +020066MMU := -nommu
Michal Simek5f8ffb52009-03-27 14:25:51 +010067endif
Sam Ravnborg950b2602009-07-24 09:04:49 +020068
Michal Simekf05131c2009-09-14 15:15:49 +020069export MMU DTB
Michal Simek5f8ffb52009-03-27 14:25:51 +010070
71all: linux.bin
72
73archclean:
74 $(Q)$(MAKE) $(clean)=$(boot)
75
Jason Wuec2eba52013-08-21 07:10:32 +020076linux.bin linux.bin.gz linux.bin.ub: vmlinux
Thomas Backlundb843e4e2010-10-21 13:19:10 +030077 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
Jason Wu5f5e3232013-01-31 13:59:09 +100078
79simpleImage.%: vmlinux
Michal Simek5f8ffb52009-03-27 14:25:51 +010080 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
81
82define archhelp
Michal Simekf05131c2009-09-14 15:15:49 +020083 echo '* linux.bin - Create raw binary'
84 echo ' linux.bin.gz - Create compressed raw binary'
Jason Wuec2eba52013-08-21 07:10:32 +020085 echo ' linux.bin.ub - Create U-Boot wrapped raw binary'
Michal Simekf05131c2009-09-14 15:15:49 +020086 echo ' simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in'
Arun Bhanu699d17b2010-03-12 16:31:40 +080087 echo ' - stripped elf with fdt blob'
Michal Simekf05131c2009-09-14 15:15:49 +020088 echo ' simpleImage.<dt>.unstrip - full ELF image with fdt blob'
89 echo ' *_defconfig - Select default config from arch/microblaze/configs'
90 echo ''
91 echo ' Targets with <dt> embed a device tree blob inside the image'
92 echo ' These targets support board with firmware that does not'
93 echo ' support passing a device tree directly. Replace <dt> with the'
94 echo ' name of a dts file from the arch/microblaze/boot/dts/ directory'
95 echo ' (minus the .dts extension).'
Michal Simek5f8ffb52009-03-27 14:25:51 +010096endef
Arun Bhanu8a8804f2010-03-17 16:06:03 +080097
98MRPROPER_FILES += $(boot)/simpleImage.*