add chaos_calmer branch
[15.05/openwrt.git] / package / boot / uboot-imx6 / 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:=2014.04
12 PKG_RELEASE:=1
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:= \
17         http://mirror2.openwrt.org/sources \
18         ftp://ftp.denx.de/pub/u-boot
19 PKG_MD5SUM:=6d2116d1385a66e9a59742caa9d62a54
20
21 PKG_BUILD_PARALLEL:=1
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define uboot/Default
26   TITLE:=
27   CONFIG:=
28   IMAGE:=
29 endef
30
31 define uboot/nitrogen6dl
32   TITLE:=U-Boot for Nitrogen6x i.MX6Dual-Lite 1GB board
33 endef
34
35 define uboot/nitrogen6dl2g
36   TITLE:=U-Boot for Nitrogen6x i.MX6Dual-Lite 2GB board
37 endef
38
39 define uboot/nitrogen6q
40   TITLE:=U-Boot for Nitrogen6x/SABRE Lite (MX6Q/1GB)
41 endef
42
43 define uboot/nitrogen6q2g
44   TITLE:=U-Boot for Nitrogen6x i.MX6Quad 2GB board
45 endef
46
47 define uboot/nitrogen6s
48   TITLE:=U-Boot for Nitrogen6x i.MX6Solo 512MB board
49 endef
50
51 define uboot/nitrogen6s1g
52   TITLE:=U-Boot for Nitrogen6x i.MX6Solo 1GB board
53 endef
54
55 define uboot/wandboard_dl
56   TITLE:=U-Boot for the Wandboard Dual Lite
57 endef
58
59 define uboot/wandboard_quad
60   TITLE:=U-Boot for the Wandboard Quad
61 endef
62
63 define uboot/wandboard_solo
64   TITLE:=U-Boot for the Wandboard Solo
65 endef
66
67 UBOOTS := \
68         nitrogen6dl \
69         nitrogen6dl2g \
70         nitrogen6q \
71         nitrogen6q2g \
72         nitrogen6s \
73         nitrogen6s1g \
74         wandboard_dl \
75         wandboard_quad \
76         wandboard_solo
77
78 define Package/uboot/template
79 define Package/uboot-imx6-$(1)
80   SECTION:=boot
81   CATEGORY:=Boot Loaders
82   DEPENDS:=@TARGET_imx6
83   TITLE:=$(2)
84   URL:=http://www.denx.de/wiki/U-Boot
85   VARIANT:=$(1)
86   MAINTAINER:=Luka Perkov <luka@openwrt.org>
87 endef
88 endef
89
90 define BuildUBootPackage
91         $(eval $(uboot/Default))
92         $(eval $(uboot/$(1)))
93         $(call Package/uboot/template,$(1),$(TITLE))
94 endef
95
96 ifdef BUILD_VARIANT
97 $(eval $(call uboot/$(BUILD_VARIANT)))
98 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
99 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
100 endif
101
102 define Build/Configure
103         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
104                 $(UBOOT_CONFIG)_config
105 endef
106
107 define Build/Compile
108         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
109                 CROSS_COMPILE=$(TARGET_CROSS)
110 endef
111
112 define Package/uboot/install/default
113         $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
114         $(CP) \
115                 $(PKG_BUILD_DIR)/u-boot.imx \
116                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.imx
117 endef
118
119 define Package/uboot/install/template
120 define Package/uboot-imx6-$(1)/install
121         $(call Package/uboot/install/default,$(2))
122 endef
123 endef
124
125 $(foreach u,$(UBOOTS), \
126         $(eval $(call Package/uboot/install/template,$(u),$(u))) \
127 )
128
129 $(foreach u,$(UBOOTS), \
130         $(eval $(call BuildUBootPackage,$(u))) \
131         $(eval $(call BuildPackage,uboot-imx6-$(u))) \
132 )