[uboot-sunxi]: add support for pcDuino board
[openwrt.git] / package / boot / uboot-sunxi / Makefile
1 #
2 # Copyright (C) 2013 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:=2013.10-rc2-sunxi
12 PKG_RELEASE:=1
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_URL:=git://github.com/linux-sunxi/u-boot-sunxi
15 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE_VERSION:=b322f6723d59b9bb88701991c7b8b15867bf3692
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define uboot/Default
23   TITLE:=
24   CONFIG:=
25   IMAGE:=
26 endef
27
28 define uboot/A13-OLinuXino
29   TITLE:=U-Boot 2013.10-rc2 for the A13 Olinuxino
30 endef
31
32 define uboot/Hackberry
33   TITLE:=U-Boot 2013.10-rc2 for the Hackbeery
34 endef
35
36 define uboot/Cubieboard
37   TITLE:=U-Boot 2013.10-rc2 for Cubieboard
38 endef
39
40 define uboot/Cubieboard2
41   TITLE:=U-Boot 2013.10-rc2 for Cubieboard2
42 endef
43
44 define uboot/A20-OLinuXino_MICRO
45   TITLE:=U-Boot 2013.10-rc2 for A20 Olinuxino
46 endef
47
48 define uboot/pcDuino
49   TITLE:=U-Boot 2013.10-rc2 for pcDuino
50 endef  
51
52 UBOOTS:=A13-OLinuXino Cubieboard Cubieboard2 A20-OLinuXino_MICRO Hackberry pcDuino
53
54 define Package/uboot/template
55 define Package/uboot-sunxi-$(1)
56   SECTION:=boot
57   CATEGORY:=Boot Loaders
58   DEPENDS:=@TARGET_sunxi
59   TITLE:=$(2)
60   URL:=http://www.denx.de/wiki/U-Boot
61   VARIANT:=$(1)
62   MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
63 endef
64 endef
65
66 define BuildUBootPackage
67         $(eval $(uboot/Default))
68         $(eval $(uboot/$(1)))
69         $(call Package/uboot/template,$(1),$(TITLE))
70 endef
71
72 ifdef BUILD_VARIANT
73 $(eval $(call uboot/$(BUILD_VARIANT)))
74 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
75 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
76 endif
77
78 define Build/Configure
79         $(MAKE) -C $(PKG_BUILD_DIR) \
80                 USE_PRIVATE_LIBGCC=yes $(UBOOT_CONFIG)_config
81 endef
82
83 define Build/Compile
84         $(MAKE) -C $(PKG_BUILD_DIR) \
85                 CROSS_COMPILE=$(TARGET_CROSS)
86 endef
87
88 define Package/uboot/install/default
89         $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
90         $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
91                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
92         $(CP) $(PKG_BUILD_DIR)/spl/sunxi-spl.bin \
93                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-sunxi-spl.bin
94         $(CP) $(PKG_BUILD_DIR)/u-boot-sunxi-with-spl.bin \
95                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-sunxi-with-spl.bin
96 endef
97
98 define Package/uboot/install/template
99 define Package/uboot-sunxi-$(1)/install
100         $(call Package/uboot/install/default,$(2))
101 endef
102 endef
103
104 $(foreach u,$(UBOOTS), \
105         $(eval $(call Package/uboot/install/template,$(u),$(u))) \
106 )
107
108 $(foreach u,$(UBOOTS), \
109         $(eval $(call BuildUBootPackage,$(u))) \
110         $(eval $(call BuildPackage,uboot-sunxi-$(u))) \
111 )