eb66cab4719ae2a546b5180cdb8e2df2bc66e595
[openwrt/svn-archive/archive.git] / package / boot / uboot-sunxi / Makefile
1 #
2 # Copyright (C) 2013-2014 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:=2015.01-rc3
12 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
13 PKG_SOURCE_URL:= \
14 http://mirror2.openwrt.org/sources \
15 ftp://ftp.denx.de/pub/u-boot
16 PKG_SOURCE_VERSION:=e680848838ca20a60d43b66a218d865b
17 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
18
19 PKG_LICENSE:=GPL-2.0 GPL-2.0+
20 PKG_LICENSE_FILES:=Licenses/README
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define uboot/Default
25 TITLE:=
26 CONFIG:=
27 IMAGE:=
28 endef
29
30 define uboot/A10-OLinuXino-Lime
31 TITLE:=U-Boot for the A10 OLinuXino LIME
32 endef
33
34 define uboot/A13-OLinuXino
35 TITLE:=U-Boot for the A13 OlinuXino
36 endef
37
38 define uboot/A20-OLinuXino-Lime
39 TITLE:=U-Boot for the A20 OLinuXino LIME
40 endef
41
42 define uboot/A20-OLinuXino_MICRO
43 TITLE:=U-Boot for A20 OLinuXino MICRO
44 endef
45
46 define uboot/Bananapi
47 TITLE:=U-Boot for Bananapi
48 endef
49
50 define uboot/Bananapro
51 TITLE:=U-Boot for Bananapro
52 endef
53
54 define uboot/Cubieboard
55 TITLE:=U-Boot for Cubieboard
56 endef
57
58 define uboot/Cubieboard2
59 TITLE:=U-Boot for Cubieboard2
60 endef
61
62 define uboot/Cubietruck
63 TITLE:=U-Boot for Cubietruck
64 endef
65
66 define uboot/Hackberry
67 TITLE:=U-Boot for the Hackbeery
68 endef
69
70 define uboot/Mele_M9
71 TITLE:=U-Boot for the Mele M9 (A31)
72 endef
73
74 define uboot/OLIMEX-A13-SOM
75 TITLE:=U-Boot for the Olimex A13 SOM
76 endef
77
78 define uboot/Linksprite_pcDuino
79 TITLE:=U-Boot for Linksprite pcDuino
80 endef
81
82 define uboot/Linksprite_pcDuino3
83 TITLE:=U-Boot for Linksprite pcDuino3
84 endef
85
86 UBOOTS:= \
87 A10-OLinuXino-Lime \
88 A13-OLinuXino \
89 A20-OLinuXino-Lime \
90 A20-OLinuXino_MICRO \
91 Bananapi \
92 Bananapro \
93 Cubieboard \
94 Cubieboard2 \
95 Cubietruck \
96 Hackberry \
97 Mele_M9 \
98 OLIMEX-A13-SOM \
99 Linksprite_pcDuino \
100 Linksprite_pcDuino3 \
101
102 define Package/uboot/template
103 define Package/uboot-sunxi-$(1)
104 SECTION:=boot
105 CATEGORY:=Boot Loaders
106 DEPENDS:=@TARGET_sunxi
107 TITLE:=$(2)
108 URL:=http://www.denx.de/wiki/U-Boot
109 VARIANT:=$(1)
110 MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
111 endef
112 endef
113
114 define BuildUBootPackage
115 $(eval $(uboot/Default))
116 $(eval $(uboot/$(1)))
117 $(call Package/uboot/template,$(1),$(TITLE))
118 endef
119
120 ifdef BUILD_VARIANT
121 $(eval $(call uboot/$(BUILD_VARIANT)))
122 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
123 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
124 endif
125
126 define Build/Configure
127 $(MAKE) -C $(PKG_BUILD_DIR) \
128 USE_PRIVATE_LIBGCC=yes $(UBOOT_CONFIG)_defconfig
129 endef
130
131 define Build/Compile
132 $(MAKE) -C $(PKG_BUILD_DIR) \
133 CROSS_COMPILE=$(TARGET_CROSS)
134 endef
135
136 define Package/uboot/install/default
137 $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
138 $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
139 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
140 $(CP) $(PKG_BUILD_DIR)/spl/sunxi-spl.bin \
141 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-spl.bin
142 $(CP) $(PKG_BUILD_DIR)/u-boot-sunxi-with-spl.bin \
143 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot-with-spl.bin
144 $(CP) uEnv.txt \
145 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-uEnv.txt
146 mkimage -C none -A arm -T script -d $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-uEnv.txt $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-boot.scr
147 endef
148
149 define Package/uboot/install/template
150 define Package/uboot-sunxi-$(1)/install
151 $(call Package/uboot/install/default,$(2))
152 endef
153 endef
154
155 $(foreach u,$(UBOOTS), \
156 $(eval $(call Package/uboot/install/template,$(u),$(u))) \
157 )
158
159 $(foreach u,$(UBOOTS), \
160 $(eval $(call BuildUBootPackage,$(u))) \
161 $(eval $(call BuildPackage,uboot-sunxi-$(u))) \
162 )