Makefile 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #
  2. # Copyright (C) 2016 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 before generation of uImage.
  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,$@.dtb)
  17. $(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
  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. DEVICE_DTS :=
  25. endef
  26. DEVICE_VARS += DEVICE_PROFILE DEVICE_DTS
  27. define Device/vmlinux
  28. KERNEL_SUFFIX := .elf
  29. KERNEL_INITRAMFS := kernel-bin | patch-dtb
  30. KERNEL_INITRAMFS_NAME = vmlinux-initramfs.elf
  31. endef
  32. define Device/uImage
  33. KERNEL_SUFFIX := .bin
  34. KERNEL_INITRAMFS := kernel-bin | patch-dtb | calculate-ep | uImage none
  35. KERNEL_LOADADDR := 0x80000000
  36. endef
  37. define add_archs38_uImage
  38. define Device/$(1)-uImage
  39. $(call Device/uImage)
  40. DEVICE_PROFILE := $(1)
  41. DEVICE_DTS := $(1)
  42. endef
  43. TARGET_DEVICES += $(1)-uImage
  44. endef
  45. define add_archs38_vmlinux
  46. define Device/$(1)-vmlinux
  47. $(call Device/vmlinux)
  48. DEVICE_PROFILE := $(1)
  49. DEVICE_DTS := $(1)
  50. endef
  51. TARGET_DEVICES += $(1)-vmlinux
  52. endef
  53. # DesignWare AXS103
  54. $(eval $(call add_archs38_vmlinux,axs103_idu))
  55. $(eval $(call add_archs38_uImage,axs103_idu))
  56. # nSIM with ARCHS38
  57. $(eval $(call add_archs38_vmlinux,nsim_hs_idu))
  58. $(eval $(call add_archs38_uImage,nsim_hs_idu))
  59. $(eval $(call BuildImage))