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