Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #
  2. # Copyright (C) 2013-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)/kernel.mk
  9. PKG_NAME:=u-boot
  10. PKG_VERSION:=2016.11
  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:=ca1f6e019d08aff8d0ca1beb2e66737d
  16. PKG_BUILD_DIR:=$(KERNEL_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/A10-OLinuXino-Lime
  26. TITLE:=U-Boot for the A10 OLinuXino LIME
  27. endef
  28. define uboot/A13-OLinuXino
  29. TITLE:=U-Boot for the A13 OlinuXino
  30. endef
  31. define uboot/A20-OLinuXino-Lime
  32. TITLE:=U-Boot for the A20 OLinuXino LIME
  33. endef
  34. define uboot/A20-OLinuXino_MICRO
  35. TITLE:=U-Boot for A20 OLinuXino MICRO
  36. endef
  37. define uboot/Bananapi
  38. TITLE:=U-Boot for Bananapi
  39. endef
  40. define uboot/Bananapro
  41. TITLE:=U-Boot for Bananapro
  42. endef
  43. define uboot/Cubieboard
  44. TITLE:=U-Boot for Cubieboard
  45. endef
  46. define uboot/Cubieboard2
  47. TITLE:=U-Boot for Cubieboard2
  48. endef
  49. define uboot/Cubietruck
  50. TITLE:=U-Boot for Cubietruck
  51. endef
  52. define uboot/Hummingbird_A31
  53. TITLE:=U-Boot for the Hummingbird A31 board
  54. endef
  55. define uboot/Mele_M9
  56. TITLE:=U-Boot for the Mele M9 (A31)
  57. endef
  58. define uboot/OLIMEX_A13_SOM
  59. TITLE:=U-Boot for the Olimex A13 SOM
  60. endef
  61. define uboot/Linksprite_pcDuino
  62. TITLE:=U-Boot for Linksprite pcDuino
  63. endef
  64. define uboot/Linksprite_pcDuino3
  65. TITLE:=U-Boot for Linksprite pcDuino3
  66. endef
  67. define uboot/Lamobo_R1
  68. TITLE:=U-Boot for Lamobo R1
  69. endef
  70. define uboot/pangolin
  71. TITLE:=U-Boot for Theobroma A31-yQ7 devboard
  72. endef
  73. define uboot/orangepi_plus
  74. TITLE:=U-Boot for Orange Pi Plus (H3)
  75. endef
  76. define uboot/orangepi_2
  77. TITLE:=U-Boot for Orange Pi 2 (H3)
  78. endef
  79. define uboot/Merrii_A80_Optimus
  80. TITLE:=U-Boot for Merrii_A80_Optimus (A80)
  81. endef
  82. define uboot/Marsboard_A10
  83. TITLE:=U-Boot for MarsBoard A10
  84. endef
  85. UBOOTS:= \
  86. A10-OLinuXino-Lime \
  87. A13-OLinuXino \
  88. A20-OLinuXino-Lime \
  89. A20-OLinuXino_MICRO \
  90. Bananapi \
  91. Bananapro \
  92. Cubieboard \
  93. Cubieboard2 \
  94. Cubietruck \
  95. Hummingbird_A31 \
  96. Mele_M9 \
  97. OLIMEX_A13_SOM \
  98. Linksprite_pcDuino \
  99. Linksprite_pcDuino3 \
  100. Lamobo_R1 \
  101. Merrii_A80_Optimus \
  102. orangepi_plus \
  103. orangepi_2 \
  104. pangolin \
  105. Marsboard_A10
  106. define Package/uboot/template
  107. define Package/uboot-sunxi-$(1)
  108. SECTION:=boot
  109. CATEGORY:=Boot Loaders
  110. DEPENDS:=@TARGET_sunxi
  111. TITLE:=$(2)
  112. URL:=http://www.denx.de/wiki/U-Boot
  113. VARIANT:=$(1)
  114. MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
  115. endef
  116. endef
  117. define BuildUBootPackage
  118. $(eval $(uboot/Default))
  119. $(eval $(uboot/$(1)))
  120. $(call Package/uboot/template,$(1),$(TITLE))
  121. endef
  122. ifdef BUILD_VARIANT
  123. $(eval $(call uboot/$(BUILD_VARIANT)))
  124. UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
  125. UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
  126. endif
  127. # check if any specialized uEnv bootconfig is required
  128. ifeq ($(UBOOT_CONFIG),pangolin)
  129. UENV:=pangolin
  130. else
  131. UENV:=default
  132. endif
  133. define Build/Configure
  134. $(MAKE) -C $(PKG_BUILD_DIR) \
  135. USE_PRIVATE_LIBGCC=yes $(UBOOT_CONFIG)_defconfig
  136. endef
  137. define Build/Compile
  138. $(MAKE) -C $(PKG_BUILD_DIR) \
  139. CROSS_COMPILE=$(TARGET_CROSS) \
  140. DTCDIR=$(LINUX_DIR)/scripts/dtc/
  141. endef
  142. define Package/uboot/install/default
  143. $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
  144. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot.bin
  145. $(CP) $(PKG_BUILD_DIR)/spl/sunxi-spl.bin \
  146. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-spl.bin
  147. $(CP) $(PKG_BUILD_DIR)/u-boot-sunxi-with-spl.bin \
  148. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot-with-spl.bin
  149. $(CP) uEnv-$(UENV).txt \
  150. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt
  151. mkimage -C none -A arm -T script -d $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt \
  152. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-boot.scr
  153. endef
  154. define Package/uboot/install/template
  155. define Package/uboot-sunxi-$(1)/install
  156. $(call Package/uboot/install/default,$(2))
  157. endef
  158. endef
  159. $(foreach u,$(UBOOTS), \
  160. $(eval $(call Package/uboot/install/template,$(u),$(u))) \
  161. )
  162. $(foreach u,$(UBOOTS), \
  163. $(eval $(call BuildUBootPackage,$(u))) \
  164. $(eval $(call BuildPackage,uboot-sunxi-$(u))) \
  165. )