Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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)/kernel.mk
  9. PKG_NAME:=u-boot
  10. PKG_VERSION:=2016.07
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:= \
  13. http://mirror2.openwrt.org/sources \
  14. ftp://ftp.denx.de/pub/u-boot
  15. PKG_MD5SUM:=425a3fa610a7d972e5092a0e92276c70
  16. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  17. PKG_LICENSE:=GPL-2.0 GPL-2.0+
  18. PKG_LICENSE_FILES:=Licenses/README
  19. include $(INCLUDE_DIR)/package.mk
  20. define uboot/Default
  21. TITLE:=
  22. CONFIG:=
  23. IMAGE:=
  24. endef
  25. define uboot/zc702
  26. TITLE:=U-Boot $(PKG_VERSION) for Xilinx ZC702 Dev Board
  27. endef
  28. define uboot/zc706
  29. TITLE:=U-Boot $(PKG_VERSION) for Xilinx ZC706 Dev Board
  30. endef
  31. define uboot/zed
  32. TITLE:=U-Boot $(PKG_VERSION) for Avnet Digilent ZedBoard Dev Board
  33. endef
  34. define uboot/zybo
  35. TITLE:=U-Boot $(PKG_VERSION) for Digilent Zybo Dev Board
  36. endef
  37. UBOOTS := \
  38. zc702 \
  39. zed \
  40. zybo \
  41. define Package/uboot/template
  42. define Package/uboot-zynq-$(1)
  43. SECTION:=boot
  44. CATEGORY:=Boot Loaders
  45. DEPENDS:=@TARGET_zynq
  46. TITLE:=$(2)
  47. URL:=http://www.denx.de/wiki/U-Boot
  48. VARIANT:=$(1)
  49. MAINTAINER:=Jason Wu <jason.wu.misc@gmail.com>
  50. endef
  51. endef
  52. define BuildUBootPackage
  53. $(eval $(uboot/Default))
  54. $(eval $(uboot/$(1)))
  55. $(call Package/uboot/template,$(1),$(TITLE))
  56. endef
  57. ifdef BUILD_VARIANT
  58. $(eval $(call uboot/$(BUILD_VARIANT)))
  59. UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
  60. UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
  61. endif
  62. UENV:=default
  63. define Build/Configure
  64. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  65. $(BOARD)_$(UBOOT_CONFIG)_config
  66. endef
  67. define Build/Compile
  68. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  69. CROSS_COMPILE=$(TARGET_CROSS) \
  70. DTCDIR=$(LINUX_DIR)/scripts/dtc/
  71. endef
  72. define Package/uboot/install/default
  73. $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
  74. $(CP) $(PKG_BUILD_DIR)/u-boot \
  75. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.elf
  76. $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.bin \
  77. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-dtb.bin
  78. $(CP) $(PKG_BUILD_DIR)/u-boot.dtb \
  79. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.dtb
  80. $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.img \
  81. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-dtb.img
  82. $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.img \
  83. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot-dtb.img
  84. $(CP) $(PKG_BUILD_DIR)/spl/boot.bin \
  85. $(BIN_DIR)/uboot-$(BOARD)-$(1)/boot.bin
  86. $(CP) $(PKG_BUILD_DIR)/spl/boot.bin \
  87. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot.bin
  88. $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl \
  89. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl
  90. $(CP) uEnv-$(UENV).txt \
  91. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt
  92. $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl-dtb.bin \
  93. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl-dtb.bin
  94. endef
  95. define Package/uboot/install/template
  96. define Package/uboot-zynq-$(1)/install
  97. $(call Package/uboot/install/default,$(2))
  98. endef
  99. endef
  100. $(foreach u,$(UBOOTS), \
  101. $(eval $(call Package/uboot/install/template,$(u),$(u))) \
  102. )
  103. $(foreach u,$(UBOOTS), \
  104. $(eval $(call BuildUBootPackage,$(u))) \
  105. $(eval $(call BuildPackage,uboot-zynq-$(u))) \
  106. )