uboot-lantiq: add new package
[openwrt/staging/wigyori.git] / package / boot / uboot-lantiq / Makefile
1 #
2 # Copyright (C) 2012 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 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=u-boot
12 PKG_VERSION:=2012.07
13 PKG_RELEASE:=1
14
15 PKG_SOURCE_PROTO:=git
16 PKG_SOURCE_URL:=git://dev.phrozen.org/uboot-upstream.git
17 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=a0342fc87a884a2f60e2849bcd48fe366ccf9366
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
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 CONFIG:=
29 IMAGE:=
30 endef
31
32 define uboot/arv4519pw_ram
33 TITLE:=U-Boot for Arcadyan arv4519pw (RAM)
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 endef
40
41 define uboot/arv7518pw_ram
42 TITLE:=U-Boot for Arcadyan arv7518pw (RAM)
43 DDR_SETTINGS:=board/arcadyan/arv7518pw/ddr_settings.h
44 endef
45
46 define uboot/arv7518pw_nor
47 TITLE:=U-Boot for Arcadyan arv7518pw (NOR)
48 endef
49
50 define uboot/gigasx76x_ram
51 TITLE:=U-Boot for Siemens Gigaset sx76x (RAM)
52 DDR_SETTINGS:=board/gigaset/sx76x/ddr_settings.h
53 endef
54
55 define uboot/gigasx76x_nor
56 TITLE:=U-Boot for Siemens Gigaset sx76x (NOR)
57 endef
58
59 UBOOTS:= \
60 arv4519pw_ram arv4519pw_nor \
61 arv7518pw_ram arv7518pw_nor \
62 gigasx76x_ram gigasx76x_nor
63
64 define Package/uboot/template
65 define Package/uboot-lantiq-$(1)
66 SECTION:=boot
67 CATEGORY:=Boot Loaders
68 DEPENDS:=@TARGET_lantiq
69 TITLE:=$(2)
70 URL:=http://www.denx.de/wiki/U-Boot
71 VARIANT:=$(1)
72 MAINTAINER:=Luka Perkov <luka@openwrt.org>
73 endef
74 endef
75
76 define BuildUBootPackage
77 $(eval $(uboot/Default))
78 $(eval $(uboot/$(1)))
79 $(call Package/uboot/template,$(1),$(TITLE))
80 endef
81
82 $(eval $(call uboot/$(BUILD_VARIANT)))
83
84 define Build/Compile
85 $(MAKE) -C $(PKG_BUILD_DIR) $(BUILD_VARIANT) CROSS_COMPILE=$(TARGET_CROSS)
86 ifneq ($(DDR_SETTINGS),)
87 awk -f $(PKG_BUILD_DIR)/tools/lantiq_ram_init_uart.awk $(PKG_BUILD_DIR)/$(DDR_SETTINGS) > $(PKG_BUILD_DIR)/$(BUILD_VARIANT)_ddr_settings
88 perl $(PKG_BUILD_DIR)/tools/gct.pl $(PKG_BUILD_DIR)/$(BUILD_VARIANT)_ddr_settings $(PKG_BUILD_DIR)/u-boot.srec $(PKG_BUILD_DIR)/u-boot.asc
89 endif
90 endef
91
92 define Package/uboot/install/default
93 $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
94 $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
95 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
96 ifneq ($(DDR_SETTINGS),)
97 $(CP) $(PKG_BUILD_DIR)/u-boot.asc \
98 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.asc
99 endif
100 endef
101
102 define Package/uboot/install/template
103 define Package/uboot-lantiq-$(1)/install
104 $(call Package/uboot/install/default,$(2))
105 endef
106 endef
107
108 $(foreach u,$(UBOOTS), \
109 $(eval $(call Package/uboot/install/template,$(u),$(u))) \
110 )
111
112 $(foreach u,$(UBOOTS), \
113 $(eval $(call BuildUBootPackage,$(u))) \
114 $(eval $(call BuildPackage,uboot-lantiq-$(u))) \
115 )