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