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