uboot-lantiq: add packages for Lantiq EASY50712
[openwrt.git] / package / boot / uboot-lantiq / Makefile
1 #
2 # Copyright (C) 2012-2013 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:=2013.10
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:=a076a044b64371edc52f7e562b13f6b2
20 PKG_TARGETS:=bin
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define uboot/Default
27   TITLE:=
28   SOC:=
29   DDR_SETTINGS:=
30   IMAGE:=
31 endef
32
33 define uboot/arv4519pw_ram
34   TITLE:=U-Boot for Arcadyan arv4519pw (RAM)
35   SOC:=danube
36   DDR_SETTINGS:=board/arcadyan/arv4519pw/ddr_settings.h
37 endef
38
39 define uboot/arv4519pw_nor
40   TITLE:=U-Boot for Arcadyan arv4519pw (NOR)
41   SOC:=danube
42 endef
43
44 define uboot/arv7518pw_ram
45   TITLE:=U-Boot for Arcadyan arv7518pw (RAM)
46   SOC:=danube
47   DDR_SETTINGS:=board/arcadyan/arv7518pw/ddr_settings.h
48 endef
49
50 define uboot/arv7518pw_nor
51   TITLE:=U-Boot for Arcadyan arv7518pw (NOR)
52   SOC:=danube
53 endef
54
55 define uboot/gigasx76x_ram
56   TITLE:=U-Boot for Siemens Gigaset sx76x (RAM)
57   SOC:=danube
58   DDR_SETTINGS:=board/gigaset/sx76x/ddr_settings.h
59 endef
60
61 define uboot/gigasx76x_nor
62   TITLE:=U-Boot for Siemens Gigaset sx76x (NOR)
63   SOC:=danube
64 endef
65
66 define uboot/easy50712_ram
67   TITLE:=U-Boot for Lantiq EASY50712 (RAM)
68   SOC:=danube
69   DDR_SETTINGS:=board/lantiq/easy50712/ddr_settings.h
70 endef
71
72 define uboot/easy50712_nor
73   TITLE:=U-Boot for Lantiq EASY50712 (NOR)
74   SOC:=danube
75 endef
76
77 define uboot/easy50712_norspl
78   TITLE:=U-Boot for Lantiq EASY50712 (NOR SPL)
79   SOC:=danube
80   IMAGE:=u-boot.ltq.lzo.norspl
81 endef
82
83 UBOOTS:= \
84         arv4519pw_ram arv4519pw_nor \
85         arv7518pw_ram arv7518pw_nor \
86         gigasx76x_ram gigasx76x_nor \
87         easy50712_ram easy50712_nor easy50712_norspl
88
89 define Package/uboot/template
90 define Package/uboot-lantiq-$(1)
91   SECTION:=boot
92   CATEGORY:=Boot Loaders
93   DEPENDS:=@TARGET_lantiq_xway
94   TITLE:=$(2)
95   URL:=http://www.denx.de/wiki/U-Boot
96   VARIANT:=$(1)
97   MAINTAINER:=Luka Perkov <luka@openwrt.org>
98 endef
99 endef
100
101 define BuildUBootPackage
102         $(eval $(uboot/Default))
103         $(eval $(uboot/$(1)))
104         $(call Package/uboot/template,$(1),$(TITLE))
105 endef
106
107 define Build/Configure
108         $(MAKE) -C $(PKG_BUILD_DIR) $(BUILD_VARIANT)_config
109 endef
110
111 define Build/Compile
112         $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS)
113 endef
114
115 define Package/uboot/install/default
116         $(CP) \
117                 $(PKG_BUILD_DIR)/$(2) \
118                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
119 endef
120
121 define Package/uboot/install/uart
122         awk -f $(PKG_BUILD_DIR)/tools/lantiq_ram_init_uart.awk \
123                 -v soc=$(2) $(PKG_BUILD_DIR)/$(3) \
124                 > $(PKG_BUILD_DIR)/ddr_settings
125         perl $(PKG_BUILD_DIR)/tools/gct.pl \
126                 $(PKG_BUILD_DIR)/ddr_settings $(PKG_BUILD_DIR)/u-boot.srec \
127                 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.asc
128  endef
129
130 define Package/uboot/install/template
131 define Package/uboot-lantiq-$(1)/install
132         $(call Package/uboot/install/default,$(1),$(if $(IMAGE),$(IMAGE),u-boot.bin))
133         $(if $(DDR_SETTINGS), \
134                 $(call Package/uboot/install/uart,$(1),$(SOC),$(DDR_SETTINGS)) \
135         )
136 endef
137 endef
138
139 $(foreach u,$(UBOOTS), \
140         $(eval $(call BuildUBootPackage,$(u))) \
141         $(eval $(call Package/uboot/install/template,$(u))) \
142         $(eval $(call BuildPackage,uboot-lantiq-$(u))) \
143 )