f3f9259a73ceb2a491c3d2e0306c9fd1e1d31fd7
[openwrt/staging/chunkeey.git] / package / uboot-kirkwood / 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:=ftp://ftp.denx.de/pub/u-boot
18 PKG_MD5SUM:=
19 PKG_TARGETS:=bin
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define uboot/Default
24 TITLE:=
25 CONFIG:=
26 IMAGE:=
27 endef
28
29 define uboot/sheevaplug
30 TITLE:=U-boot for the Sheevaplug
31 endef
32
33 define uboot/dockstar
34 TITLE:=U-boot for the Seagate Dockstar
35 endef
36
37 UBOOTS:=sheevaplug dockstar
38
39 define Package/uboot/template
40 define Package/uboot-kirkwood-$(1)
41 SECTION:=boot
42 CATEGORY:=Boot Loaders
43 DEPENDS:=@TARGET_kirkwood
44 TITLE:=$(2)
45 URL:=http://www.denx.de/wiki/U-Boot
46 VARIANT:=$(1)
47 endef
48 endef
49
50 define BuildUbootPackage
51 $(eval $(uboot/Default))
52 $(eval $(uboot/$(1)))
53 $(call Package/uboot/template,$(1),$(TITLE))
54 endef
55
56
57 ifdef BUILD_VARIANT
58 $(eval $(call uboot/$(BUILD_VARIANT)))
59 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
60 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_BARIANT)-u-boot.bin)
61 endif
62
63 define Build/Prepare
64 $(call Build/Prepare/Default)
65 $(CP) ./files/* $(PKG_BUILD_DIR) || true
66 find $(PKG_BUILD_DIR) -name .svn | $(XARGS) rm -rf
67 endef
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 CROSS_COMPILE=$(TARGET_CROSS)
77 endef
78
79 define Package/uboot/install/default
80 $(INSTALL_DIR) $(BIN_DIR)
81 $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
82 $(BIN_DIR)/openwrt-$(BOARD)-$(1)-u-boot.bin
83 endef
84
85 define Package/uboot/install/template
86 define Package/uboot-kirkwood-$(1)/install
87 $(call Package/uboot/install/default,$(2))
88 endef
89 endef
90
91 $(foreach u,$(UBOOTS), \
92 $(eval $(call Package/uboot/install/template,$(u),$(u))) \
93 )
94
95 $(foreach u,$(UBOOTS), \
96 $(eval $(call BuildUbootPackage,$(u))) \
97 $(eval $(call BuildPackage,uboot-kirkwood-$(u))) \
98 )