c42f947612161f749d60eb9a1469e55c220e86c7
[openwrt/staging/yousong.git] / package / boot / uboot-kirkwood / Makefile
1 #
2 # Copyright (C) 2010-2014 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.09.01
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_HASH:=95728e89dd476d17428f94080752ab48884be477b6a678941582aeef618b70bb
20 PKG_TARGETS:=bin
21
22 PKG_LICENSE:=GPL-2.0 GPL-2.0+
23 PKG_LICENSE_FILES:=Licenses/README
24
25 PKG_BUILD_PARALLEL:=1
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define uboot/Default
30 TITLE:=
31 endef
32
33 define uboot/dockstar
34 TITLE:=U-Boot for Seagate DockStar
35 endef
36
37 define uboot/dockstar_second_stage
38 TITLE:=second stage U-Boot for Seagate DockStar
39 endef
40
41 define uboot/goflexhome
42 TITLE:=U-Boot for the Seagate GoFlexHome/GoFlexNet
43 endef
44
45 define uboot/ib62x0
46 TITLE:=U-Boot for RaidSonic ICY BOX NAS6210 and NAS6220
47 endef
48
49 define uboot/ib62x0_second_stage
50 TITLE:=second stage U-Boot for RaidSonic ICY BOX NAS6210 and NAS6220
51 endef
52
53 define uboot/iconnect
54 TITLE:=U-Boot for Iomega iConnect Wireless
55 endef
56
57 define uboot/iconnect_second_stage
58 TITLE:=second stage U-Boot for Iomega iConnect Wireless
59 endef
60
61 define uboot/nsa310
62 TITLE:=U-Boot for Zyxel NSA310
63 endef
64
65 define uboot/pogo_e02
66 TITLE:=U-Boot for Cloud Engines Pogoplug E02
67 endef
68
69 define uboot/pogo_e02_second_stage
70 TITLE:=second stage U-Boot for Cloud Engines Pogoplug E02
71 endef
72
73 define uboot/sheevaplug
74 TITLE:=U-Boot for SheevaPlug
75 endef
76
77 UBOOTS:= \
78 dockstar dockstar_second_stage \
79 goflexhome \
80 ib62x0 ib62x0_second_stage \
81 iconnect iconnect_second_stage \
82 nsa310 \
83 pogo_e02 pogo_e02_second_stage \
84 sheevaplug
85
86 define Package/uboot/template
87 define Package/uboot-kirkwood-$(1)
88 SECTION:=boot
89 CATEGORY:=Boot Loaders
90 DEPENDS:=@TARGET_kirkwood
91 TITLE:=$(2)
92 URL:=http://www.denx.de/wiki/U-Boot
93 VARIANT:=$(1)
94 endef
95 endef
96
97 define BuildUBootPackage
98 $(eval $(uboot/Default))
99 $(eval $(uboot/$(1)))
100 $(call Package/uboot/template,$(1),$(TITLE))
101 endef
102
103 define Build/Configure
104 $(if $(findstring _second_stage,$(BUILD_VARIANT)),
105 $(CP) \
106 $(PKG_BUILD_DIR)/configs/$(subst _second_stage,,$(BUILD_VARIANT))_defconfig \
107 $(PKG_BUILD_DIR)/configs/$(BUILD_VARIANT)_defconfig
108 echo CONFIG_SECOND_STAGE=y >> $(PKG_BUILD_DIR)/configs/$(BUILD_VARIANT)_defconfig
109 )
110 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
111 $(BUILD_VARIANT)_config V=1
112 endef
113
114 define Build/Compile
115 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
116 u-boot.kwb \
117 CROSS_COMPILE=$(TARGET_CROSS)
118 mkimage -A $(ARCH) -O linux -T kernel -C none \
119 -a 0x600000 -e 0x600000 \
120 -n 'OpenWrt Das U-Boot uImage' \
121 -d $(PKG_BUILD_DIR)/u-boot.bin $(PKG_BUILD_DIR)/u-boot.img
122 endef
123
124 define Package/uboot/install/default
125 $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
126 $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
127 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
128 $(CP) $(PKG_BUILD_DIR)/u-boot.kwb \
129 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.kwb
130 $(CP) $(PKG_BUILD_DIR)/u-boot.img \
131 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
132 $(INSTALL_DIR) $(BIN_DIR)/u-boot-kwboot/
133 $(CP) $(PKG_BUILD_DIR)/tools/kwboot \
134 $(BIN_DIR)/u-boot-kwboot/
135 endef
136
137 define Package/uboot/install/template
138 define Package/uboot-kirkwood-$(1)/install
139 $(call Package/uboot/install/default,$(2))
140 endef
141 endef
142
143 $(foreach u,$(UBOOTS), \
144 $(eval $(call Package/uboot/install/template,$(u),$(u))) \
145 )
146
147 $(foreach u,$(UBOOTS), \
148 $(eval $(call BuildUBootPackage,$(u))) \
149 $(eval $(call BuildPackage,uboot-kirkwood-$(u))) \
150 )