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