1#
2# Copyright (C) 2010 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
9include $(INCLUDE_DIR)/kernel.mk
10
11PKG_NAME:=u-boot
12PKG_VERSION:=2012.10-rc2
13PKG_RELEASE:=1
14
15PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
16PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17PKG_SOURCE_URL:= \
18	http://mirror2.openwrt.org/sources \
19	ftp://ftp.denx.de/pub/u-boot
20PKG_MD5SUM:=451c07271940016cec6f5ad8a155263b
21PKG_TARGETS:=bin
22
23PKG_LICENSE:=GPL-2.0 GPL-2.0+
24PKG_LICENSE_FILES:=Licenses/README
25
26include $(INCLUDE_DIR)/package.mk
27
28define uboot/Default
29  TITLE:=
30  CONFIG:=
31  IMAGE:=
32endef
33
34define uboot/qi_lb60
35  TITLE:=U-boot for the qi_lb60 board
36endef
37
38UBOOTS:=qi_lb60
39
40define Package/uboot/template
41define Package/uboot-xburst-$(1)
42  SECTION:=boot
43  CATEGORY:=Boot Loaders
44  DEPENDS:=@TARGET_xburst
45  TITLE:=$(2)
46  URL:=http://www.denx.de/wiki/UBoot/WebHome
47  VARIANT:=$(1)
48endef
49endef
50
51define BuildUbootPackage
52	$(eval $(uboot/Default))
53	$(eval $(uboot/$(1)))
54	$(call Package/uboot/template,$(1),$(TITLE))
55endef
56
57
58ifdef BUILD_VARIANT
59$(eval $(call uboot/$(BUILD_VARIANT)))
60UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
61UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
62endif
63
64define Build/Configure
65	$(MAKE) -C $(PKG_BUILD_DIR) \
66		$(UBOOT_CONFIG)_config
67endef
68
69define Build/Compile
70	$(MAKE) -C $(PKG_BUILD_DIR) \
71		CROSS_COMPILE=$(TARGET_CROSS)
72endef
73
74define Package/uboot/install/template
75define Package/uboot-xburst-$(1)/install
76	$(CP) $(PKG_BUILD_DIR)/u-boot-xburst.bin $(BIN_DIR)/$(2)
77	rmdir $$(1)
78endef
79endef
80
81$(foreach u,$(UBOOTS), \
82	$(eval $(call Package/uboot/install/template,$(u),openwrt-$(BOARD)-$(u)-u-boot.bin)) \
83)
84
85$(foreach u,$(UBOOTS), \
86	$(eval $(call BuildUbootPackage,$(u))) \
87	$(eval $(call BuildPackage,uboot-xburst-$(u))) \
88)
89