[boot] uboot-kirkwood: build in $(BUILD_DIR)
[openwrt/svn-archive/archive.git] / package / boot / uboot-kirkwood / Makefile
1 #
2 # Copyright (C) 2010-2012 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
10 PKG_NAME:=u-boot
11 PKG_VERSION:=2012.10
12 PKG_RELEASE:=1
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot
17 PKG_MD5SUM:=8655f63b1e5c4647295ac9ce44660be3
18 PKG_TARGETS:=bin
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define uboot/Default
23 TITLE:=
24 CONFIG:=
25 IMAGE:=
26 endef
27
28 define uboot/sheevaplug
29 TITLE:=U-Boot for the SheevaPlug
30 endef
31
32 define uboot/dockstar
33 TITLE:=U-Boot for the Seagate DockStar
34 endef
35
36 define uboot/iconnect
37 TITLE:=U-Boot for the Iomega iConnect Wireless
38 endef
39
40 define uboot/ib62x0
41 TITLE:=U-Boot for the RaidSonic ICY BOX NAS6210 and NAS6220
42 endef
43
44 UBOOTS:=sheevaplug dockstar iconnect ib62x0
45
46 define Package/uboot/template
47 define Package/uboot-kirkwood-$(1)
48 SECTION:=boot
49 CATEGORY:=Boot Loaders
50 DEPENDS:=@TARGET_kirkwood
51 TITLE:=$(2)
52 URL:=http://www.denx.de/wiki/U-Boot
53 VARIANT:=$(1)
54 endef
55 endef
56
57 define BuildUBootPackage
58 $(eval $(uboot/Default))
59 $(eval $(uboot/$(1)))
60 $(call Package/uboot/template,$(1),$(TITLE))
61 endef
62
63 ifdef BUILD_VARIANT
64 $(eval $(call uboot/$(BUILD_VARIANT)))
65 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
66 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
67 endif
68
69 define Build/Configure
70 $(MAKE) -C $(PKG_BUILD_DIR) \
71 $(UBOOT_CONFIG)_config
72 endef
73
74 define Build/Compile
75 $(MAKE) -C $(PKG_BUILD_DIR) \
76 u-boot.kwb \
77 CROSS_COMPILE=$(TARGET_CROSS)
78 endef
79
80 define Package/uboot/install/default
81 $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
82 $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
83 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
84 $(CP) $(PKG_BUILD_DIR)/u-boot.kwb \
85 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.kwb
86 $(INSTALL_DIR) $(BIN_DIR)/u-boot-kwboot/
87 $(CP) $(PKG_BUILD_DIR)/tools/kwboot \
88 $(BIN_DIR)/u-boot-kwboot/
89 endef
90
91 define Package/uboot/install/template
92 define Package/uboot-kirkwood-$(1)/install
93 $(call Package/uboot/install/default,$(2))
94 endef
95 endef
96
97 $(foreach u,$(UBOOTS), \
98 $(eval $(call Package/uboot/install/template,$(u),$(u))) \
99 )
100
101 $(foreach u,$(UBOOTS), \
102 $(eval $(call BuildUBootPackage,$(u))) \
103 $(eval $(call BuildPackage,uboot-kirkwood-$(u))) \
104 )