sunxi: boot changes - Added uEnv.txt to facilitate automatic boot. - Cosmetic fix...
[openwrt/staging/lynxis/omap.git] / package / boot / uboot-sunxi / Makefile
1 #
2 # Copyright (C) 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.10-rc2-sunxi
12 PKG_RELEASE:=1
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_URL:=git://github.com/linux-sunxi/u-boot-sunxi
15 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE_VERSION:=b322f6723d59b9bb88701991c7b8b15867bf3692
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define uboot/Default
23 TITLE:=
24 CONFIG:=
25 IMAGE:=
26 endef
27
28 define uboot/A10-OLinuXino-Lime
29 TITLE:=U-Boot 2013.10-rc2 for the A10 OLinuXino LIME
30 endef
31
32 define uboot/A13-OLinuXino
33 TITLE:=U-Boot 2013.10-rc2 for the A13 OlinuXino
34 endef
35
36 define uboot/A20-OLinuXino_MICRO
37 TITLE:=U-Boot 2013.10-rc2 for A20 OLinuXino MICRO
38 endef
39
40 define uboot/Cubieboard
41 TITLE:=U-Boot 2013.10-rc2 for Cubieboard
42 endef
43
44 define uboot/Cubieboard2
45 TITLE:=U-Boot 2013.10-rc2 for Cubieboard2
46 endef
47
48 define uboot/Cubietruck
49 TITLE:=U-Boot 2013.10-rc2 for Cubietruck
50 endef
51
52 define uboot/Hackberry
53 TITLE:=U-Boot 2013.10-rc2 for the Hackbeery
54 endef
55
56 define uboot/pcDuino
57 TITLE:=U-Boot 2013.10-rc2 for pcDuino
58 endef
59
60 UBOOTS:=A10-OLinuXino-Lime A13-OLinuXino A20-OLinuXino_MICRO Cubieboard Cubieboard2 Cubietruck Hackberry pcDuino
61
62 define Package/uboot/template
63 define Package/uboot-sunxi-$(1)
64 SECTION:=boot
65 CATEGORY:=Boot Loaders
66 DEPENDS:=@TARGET_sunxi
67 TITLE:=$(2)
68 URL:=http://www.denx.de/wiki/U-Boot
69 VARIANT:=$(1)
70 MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
71 endef
72 endef
73
74 define BuildUBootPackage
75 $(eval $(uboot/Default))
76 $(eval $(uboot/$(1)))
77 $(call Package/uboot/template,$(1),$(TITLE))
78 endef
79
80 ifdef BUILD_VARIANT
81 $(eval $(call uboot/$(BUILD_VARIANT)))
82 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
83 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
84 endif
85
86 define Build/Configure
87 $(MAKE) -C $(PKG_BUILD_DIR) \
88 USE_PRIVATE_LIBGCC=yes $(UBOOT_CONFIG)_config
89 endef
90
91 define Build/Compile
92 $(MAKE) -C $(PKG_BUILD_DIR) \
93 CROSS_COMPILE=$(TARGET_CROSS)
94 endef
95
96 define Package/uboot/install/default
97 $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
98 $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
99 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
100 $(CP) $(PKG_BUILD_DIR)/spl/sunxi-spl.bin \
101 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-spl.bin
102 $(CP) $(PKG_BUILD_DIR)/u-boot-sunxi-with-spl.bin \
103 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot-with-spl.bin
104 $(CP) uEnv.txt \
105 $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-uEnv.txt
106 endef
107
108 define Package/uboot/install/template
109 define Package/uboot-sunxi-$(1)/install
110 $(call Package/uboot/install/default,$(2))
111 endef
112 endef
113
114 $(foreach u,$(UBOOTS), \
115 $(eval $(call Package/uboot/install/template,$(u),$(u))) \
116 )
117
118 $(foreach u,$(UBOOTS), \
119 $(eval $(call BuildUBootPackage,$(u))) \
120 $(eval $(call BuildPackage,uboot-sunxi-$(u))) \
121 )