Zynq: Add Zedboard device support
[openwrt/staging/wigyori.git] / package / boot / uboot-zynq / Makefile
1 #
2 # Copyright (C) 2015 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:=2016.03
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:=973c1d896be751321cc3aafa564f64b2
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/zc702
33 TITLE:=U-Boot $(PKG_VERSION) for Xilinx ZC702 Dev Board
34 endef
35
36 define uboot/zc706
37 TITLE:=U-Boot $(PKG_VERSION) for Xilinx ZC706 Dev Board
38 endef
39
40 define uboot/zed
41 TITLE:=U-Boot $(PKG_VERSION) for Avnet Digilent ZedBoard Dev Board
42 endef
43
44 UBOOTS := \
45 zc702 \
46 zed \
47
48 define Package/uboot/template
49 define Package/uboot-zynq-$(1)
50 SECTION:=boot
51 CATEGORY:=Boot Loaders
52 DEPENDS:=@TARGET_zynq
53 TITLE:=$(2)
54 URL:=http://www.denx.de/wiki/U-Boot
55 VARIANT:=$(1)
56 MAINTAINER:=Jason Wu <jason.wu.misc@gmail.com>
57 endef
58 endef
59
60 define BuildUBootPackage
61 $(eval $(uboot/Default))
62 $(eval $(uboot/$(1)))
63 $(call Package/uboot/template,$(1),$(TITLE))
64 endef
65
66 ifdef BUILD_VARIANT
67 $(eval $(call uboot/$(BUILD_VARIANT)))
68 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
69 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
70 endif
71
72 define Build/Configure
73 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
74 $(BOARD)_$(UBOOT_CONFIG)_config
75 endef
76
77 define Build/Compile
78 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
79 CROSS_COMPILE=$(TARGET_CROSS)
80 endef
81
82 define Package/uboot/install/default
83 $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
84
85 $(CP) $(PKG_BUILD_DIR)/u-boot \
86 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.elf
87
88 $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.bin \
89 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-dtb.bin
90
91 $(CP) $(PKG_BUILD_DIR)/u-boot.dtb \
92 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.dtb
93
94 $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.img \
95 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-dtb.img
96
97 $(CP) $(PKG_BUILD_DIR)/spl/boot.bin \
98 $(BIN_DIR)/uboot-$(BOARD)-$(1)/boot.bin
99
100 $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl \
101 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl
102
103 $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl-dtb.bin \
104 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl-dtb.bin
105 endef
106
107 define Package/uboot/install/template
108 define Package/uboot-zynq-$(1)/install
109 $(call Package/uboot/install/default,$(2))
110 endef
111 endef
112
113 $(foreach u,$(UBOOTS), \
114 $(eval $(call Package/uboot/install/template,$(u),$(u))) \
115 )
116
117 $(foreach u,$(UBOOTS), \
118 $(eval $(call BuildUBootPackage,$(u))) \
119 $(eval $(call BuildPackage,uboot-zynq-$(u))) \
120 )