6d477420f0198f621767a77ba587a8b9e25c1711
[openwrt.git] / package / boot / uboot-pxa / Makefile
1 #
2 # Copyright (C) 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 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=u-boot
12 PKG_VERSION:=2011.08.25
13 PKG_RELEASE:=1
14
15 PKG_SOURCE_PROTO:=git
16 PKG_SOURCE_URL:=git://github.com/ashcharles/verdex-uboot.git
17 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=ca6bf3ef6ac5f5132a359b43dfa31e07076b74b7
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
20
21 PKG_LICENSE:=GPL-2.0 GPL-2.0+
22 PKG_LICENSE_FILES:=COPYING
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define uboot/Default
27   TITLE:=
28   CONFIG:=
29   IMAGE:=
30 endef
31
32 define uboot/gumstix
33   TITLE:=U-Boot for the Gumstix Verdex
34 endef
35
36 UBOOTS:=gumstix
37
38 define Package/uboot/template
39 define Package/uboot-pxa-$(1)
40   SECTION:=boot
41   CATEGORY:=Boot Loaders
42   DEPENDS:=@TARGET_pxa
43   TITLE:=$(2)
44   URL:=http://www.denx.de/wiki/U-Boot
45   VARIANT:=$(1)
46   MAINTAINER:=Florian Fainelli <florian@openwrt.org>
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 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/Configure
63         $(MAKE) -C $(PKG_BUILD_DIR) \
64                 $(UBOOT_CONFIG)_config
65 endef
66
67 define Build/Compile
68         $(MAKE) -C $(PKG_BUILD_DIR) \
69                 u-boot.bin \
70                 CROSS_COMPILE=$(TARGET_CROSS)
71 endef
72
73 define Package/uboot/install/default
74         $(INSTALL_DIR) $(BIN_DIR)
75         $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
76                 $(BIN_DIR)/openwrt-$(BOARD)-$(1)-u-boot.bin
77 endef
78
79 define Package/uboot/install/template
80 define Package/uboot-pxa-$(1)/install
81         $(call Package/uboot/install/default,$(2))
82 endef
83 endef
84
85 $(foreach u,$(UBOOTS), \
86         $(eval $(call Package/uboot/install/template,$(u),$(u))) \
87 )
88
89 $(foreach u,$(UBOOTS), \
90         $(eval $(call BuildUBootPackage,$(u))) \
91         $(eval $(call BuildPackage,uboot-pxa-$(u))) \
92 )