Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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.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_MD5SUM:=973c1d896be751321cc3aafa564f64b2
  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. UBOOTS:= \
  77. A10-OLinuXino-Lime \
  78. A13-OLinuXino \
  79. A20-OLinuXino-Lime \
  80. A20-OLinuXino_MICRO \
  81. Bananapi \
  82. Bananapro \
  83. Cubieboard \
  84. Cubieboard2 \
  85. Cubietruck \
  86. Hummingbird_A31 \
  87. Mele_M9 \
  88. OLIMEX_A13_SOM \
  89. Linksprite_pcDuino \
  90. Linksprite_pcDuino3 \
  91. Lamobo_R1 \
  92. orangepi_plus \
  93. pangolin
  94. define Package/uboot/template
  95. define Package/uboot-sunxi-$(1)
  96. SECTION:=boot
  97. CATEGORY:=Boot Loaders
  98. DEPENDS:=@TARGET_sunxi
  99. TITLE:=$(2)
  100. URL:=http://www.denx.de/wiki/U-Boot
  101. VARIANT:=$(1)
  102. MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
  103. endef
  104. endef
  105. define BuildUBootPackage
  106. $(eval $(uboot/Default))
  107. $(eval $(uboot/$(1)))
  108. $(call Package/uboot/template,$(1),$(TITLE))
  109. endef
  110. ifdef BUILD_VARIANT
  111. $(eval $(call uboot/$(BUILD_VARIANT)))
  112. UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
  113. UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
  114. endif
  115. # check if any specialized uEnv bootconfig is required
  116. ifeq ($(UBOOT_CONFIG),pangolin)
  117. UENV:=pangolin
  118. else
  119. UENV:=default
  120. endif
  121. define Build/Configure
  122. $(MAKE) -C $(PKG_BUILD_DIR) \
  123. USE_PRIVATE_LIBGCC=yes $(UBOOT_CONFIG)_defconfig
  124. endef
  125. define Build/Compile
  126. $(MAKE) -C $(PKG_BUILD_DIR) \
  127. CROSS_COMPILE=$(TARGET_CROSS) \
  128. DTCDIR=$(LINUX_DIR)/scripts/dtc/
  129. endef
  130. define Package/uboot/install/default
  131. $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
  132. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot.bin
  133. $(CP) $(PKG_BUILD_DIR)/spl/sunxi-spl.bin \
  134. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-spl.bin
  135. $(CP) $(PKG_BUILD_DIR)/u-boot-sunxi-with-spl.bin \
  136. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot-with-spl.bin
  137. $(CP) uEnv-$(UENV).txt \
  138. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt
  139. mkimage -C none -A arm -T script -d $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt \
  140. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-boot.scr
  141. endef
  142. define Package/uboot/install/template
  143. define Package/uboot-sunxi-$(1)/install
  144. $(call Package/uboot/install/default,$(2))
  145. endef
  146. endef
  147. $(foreach u,$(UBOOTS), \
  148. $(eval $(call Package/uboot/install/template,$(u),$(u))) \
  149. )
  150. $(foreach u,$(UBOOTS), \
  151. $(eval $(call BuildUBootPackage,$(u))) \
  152. $(eval $(call BuildPackage,uboot-sunxi-$(u))) \
  153. )