Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #
  2. # Copyright (C) 2013-2014 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:=2015.01
  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:=7f08dc9e98a71652bd6968888ed6ec95
  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/Mele_M9
  53. TITLE:=U-Boot for the Mele M9 (A31)
  54. endef
  55. define uboot/OLIMEX_A13_SOM
  56. TITLE:=U-Boot for the Olimex A13 SOM
  57. endef
  58. define uboot/Linksprite_pcDuino
  59. TITLE:=U-Boot for Linksprite pcDuino
  60. endef
  61. define uboot/Linksprite_pcDuino3
  62. TITLE:=U-Boot for Linksprite pcDuino3
  63. endef
  64. define uboot/Lamobo_R1
  65. TITLE:=U-Boot for Lamobo R1
  66. endef
  67. UBOOTS:= \
  68. A10-OLinuXino-Lime \
  69. A13-OLinuXino \
  70. A20-OLinuXino-Lime \
  71. A20-OLinuXino_MICRO \
  72. Bananapi \
  73. Bananapro \
  74. Cubieboard \
  75. Cubieboard2 \
  76. Cubietruck \
  77. Mele_M9 \
  78. OLIMEX_A13_SOM \
  79. Linksprite_pcDuino \
  80. Linksprite_pcDuino3 \
  81. Lamobo_R1 \
  82. define Package/uboot/template
  83. define Package/uboot-sunxi-$(1)
  84. SECTION:=boot
  85. CATEGORY:=Boot Loaders
  86. DEPENDS:=@TARGET_sunxi
  87. TITLE:=$(2)
  88. URL:=http://www.denx.de/wiki/U-Boot
  89. VARIANT:=$(1)
  90. MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
  91. endef
  92. endef
  93. define BuildUBootPackage
  94. $(eval $(uboot/Default))
  95. $(eval $(uboot/$(1)))
  96. $(call Package/uboot/template,$(1),$(TITLE))
  97. endef
  98. ifdef BUILD_VARIANT
  99. $(eval $(call uboot/$(BUILD_VARIANT)))
  100. UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
  101. UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
  102. endif
  103. define Build/Configure
  104. $(MAKE) -C $(PKG_BUILD_DIR) \
  105. USE_PRIVATE_LIBGCC=yes $(UBOOT_CONFIG)_defconfig
  106. endef
  107. define Build/Compile
  108. $(MAKE) -C $(PKG_BUILD_DIR) \
  109. CROSS_COMPILE=$(TARGET_CROSS)
  110. endef
  111. define Package/uboot/install/default
  112. $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
  113. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot.bin
  114. $(CP) $(PKG_BUILD_DIR)/spl/sunxi-spl.bin \
  115. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-spl.bin
  116. $(CP) $(PKG_BUILD_DIR)/u-boot-sunxi-with-spl.bin \
  117. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot-with-spl.bin
  118. $(CP) uEnv.txt \
  119. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt
  120. mkimage -C none -A arm -T script -d $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt \
  121. $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-boot.scr
  122. endef
  123. define Package/uboot/install/template
  124. define Package/uboot-sunxi-$(1)/install
  125. $(call Package/uboot/install/default,$(2))
  126. endef
  127. endef
  128. $(foreach u,$(UBOOTS), \
  129. $(eval $(call Package/uboot/install/template,$(u),$(u))) \
  130. )
  131. $(foreach u,$(UBOOTS), \
  132. $(eval $(call BuildUBootPackage,$(u))) \
  133. $(eval $(call BuildPackage,uboot-sunxi-$(u))) \
  134. )