add uboot-lantiq (based on a patch contributed by Lantiq)
[openwrt-10.03/.git] / package / uboot-lantiq / Makefile
1 #
2 # Copyright (C) 2010 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:=2009.11.1
13 PKG_MD5SUM:=6086421c9e2f3a0d0dbc5f706b551dbc
14 PKG_RELEASE:=1
15
16 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
18 PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot
19 PKG_TARGETS:=bin
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/uboot-lantiq
24   SECTION:=boot
25   CATEGORY:=Boot Loaders
26   DEPENDS:=@TARGET_ifxmips
27   TITLE:=U-Boot for Lantiq reference boards
28   URL:=http://www.denx.de/wiki/UBoot/WebHome
29 endef
30
31 define Build/Prepare
32         $(PKG_UNPACK)
33         cp -r $(CP_OPTS) $(FILES_DIR)/* $(PKG_BUILD_DIR)/
34         $(Build/Patch)
35         find $(PKG_BUILD_DIR) -name .svn | $(XARGS) rm -rf
36 endef
37
38 UBOOT_CONFIG:=easy50712_DDR166M
39 UBOOT_MAKE_OPTS:= \
40         CROSS_COMPILE=$(TARGET_CROSS) \
41         ENDIANNESS= \
42         V=1
43
44 define Build/Configure/Target
45         $(MAKE) -s -C $(PKG_BUILD_DIR) \
46                 $(UBOOT_MAKE_OPTS) \
47                 O=$(PKG_BUILD_DIR)/$(1) \
48                 $(1)_config
49 endef
50
51 define Build/Configure
52         $(call Build/Configure/Target,$(UBOOT_CONFIG))
53         $(call Build/Configure/Target,$(UBOOT_CONFIG)_ramboot)
54 endef
55
56 define Build/Compile/Target
57         $(MAKE) -s -C $(PKG_BUILD_DIR) \
58                 $(UBOOT_MAKE_OPTS) \
59                 O=$(PKG_BUILD_DIR)/$(1) \
60                 all
61 endef
62
63 define Build/Compile
64         $(call Build/Compile/Target,$(UBOOT_CONFIG))
65         $(call Build/Compile/Target,$(UBOOT_CONFIG)_ramboot)
66 endef
67
68 define Package/uboot-lantiq/install
69         mkdir -p $(1)/$(UBOOT_CONFIG)
70         dd \
71                 if=$(PKG_BUILD_DIR)/$(UBOOT_CONFIG)/u-boot.bin \
72                 of=$(1)/$(UBOOT_CONFIG)/u-boot.bin \
73                 bs=64k conv=sync
74         if [ -e $(UBOOT_CONFIG).conf ]; then \
75                 perl ./gct \
76                         $(UBOOT_CONFIG).conf \
77                         $(PKG_BUILD_DIR)/$(UBOOT_CONFIG)_ramboot/u-boot.srec \
78                         $(1)/$(UBOOT_CONFIG)/u-boot.asc; \
79         fi
80 endef
81
82 $(eval $(call BuildPackage,uboot-lantiq))