[uboot-lantiq] httpd failsafe - add image check and flash access
[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/U-Boot
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:=$(call qstrip,$(CONFIG_UBOOT_CONFIG))
39 UBOOT_DDR_CONFIG:=$(call qstrip,$(CONFIG_UBOOT_DDR_CONFIG))
40
41 UBOOT_MAKE_OPTS:= \
42         CROSS_COMPILE=$(TARGET_CROSS) \
43         ENDIANNESS= \
44         V=1
45
46 define Package/uboot-lantiq/config
47         menu "configuration"
48                 source "$(SOURCE)/Config.in"
49         endmenu
50 endef
51
52 define Build/Configure/Target
53         $(MAKE) -s -C $(PKG_BUILD_DIR) \
54                 $(UBOOT_MAKE_OPTS) \
55                 O=$(PKG_BUILD_DIR)/$(1) \
56                 $(1)_config
57 endef
58
59 define Build/Configure
60         $(call Build/Configure/Target,$(UBOOT_CONFIG))
61 ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
62         $(call Build/Configure/Target,$(UBOOT_CONFIG)_ramboot)
63 endif
64 endef
65
66 define Build/Compile/Target
67         $(MAKE) -s -C $(PKG_BUILD_DIR) \
68                 $(UBOOT_MAKE_OPTS) \
69                 O=$(PKG_BUILD_DIR)/$(1) \
70                 all
71 endef
72
73 define Build/Compile
74         $(call Build/Compile/Target,$(UBOOT_CONFIG))
75 ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
76         $(call Build/Compile/Target,$(UBOOT_CONFIG)_ramboot)
77 endif
78 endef
79
80 define Package/uboot-lantiq/install
81         mkdir -p $(1)/$(UBOOT_CONFIG)
82         dd \
83                 if=$(PKG_BUILD_DIR)/$(UBOOT_CONFIG)/u-boot.bin \
84                 of=$(1)/$(UBOOT_CONFIG)/u-boot.bin \
85                 bs=64k conv=sync
86 ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
87         if [ -e $(UBOOT_DDR_CONFIG) ]; then \
88                 perl ./gct \
89                         $(UBOOT_DDR_CONFIG) \
90                         $(PKG_BUILD_DIR)/$(UBOOT_CONFIG)_ramboot/u-boot.srec \
91                         $(1)/$(UBOOT_CONFIG)/u-boot.asc; \
92         fi
93 endif
94 endef
95
96 $(eval $(call BuildPackage,uboot-lantiq))