target: socfpga: Add Altera SoCFPGA support
[openwrt/svn-archive/archive.git] / package / boot / uboot-socfpga / 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_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:=973c1d896be751321cc3aafa564f64b2
20
21 PKG_LICENSE:=GPL-2.0 GPL-2.0+
22 PKG_LICENSE_FILES:=Licenses/README
23 PKG_BUILD_PARALLEL:=1
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define uboot/Default
28 TITLE:=
29 CONFIG:=
30 IMAGE:=
31 endef
32
33 define uboot/socfpga_cyclone5_sockit
34 TITLE := U-Boot for Terasic SoCkit board
35 CONFIG := socfpga_sockit
36 IMAGE := u-boot-with-spl.sfp
37 endef
38
39 UBOOTS := \
40 socfpga_cyclone5_sockit
41
42 define Package/uboot/template
43 define Package/uboot-socfpga-$(1)
44 SECTION:=boot
45 CATEGORY:=Boot Loaders
46 DEPENDS:=@TARGET_socfpga
47 TITLE:=$(2)
48 URL:=http://www.denx.de/wiki/U-Boot
49 VARIANT:=$(1)
50 MAINTAINER:=Marek Vasut <marex@denx.de>
51 endef
52 endef
53
54 define BuildUBootPackage
55 $(eval $(uboot/Default))
56 $(eval $(uboot/$(1)))
57 $(call Package/uboot/template,$(1),$(TITLE))
58 endef
59
60 ifdef BUILD_VARIANT
61 $(eval $(call uboot/$(BUILD_VARIANT)))
62 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
63 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
64 endif
65
66 define Build/Configure
67 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIG)_config
68 endef
69
70 define Build/Compile
71 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS) $(IMAGE)
72 endef
73
74 define Package/uboot/install/default
75 $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
76 $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
77 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
78 $(CP) $(PKG_BUILD_DIR)/spl/u-boot-spl.bin \
79 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot-spl.bin
80 $(CP) $(PKG_BUILD_DIR)/u-boot-with-spl.sfp \
81 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot-with-spl.sfp
82 endef
83
84 define Package/uboot/install/template
85 define Package/uboot-socfpga-$(1)/install
86 $(call Package/uboot/install/default,$(2))
87 endef
88 endef
89
90 $(foreach u,$(UBOOTS), \
91 $(eval $(call Package/uboot/install/template,$(u),$(u))) \
92 )
93
94 $(foreach u,$(UBOOTS), \
95 $(eval $(call BuildUBootPackage,$(u))) \
96 $(eval $(call BuildPackage,uboot-socfpga-$(u))) \
97 )