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