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