Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #
  2. # Copyright (C) 2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/image.mk
  9. # On ARC initramfs is put before entry point and so entry point moves
  10. # in memory from build to built. Thus we need to extract EP from vmlinux
  11. # every time late in building process.
  12. define Build/calculate-ep
  13. $(eval KERNEL_ENTRY=$(shell $(KERNEL_CROSS)readelf -h $(LINUX_DIR)/vmlinux | grep "Entry point address" | grep -o 0x.*))
  14. endef
  15. define Build/patch-dtb
  16. $(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,[email protected])
  17. $(STAGING_DIR_HOST)/bin/patch-dtb $@ [email protected]
  18. endef
  19. # Shared device definition: applies to every defined device
  20. define Device/Default
  21. PROFILES = Default $$(DEVICE_PROFILE)
  22. KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts)
  23. DEVICE_PROFILE :=
  24. endef
  25. DEVICE_VARS += DEVICE_PROFILE
  26. define Device/vmlinux
  27. KERNEL_SUFFIX := .elf
  28. KERNEL_INITRAMFS := kernel-bin | patch-dtb
  29. KERNEL_INITRAMFS_NAME = vmlinux-initramfs.elf
  30. endef
  31. define Device/uImage
  32. KERNEL_SUFFIX := .bin
  33. KERNEL_INITRAMFS := kernel-bin | patch-dtb | calculate-ep | uImage none
  34. KERNEL_LOADADDR := 0x80000000
  35. endef
  36. define add_arc770_uImage
  37. define Device/$(1)-uImage
  38. $(call Device/uImage)
  39. DEVICE_PROFILE := $(1)
  40. DEVICE_DTS := $(1)
  41. endef
  42. TARGET_DEVICES += $(1)-uImage
  43. endef
  44. define add_arc770_vmlinux
  45. define Device/$(1)-vmlinux
  46. $(call Device/vmlinux)
  47. DEVICE_PROFILE := $(1)
  48. DEVICE_DTS := $(1)
  49. endef
  50. TARGET_DEVICES += $(1)-vmlinux
  51. endef
  52. # DesignWare AXS101
  53. $(eval $(call add_arc770_vmlinux,axs101))
  54. $(eval $(call add_arc770_uImage,axs101))
  55. # nSIM with ARC770
  56. $(eval $(call add_arc770_vmlinux,nsim_700))
  57. $(eval $(call add_arc770_uImage,nsim_700))
  58. $(eval $(call BuildImage))