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