Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # SPDX-License-Identifier: GPL-2.0
  2. KBUILD_DEFCONFIG := mmu_defconfig
  3. UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
  4. # What CPU version are we building for, and crack it open
  5. # as major.minor.rev
  6. CPU_VER := $(CONFIG_XILINX_MICROBLAZE0_HW_VER)
  7. CPU_MAJOR := $(word 1, $(subst ., , $(CPU_VER)))
  8. CPU_MINOR := $(word 2, $(subst ., , $(CPU_VER)))
  9. CPU_REV := $(word 3, $(subst ., , $(CPU_VER)))
  10. export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
  11. # Use cpu-related CONFIG_ vars to set compile options.
  12. # The various CONFIG_XILINX cpu features options are integers 0/1/2...
  13. # rather than bools y/n
  14. # Work out HW multipler support. This is tricky.
  15. # 1. Spartan2 has no HW multipliers.
  16. # 2. MicroBlaze v3.x always uses them, except in Spartan 2
  17. # 3. All other FPGa/CPU ver combos, we can trust the CONFIG_ settings
  18. ifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY)))
  19. ifeq ($(CPU_MAJOR),3)
  20. CPUFLAGS-1 += -mno-xl-soft-mul
  21. else
  22. # USE_HW_MUL can be 0, 1, or 2, defining a hierarchy of HW Mul support.
  23. CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high
  24. CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul
  25. endif
  26. endif
  27. CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
  28. CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
  29. CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
  30. ifdef CONFIG_CPU_BIG_ENDIAN
  31. KBUILD_CFLAGS += -mbig-endian
  32. KBUILD_AFLAGS += -mbig-endian
  33. KBUILD_LDFLAGS += -EB
  34. else
  35. KBUILD_CFLAGS += -mlittle-endian
  36. KBUILD_AFLAGS += -mlittle-endian
  37. KBUILD_LDFLAGS += -EL
  38. endif
  39. CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
  40. # r31 holds current when in kernel mode
  41. KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-y) $(CPUFLAGS-1) $(CPUFLAGS-2)
  42. libs-y += arch/microblaze/lib/
  43. boot := arch/microblaze/boot
  44. # Are we making a simpleImage.<boardname> target? If so, crack out the boardname
  45. DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
  46. export DTB
  47. all: linux.bin
  48. archheaders:
  49. $(Q)$(MAKE) $(build)=arch/microblaze/kernel/syscalls all
  50. PHONY += linux.bin linux.bin.gz linux.bin.ub
  51. linux.bin.ub linux.bin.gz: linux.bin
  52. linux.bin: vmlinux
  53. linux.bin linux.bin.gz linux.bin.ub:
  54. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  55. @echo 'Kernel: $(boot)/$@ is ready' ' (#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
  56. PHONY += simpleImage.$(DTB)
  57. simpleImage.$(DTB): vmlinux
  58. $(Q)$(MAKE) $(build)=$(boot) $(addprefix $(boot)/$@., ub unstrip strip)
  59. @echo 'Kernel: $(boot)/$@ is ready' ' (#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
  60. define archhelp
  61. echo '* linux.bin - Create raw binary'
  62. echo ' linux.bin.gz - Create compressed raw binary'
  63. echo ' linux.bin.ub - Create U-Boot wrapped raw binary'
  64. echo ' simpleImage.<dt> - Create the following images with <dt>.dtb linked in'
  65. echo ' simpleImage.<dt> : raw image'
  66. echo ' simpleImage.<dt>.ub : raw image with U-Boot header'
  67. echo ' simpleImage.<dt>.unstrip: ELF (identical to vmlinux)'
  68. echo ' simpleImage.<dt>.strip : stripped ELF'
  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
  75. MRPROPER_FILES += $(boot)/simpleImage.*