Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. PKG_NAME:=u-boot
  10. PKG_VERSION:=2016.03
  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_HASH:=e49337262ecac44dbdeac140f2c6ebd1eba345e0162b0464172e7f05583ed7bb
  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. define Build/Configure
  63. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  64. $(BOARD)_$(UBOOT_CONFIG)_config
  65. endef
  66. define Build/Compile
  67. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  68. CROSS_COMPILE=$(TARGET_CROSS) DTC=$(LINUX_DIR)/scripts/dtc/dtc
  69. endef
  70. define Package/uboot/install/default
  71. $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
  72. $(CP) $(PKG_BUILD_DIR)/u-boot \
  73. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.elf
  74. $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.bin \
  75. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-dtb.bin
  76. $(CP) $(PKG_BUILD_DIR)/u-boot.dtb \
  77. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.dtb
  78. $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.img \
  79. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-dtb.img
  80. $(CP) $(PKG_BUILD_DIR)/spl/boot.bin \
  81. $(BIN_DIR)/uboot-$(BOARD)-$(1)/boot.bin
  82. $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl \
  83. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl
  84. $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl-dtb.bin \
  85. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl-dtb.bin
  86. endef
  87. define Package/uboot/install/template
  88. define Package/uboot-zynq-$(1)/install
  89. $(call Package/uboot/install/default,$(2))
  90. endef
  91. endef
  92. $(foreach u,$(UBOOTS), \
  93. $(eval $(call Package/uboot/install/template,$(u),$(u))) \
  94. )
  95. $(foreach u,$(UBOOTS), \
  96. $(eval $(call BuildUBootPackage,$(u))) \
  97. $(eval $(call BuildPackage,uboot-zynq-$(u))) \
  98. )