package: uboot-sunxi: various changes
[openwrt.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 UBOOTS := \
41         zc702 \
42
43 define Package/uboot/template
44 define Package/uboot-zynq-$(1)
45         SECTION:=boot
46         CATEGORY:=Boot Loaders
47         DEPENDS:=@TARGET_zynq
48         TITLE:=$(2)
49         URL:=http://www.denx.de/wiki/U-Boot
50         VARIANT:=$(1)
51         MAINTAINER:=Jason Wu <jason.wu.misc@gmail.com>
52 endef
53 endef
54
55 define BuildUBootPackage
56         $(eval $(uboot/Default))
57         $(eval $(uboot/$(1)))
58         $(call Package/uboot/template,$(1),$(TITLE))
59 endef
60
61 ifdef BUILD_VARIANT
62 $(eval $(call uboot/$(BUILD_VARIANT)))
63 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
64 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
65 endif
66
67 define Build/Configure
68         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
69                 $(BOARD)_$(UBOOT_CONFIG)_config
70 endef
71
72 define Build/Compile
73         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
74                 CROSS_COMPILE=$(TARGET_CROSS)
75 endef
76
77 define Package/uboot/install/default
78         $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
79
80         $(CP) $(PKG_BUILD_DIR)/u-boot \
81                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.elf
82
83         $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.bin \
84                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-dtb.bin
85
86         $(CP) $(PKG_BUILD_DIR)/u-boot.dtb \
87                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.dtb
88
89         $(CP) $(PKG_BUILD_DIR)/u-boot-dtb.img \
90                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-dtb.img
91
92         $(CP) $(PKG_BUILD_DIR)/spl/boot.bin \
93                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/boot.bin
94
95         $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl \
96                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl
97
98         $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl-dtb.bin \
99                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot-spl-dtb.bin
100 endef
101
102 define Package/uboot/install/template
103 define Package/uboot-zynq-$(1)/install
104         $(call Package/uboot/install/default,$(2))
105 endef
106 endef
107
108 $(foreach u,$(UBOOTS), \
109         $(eval $(call Package/uboot/install/template,$(u),$(u))) \
110 )
111
112 $(foreach u,$(UBOOTS), \
113         $(eval $(call BuildUBootPackage,$(u))) \
114         $(eval $(call BuildPackage,uboot-zynq-$(u))) \
115 )