Makefile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_KERNEL += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2)
  35. LDFLAGS :=
  36. LDFLAGS_vmlinux :=
  37. LIBGCC := $(shell $(CC) $(KBUILD_KERNEL) -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. # defines filename extension depending memory management type
  46. ifeq ($(CONFIG_MMU),)
  47. MMU := -nommu
  48. endif
  49. export MMU
  50. all: linux.bin
  51. archclean:
  52. $(Q)$(MAKE) $(clean)=$(boot)
  53. linux.bin linux.bin.gz: vmlinux
  54. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  55. define archhelp
  56. echo '* linux.bin - Create raw binary'
  57. echo ' linux.bin.gz - Create compressed raw binary'
  58. endef