aboutsummaryrefslogtreecommitdiffstats
path: root/package/uboot-lantiq/Makefile
blob: fc7c653716c73976fa1e5d0e8b7c910ddf70e1f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#
# Copyright (C) 2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=u-boot
PKG_VERSION:=2009.11.1
PKG_MD5SUM:=6086421c9e2f3a0d0dbc5f706b551dbc
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot
PKG_TARGETS:=bin

include $(INCLUDE_DIR)/package.mk

ifeq ($(DUMP),)
  STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep '^CONFIG_UBOOT_' $(TOPDIR)/.config | md5s)
endif

define Package/uboot-lantiq
  SECTION:=boot
  CATEGORY:=Boot Loaders
  DEPENDS:=@TARGET_ifxmips
  TITLE:=U-Boot for Lantiq reference boards
  URL:=http://www.denx.de/wiki/U-Boot
endef

define Build/Prepare
	$(PKG_UNPACK)
	cp -r $(CP_OPTS) $(FILES_DIR)/* $(PKG_BUILD_DIR)/
	$(Build/Patch)
	find $(PKG_BUILD_DIR) -name .svn | $(XARGS) rm -rf
endef

UBOOT_TARGET:=$(call qstrip,$(CONFIG_UBOOT_TARGET))
UBOOT_RAMBOOT_DDR_CONFIG:=$(call qstrip,$(CONFIG_UBOOT_RAMBOOT_DDR_CONFIG))

UBOOT_MAKE_OPTS:= \
	CROSS_COMPILE=$(TARGET_CROSS) \
	ENDIANNESS= \
	V=1

define Package/uboot-lantiq/config
	source "$(SOURCE)/Config.in"
endef

define Build/Configure/Target
	$(MAKE) -s -C $(PKG_BUILD_DIR) \
		$(UBOOT_MAKE_OPTS) \
		O=$(PKG_BUILD_DIR)/$(1) \
		$(1)_config
endef

define Build/Configure
	$(call Build/Configure/Target,$(UBOOT_TARGET))
ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
	$(call Build/Configure/Target,$(UBOOT_TARGET)_ramboot)
endif
endef

define Build/Compile/Target
	$(MAKE) -s -C $(PKG_BUILD_DIR) \
		$(UBOOT_MAKE_OPTS) \
		O=$(PKG_BUILD_DIR)/$(1) \
		all
endef

define Build/Compile
	$(call Build/Compile/Target,$(UBOOT_TARGET))
ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
	$(call Build/Compile/Target,$(UBOOT_TARGET)_ramboot)
endif
endef

define Package/uboot-lantiq/install
	mkdir -p $(1)/$(UBOOT_TARGET)
	dd \
		if=$(PKG_BUILD_DIR)/$(UBOOT_TARGET)/u-boot.bin \
		of=$(1)/$(UBOOT_TARGET)/u-boot.bin \
		bs=64k conv=sync
ifeq ($(CONFIG_UBOOT_RAMBOOT),y)
	if [ -e $(UBOOT_RAMBOOT_DDR_CONFIG) ]; then \
		perl ./gct \
			$(UBOOT_RAMBOOT_DDR_CONFIG) \
			$(PKG_BUILD_DIR)/$(UBOOT_TARGET)_ramboot/u-boot.srec \
			$(1)/$(UBOOT_TARGET)/u-boot.asc; \
	fi
endif
endef

$(eval $(call BuildPackage,uboot-lantiq))