Makefile 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. KBUILD_DEFCONFIG := mmu_defconfig
  2. ifeq ($(CONFIG_MMU),y)
  3. UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
  4. else
  5. UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
  6. endif
  7. # What CPU vesion are we building for, and crack it open
  8. # as major.minor.rev
  9. CPU_VER := $(shell echo $(CONFIG_XILINX_MICROBLAZE0_HW_VER))
  10. CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1)
  11. CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2)
  12. CPU_REV := $(shell echo $(CPU_VER) | cut -d '.' -f 3)
  13. export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
  14. # Use cpu-related CONFIG_ vars to set compile options.
  15. # The various CONFIG_XILINX cpu features options are integers 0/1/2...
  16. # rather than bools y/n
  17. # Work out HW multipler support. This is tricky.
  18. # 1. Spartan2 has no HW multipliers.
  19. # 2. MicroBlaze v3.x always uses them, except in Spartan 2
  20. # 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings
  21. ifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY)))
  22. ifeq ($(CPU_MAJOR),3)
  23. CPUFLAGS-1 += -mno-xl-soft-mul
  24. else
  25. # USE_HW_MUL can be 0, 1, or 2, defining a hierarchy of HW Mul support.
  26. CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high
  27. CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul
  28. endif
  29. endif
  30. CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
  31. CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
  32. CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
  33. CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
  34. # r31 holds current when in kernel mode
  35. KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2)
  36. LDFLAGS :=
  37. LDFLAGS_vmlinux :=
  38. head-y := arch/microblaze/kernel/head.o
  39. libs-y += arch/microblaze/lib/
  40. core-y += arch/microblaze/kernel/
  41. core-y += arch/microblaze/mm/
  42. core-$(CONFIG_PCI) += arch/microblaze/pci/
  43. drivers-$(CONFIG_OPROFILE) += arch/microblaze/oprofile/
  44. boot := arch/microblaze/boot
  45. # Are we making a simpleImage.<boardname> target? If so, crack out the boardname
  46. DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
  47. ifneq ($(DTB),)
  48. core-y += $(boot)/dts/
  49. endif
  50. # defines filename extension depending memory management type
  51. ifeq ($(CONFIG_MMU),)
  52. MMU := -nommu
  53. endif
  54. export MMU DTB
  55. all: linux.bin
  56. archclean:
  57. $(Q)$(MAKE) $(clean)=$(boot)
  58. linux.bin linux.bin.gz linux.bin.ub: vmlinux
  59. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  60. simpleImage.%: vmlinux
  61. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  62. define archhelp
  63. echo '* linux.bin - Create raw binary'
  64. echo ' linux.bin.gz - Create compressed raw binary'
  65. echo ' linux.bin.ub - Create U-Boot wrapped raw binary'
  66. echo ' simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in'
  67. echo ' - stripped elf with fdt blob'
  68. echo ' simpleImage.<dt>.unstrip - full ELF image with fdt blob'
  69. echo ' *_defconfig - Select default config from arch/microblaze/configs'
  70. echo ''
  71. echo ' Targets with <dt> embed a device tree blob inside the image'
  72. echo ' These targets support board with firmware that does not'
  73. echo ' support passing a device tree directly. Replace <dt> with the'
  74. echo ' name of a dts file from the arch/microblaze/boot/dts/ directory'
  75. echo ' (minus the .dts extension).'
  76. endef
  77. MRPROPER_FILES += $(boot)/simpleImage.*