Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #
  2. # Copyright (C) 2016 Ben Whitten <ben.whitten@gmail.com>
  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. PKG_NAME:=u-boot
  9. PKG_VERSION:=2016.05
  10. PKG_RELEASE:=1
  11. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  13. PKG_SOURCE_URL:= \
  14. http://mirror2.openwrt.org/sources \
  15. ftp://ftp.denx.de/pub/u-boot
  16. PKG_HASH:=87d02275615aaf0cd007b54cbe9fbadceef2bee7c79e6c323ea1ae8956dcb171
  17. PKG_LICENSE:=GPL-2.0 GPL-2.0+
  18. PKG_LICENSE_FILES:=Licenses/README
  19. PKG_BUILD_PARALLEL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. define uboot/Default
  22. TITLE:=
  23. endef
  24. define uboot/at91sam9m10g45ek_nandflash
  25. TITLE:=U-Boot for the AT91SAM9M10G45-EK board (NandFlash)
  26. endef
  27. define uboot/at91sam9x5ek_nandflash
  28. TITLE:=U-Boot for the AT91SAM9X5-EK board (NandFlash)
  29. endef
  30. UBOOTS := \
  31. at91sam9m10g45ek_nandflash \
  32. at91sam9x5ek_nandflash
  33. define Package/uboot/template
  34. define Package/uboot-at91-$(1)
  35. SECTION:=boot
  36. CATEGORY:=Boot Loaders
  37. DEPENDS:=@TARGET_at91
  38. TITLE:=$(2)
  39. URL:=http://www.denx.de/wiki/U-Boot
  40. VARIANT:=$(1)
  41. MAINTAINER:=Ben Whitten <ben.whitten@gmail.com>
  42. endef
  43. endef
  44. define BuildUBootPackage
  45. $(eval $(uboot/Default))
  46. $(eval $(uboot/$(1)))
  47. $(call Package/uboot/template,$(1),$(TITLE))
  48. endef
  49. ifdef BUILD_VARIANT
  50. $(eval $(call uboot/$(BUILD_VARIANT)))
  51. UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
  52. UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),lede-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
  53. endif
  54. define Build/Configure
  55. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  56. $(UBOOT_CONFIG)_config
  57. endef
  58. define Build/Compile
  59. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  60. CROSS_COMPILE=$(TARGET_CROSS) \
  61. KCFLAGS="$(filter-out -fstack-protector, $(TARGET_CFLAGS))"
  62. endef
  63. define Package/uboot/install/default
  64. $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
  65. $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
  66. $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.bin
  67. $(CP) $(PKG_BUILD_DIR)/boot.bin \
  68. $(BIN_DIR)/uboot-$(BOARD)-$(1)/boot.bin
  69. endef
  70. define Package/uboot/install/template
  71. define Package/uboot-at91-$(1)/install
  72. $(call Package/uboot/install/default,$(2))
  73. endef
  74. endef
  75. $(foreach u,$(UBOOTS), \
  76. $(eval $(call Package/uboot/install/template,$(u),$(u))) \
  77. )
  78. $(foreach u,$(UBOOTS), \
  79. $(eval $(call BuildUBootPackage,$(u))) \
  80. $(eval $(call BuildPackage,uboot-at91-$(u))) \
  81. )