layerscape: add 64b/32b target for ls1012ardb device
[openwrt/openwrt.git] / package / boot / uboot-layerscape / Makefile
1 #
2 # Copyright (C) 2016 Jiang Yutang <jiangyutang1978@gmail.com>
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:=fsl-sdk
12 PKG_VERSION:=v2.0
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
14 PKG_SOURCE_URL:= \
15 http://git.freescale.com/git/cgit.cgi/ppc/sdk/u-boot.git/snapshot
16 PKG_MD5SUM:=14f7ccc757bfa71c9b7fd68d24051231
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/u-boot_$(PKG_NAME)-$(PKG_VERSION)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19
20 PKG_LICENSE:=GPL-2.0 GPL-2.0+
21 PKG_LICENSE_FILES:=Licenses/README
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define uboot/Default
26 TITLE:=
27 CONFIG:=
28 IMAGE:=
29 endef
30
31 define uboot/ls1043ardb
32 TITLE:=U-Boot $(PKG_NAME)-$(PKG_VERSION) for NXP ls1043ardb 64b Dev Board
33 CONFIG=ls1043ardb
34 endef
35
36 define uboot/ls1012ardb
37 TITLE:=U-Boot $(PKG_NAME)-$(PKG_VERSION) for NXP ls1012ardb 64b Dev Board
38 CONFIG=ls1012ardb_qspi
39 IMAGE=u-boot-swap.bin
40 endef
41
42 UBOOTS := \
43 ls1043ardb \
44 ls1012ardb
45
46 define Package/uboot/template
47 define Package/uboot-layerscape-64b-$(1)
48 SECTION:=boot
49 CATEGORY:=Boot Loaders
50 DEPENDS:= @TARGET_layerscape_64b
51 TITLE:=$(2)
52 URL:=http://git.freescale.com/git/cgit.cgi/ppc/sdk/u-boot.git/snapshot
53 VARIANT:=$(1)
54 MAINTAINER:=Jiang Yutang <jiangyutang1978@gmail.com>
55 endef
56 endef
57
58 define BuildUBootPackage
59 $(eval $(uboot/Default))
60 $(eval $(uboot/$(1)))
61 $(call Package/uboot/template,$(1),$(TITLE))
62 endef
63
64 ifdef BUILD_VARIANT
65 $(eval $(call uboot/$(BUILD_VARIANT)))
66 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
67 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),u-boot-dtb.bin)
68 endif
69
70 define Build/Configure
71 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
72 $(UBOOT_CONFIG)_config
73 endef
74
75 define Build/Compile
76 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
77 CROSS_COMPILE=$(TARGET_CROSS) DTC=$(LINUX_DIR)/scripts/dtc/dtc
78 endef
79
80 define Package/uboot/install/default
81 $(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(KDIR)/$(1)-64b-uboot.bin
82 endef
83
84 define Package/uboot/install/template
85 define Package/uboot-layerscape-64b-$(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-layerscape-64b-$(u))) \
97 )