kobs-ng: add new package
[openwrt/staging/wigyori.git] / package / boot / uboot-lantiq / Makefile
index 25e6cbb..b3d9173 100644 (file)
@@ -1,22 +1,20 @@
 #
-# Copyright (C) 2012 OpenWrt.org
+# Copyright (C) 2012-2013 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:=2012.07
+PKG_VERSION:=2013.01
 PKG_RELEASE:=1
 
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=git://dev.phrozen.org/uboot-upstream.git
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=a0342fc87a884a2f60e2849bcd48fe366ccf9366
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot
+PKG_MD5SUM:=e58a8a7f78972248190d83de0dc362ce
 PKG_TARGETS:=bin
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
@@ -25,35 +23,42 @@ include $(INCLUDE_DIR)/package.mk
 
 define uboot/Default
   TITLE:=
-  CONFIG:=
+  SOC:=
+  DDR_SETTINGS:=
   IMAGE:=
 endef
 
 define uboot/arv4519pw_ram
   TITLE:=U-Boot for Arcadyan arv4519pw (RAM)
+  SOC:=danube
   DDR_SETTINGS:=board/arcadyan/arv4519pw/ddr_settings.h
 endef
 
 define uboot/arv4519pw_nor
   TITLE:=U-Boot for Arcadyan arv4519pw (NOR)
+  SOC:=danube
 endef
 
 define uboot/arv7518pw_ram
   TITLE:=U-Boot for Arcadyan arv7518pw (RAM)
+  SOC:=danube
   DDR_SETTINGS:=board/arcadyan/arv7518pw/ddr_settings.h
 endef
 
 define uboot/arv7518pw_nor
   TITLE:=U-Boot for Arcadyan arv7518pw (NOR)
+  SOC:=danube
 endef
 
 define uboot/gigasx76x_ram
   TITLE:=U-Boot for Siemens Gigaset sx76x (RAM)
+  SOC:=danube
   DDR_SETTINGS:=board/gigaset/sx76x/ddr_settings.h
 endef
 
 define uboot/gigasx76x_nor
   TITLE:=U-Boot for Siemens Gigaset sx76x (NOR)
+  SOC:=danube
 endef
 
 UBOOTS:= \
@@ -79,37 +84,40 @@ define BuildUBootPackage
        $(call Package/uboot/template,$(1),$(TITLE))
 endef
 
-$(eval $(call uboot/$(BUILD_VARIANT)))
+define Build/Configure
+       $(MAKE) -C $(PKG_BUILD_DIR) $(BUILD_VARIANT)_config
+endef
 
 define Build/Compile
-       $(MAKE) -C $(PKG_BUILD_DIR) $(BUILD_VARIANT) CROSS_COMPILE=$(TARGET_CROSS)
-ifneq ($(DDR_SETTINGS),)
-       awk -f $(PKG_BUILD_DIR)/tools/lantiq_ram_init_uart.awk $(PKG_BUILD_DIR)/$(DDR_SETTINGS) > $(PKG_BUILD_DIR)/$(BUILD_VARIANT)_ddr_settings
-       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
-endif
+       $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS)
 endef
 
 define Package/uboot/install/default
-       $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
-       $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
-               $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
-ifneq ($(DDR_SETTINGS),)
-       $(CP) $(PKG_BUILD_DIR)/u-boot.asc \
-               $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.asc
-endif
+       $(CP) \
+               $(PKG_BUILD_DIR)/$(2) \
+               $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
 endef
 
+define Package/uboot/install/uart
+       awk -f $(PKG_BUILD_DIR)/tools/lantiq_ram_init_uart.awk \
+               -v soc=$(2) $(PKG_BUILD_DIR)/$(3) \
+               > $(PKG_BUILD_DIR)/ddr_settings
+       perl $(PKG_BUILD_DIR)/tools/gct.pl \
+               $(PKG_BUILD_DIR)/ddr_settings $(PKG_BUILD_DIR)/u-boot.srec \
+               $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.asc
+ endef
+
 define Package/uboot/install/template
 define Package/uboot-lantiq-$(1)/install
-       $(call Package/uboot/install/default,$(2))
+       $(call Package/uboot/install/default,$(1),$(if $(IMAGE),$(IMAGE),u-boot.bin))
+       $(if $(DDR_SETTINGS), \
+               $(call Package/uboot/install/uart,$(1),$(SOC),$(DDR_SETTINGS)) \
+       )
 endef
 endef
 
-$(foreach u,$(UBOOTS), \
-       $(eval $(call Package/uboot/install/template,$(u),$(u))) \
-)
-
 $(foreach u,$(UBOOTS), \
        $(eval $(call BuildUBootPackage,$(u))) \
+       $(eval $(call Package/uboot/install/template,$(u))) \
        $(eval $(call BuildPackage,uboot-lantiq-$(u))) \
 )