16465c78e2df8aeaeabe328175291a95b36963d8
[openwrt.git] / package / boot / uboot-imx6 / 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.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:=ftp://ftp.denx.de/pub/u-boot
17 PKG_MD5SUM:=21bf962d69938ed4ed783b792b2b074e
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define uboot/Default
22   TITLE:=
23   CONFIG:=
24   IMAGE:=
25 endef
26
27 define uboot/wandboard_solo
28   TITLE:=U-Boot for the Wandboard Solo
29 endef
30
31 define uboot/wandboard_dl
32   TITLE:=U-Boot for the Wandboard Dual Lite
33 endef
34
35 UBOOTS := \
36         wandboard_solo \
37         wandboard_dl
38
39 define Package/uboot/template
40 define Package/uboot-imx6-$(1)
41   SECTION:=boot
42   CATEGORY:=Boot Loaders
43   DEPENDS:=@TARGET_imx6
44   TITLE:=$(2)
45   URL:=http://www.denx.de/wiki/U-Boot
46   VARIANT:=$(1)
47   MAINTAINER:=Luka Perkov <luka@openwrt.org>
48 endef
49 endef
50
51 define BuildUBootPackage
52         $(eval $(uboot/Default))
53         $(eval $(uboot/$(1)))
54         $(call Package/uboot/template,$(1),$(TITLE))
55 endef
56
57 ifdef BUILD_VARIANT
58 $(eval $(call uboot/$(BUILD_VARIANT)))
59 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
60 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
61 endif
62
63 define Build/Configure
64         $(MAKE) -C $(PKG_BUILD_DIR) \
65                 $(UBOOT_CONFIG)_config
66 endef
67
68 define Build/Compile
69         $(MAKE) -C $(PKG_BUILD_DIR) \
70                 CROSS_COMPILE=$(TARGET_CROSS)
71 endef
72
73 define Package/uboot/install/default
74         $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
75         $(CP) \
76                 $(PKG_BUILD_DIR)/u-boot.imx \
77                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.imx
78 endef
79
80 define Package/uboot/install/template
81 define Package/uboot-imx6-$(1)/install
82         $(call Package/uboot/install/default,$(2))
83 endef
84 endef
85
86 $(foreach u,$(UBOOTS), \
87         $(eval $(call Package/uboot/install/template,$(u),$(u))) \
88 )
89
90 $(foreach u,$(UBOOTS), \
91         $(eval $(call BuildUBootPackage,$(u))) \
92         $(eval $(call BuildPackage,uboot-imx6-$(u))) \
93 )