1#
2# Copyright (C) 2012-2013 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=u-boot
11PKG_VERSION:=2015.10
12PKG_RELEASE:=1
13
14PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
15PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16PKG_SOURCE_URL:= \
17	http://mirror2.openwrt.org/sources \
18	ftp://ftp.denx.de/pub/u-boot
19PKG_MD5SUM:=7c203b0fc3390a122d8e8b75f147eac5
20
21PKG_LICENSE:=GPL-2.0 GPL-2.0+
22PKG_LICENSE_FILES:=Licenses/README
23
24include $(INCLUDE_DIR)/package.mk
25
26define uboot/Default
27  TITLE:=
28  CONFIG:=
29  IMAGE:=
30endef
31
32define uboot/omap4_panda
33  TITLE:=U-Boot for the Pandaboard
34endef
35
36define uboot/am335x_evm
37  TITLE:=U-Boot for the AM335x EVM
38endef
39
40define uboot/omap3_overo
41  TITLE:=U-Boot for the Gumstix Overo
42endef
43
44define uboot/omap3_beagle
45  TITLE:=U-Boot for the BeagleBoard
46endef
47
48UBOOTS:=omap4_panda am335x_evm omap3_overo omap3_beagle
49
50define Package/uboot/template
51define Package/uboot-omap-$(1)
52  SECTION:=boot
53  CATEGORY:=Boot Loaders
54  DEPENDS:=@TARGET_omap
55  TITLE:=$(2)
56  URL:=http://www.denx.de/wiki/U-Boot
57  VARIANT:=$(1)
58  HIDDEN:=1
59endef
60endef
61
62define BuildUBootPackage
63	$(eval $(uboot/Default))
64	$(eval $(uboot/$(1)))
65	$(call Package/uboot/template,$(1),$(TITLE))
66endef
67
68ifdef BUILD_VARIANT
69$(eval $(call uboot/$(BUILD_VARIANT)))
70UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
71UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.img)
72endif
73
74define Build/Configure
75	$(MAKE) -C $(PKG_BUILD_DIR) \
76		USE_PRIVATE_LIBGCC=yes $(UBOOT_CONFIG)_config
77endef
78
79define Build/Compile
80	$(MAKE) -C $(PKG_BUILD_DIR) \
81		CROSS_COMPILE=$(TARGET_CROSS)
82endef
83
84define Package/uboot/install/default
85	$(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
86	$(CP) $(PKG_BUILD_DIR)/u-boot.img $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.img
87	$(CP) $(PKG_BUILD_DIR)/MLO $(BIN_DIR)/uboot-$(BOARD)-$(1)/MLO
88endef
89
90define Package/uboot/install/template
91define Package/uboot-omap-$(1)/install
92	$(call Package/uboot/install/default,$(2))
93endef
94endef
95
96$(foreach u,$(UBOOTS), \
97	$(eval $(call Package/uboot/install/template,$(u),$(u))) \
98)
99
100$(foreach u,$(UBOOTS), \
101	$(eval $(call BuildUBootPackage,$(u))) \
102	$(eval $(call BuildPackage,uboot-omap-$(u))) \
103)
104