Makefile 3.1 KB

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