u-boot: prefer mirror2.openwrt.org over ftp.denx.de - the denx ftp is slow and unreliable
[openwrt/staging/wigyori.git] / package / boot / uboot-ar71xx / Makefile
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
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=u-boot
12 PKG_VERSION:=2010.03
13 PKG_RELEASE:=1
14
15 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17 PKG_SOURCE_URL:= \
18 http://mirror2.openwrt.org/sources \
19 ftp://ftp.denx.de/pub/u-boot
20 PKG_MD5SUM:=
21 PKG_TARGETS:=bin
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define uboot/Default
26 TITLE:=
27 CONFIG:=
28 IMAGE:=
29 endef
30
31 define uboot/nbg460n_550n_550nh
32 TITLE:=U-boot for the NBG460N/550N/550NH routers
33 endef
34
35 UBOOTS:=nbg460n_550n_550nh
36
37 define Package/uboot/template
38 define Package/uboot-ar71xx-$(1)
39 SECTION:=boot
40 CATEGORY:=Boot Loaders
41 TITLE:=$(2)
42 DEPENDS:=@TARGET_ar71xx
43 URL:=http://www.denx.de/wiki/U-Boot
44 DEFAULT:=y if (TARGET_ar71xx_generic_NBG_460N_550N_550NH || TARGET_ar71xx_generic_Default || CONFIG_TARGET_ar71xx_generic_Minimal)
45 VARIANT:=$(1)
46 endef
47 endef
48
49 define BuildUbootPackage
50 $(eval $(uboot/Default))
51 $(eval $(uboot/$(1)))
52 $(call Package/uboot/template,$(1),$(TITLE))
53 endef
54
55
56 ifdef BUILD_VARIANT
57 $(eval $(call uboot/$(BUILD_VARIANT)))
58 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
59 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
60 endif
61
62 define Build/Prepare
63 $(call Build/Prepare/Default)
64 $(CP) ./files/* $(PKG_BUILD_DIR)
65 find $(PKG_BUILD_DIR) -name .svn | $(XARGS) rm -rf
66 endef
67
68 define Build/Configure
69 $(MAKE) -C $(PKG_BUILD_DIR) \
70 $(UBOOT_CONFIG)_config
71 endef
72
73 define Build/Compile
74 $(MAKE) -C $(PKG_BUILD_DIR) \
75 CROSS_COMPILE=$(TARGET_CROSS)
76 endef
77
78 define Package/uboot/install/template
79 define Package/uboot-ar71xx-$(1)/install
80 $(INSTALL_DIR) $$(1)
81 $(CP) $(PKG_BUILD_DIR)/u-boot.bin $(BIN_DIR)/$(2)
82 endef
83 endef
84
85 $(foreach u,$(UBOOTS), \
86 $(eval $(call Package/uboot/install/template,$(u),openwrt-$(BOARD)-$(SUBTARGET)-$(u)-u-boot.bin)) \
87 )
88
89 $(foreach u,$(UBOOTS), \
90 $(eval $(call BuildUbootPackage,$(u))) \
91 $(eval $(call BuildPackage,uboot-ar71xx-$(u))) \
92 )