| 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:=2010.03 |
| 13 | PKG_RELEASE:=1 |
| 14 | |
| 15 | PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) |
| 16 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 |
| 17 | PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot |
| 18 | PKG_MD5SUM:= |
| 19 | PKG_TARGETS:=bin |
| 20 | |
| 21 | include $(INCLUDE_DIR)/package.mk |
| 22 | |
| 23 | define uboot/Default |
| 24 | TITLE:= |
| 25 | CONFIG:= |
| 26 | IMAGE:= |
| 27 | endef |
| 28 | |
| 29 | define uboot/nbg460n_550n_550nh |
| 30 | TITLE:=U-boot for the NBG460N/550N/550NH routers |
| 31 | endef |
| 32 | |
| 33 | UBOOTS:=nbg460n_550n_550nh |
| 34 | |
| 35 | define Package/uboot/template |
| 36 | define Package/uboot-ar71xx-$(1) |
| 37 | SECTION:=boot |
| 38 | CATEGORY:=Boot Loaders |
| 39 | TITLE:=$(2) |
| 40 | DEPENDS:=@TARGET_ar71xx |
| 41 | URL:=http://www.denx.de/wiki/U-Boot |
| 42 | DEFAULT:=y if (TARGET_ar71xx_generic_NBG_460N_550N_550NH || TARGET_ar71xx_generic_Default || CONFIG_TARGET_ar71xx_generic_Minimal) |
| 43 | VARIANT:=$(1) |
| 44 | endef |
| 45 | endef |
| 46 | |
| 47 | define BuildUbootPackage |
| 48 | $(eval $(uboot/Default)) |
| 49 | $(eval $(uboot/$(1))) |
| 50 | $(call Package/uboot/template,$(1),$(TITLE)) |
| 51 | endef |
| 52 | |
| 53 | |
| 54 | ifdef BUILD_VARIANT |
| 55 | $(eval $(call uboot/$(BUILD_VARIANT))) |
| 56 | UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) |
| 57 | UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin) |
| 58 | endif |
| 59 | |
| 60 | define Build/Prepare |
| 61 | $(call Build/Prepare/Default) |
| 62 | $(CP) ./files/* $(PKG_BUILD_DIR) |
| 63 | find $(PKG_BUILD_DIR) -name .svn | $(XARGS) rm -rf |
| 64 | endef |
| 65 | |
| 66 | define Build/Configure |
| 67 | $(MAKE) -C $(PKG_BUILD_DIR) \ |
| 68 | $(UBOOT_CONFIG)_config |
| 69 | endef |
| 70 | |
| 71 | define Build/Compile |
| 72 | $(MAKE) -C $(PKG_BUILD_DIR) \ |
| 73 | CROSS_COMPILE=$(TARGET_CROSS) |
| 74 | endef |
| 75 | |
| 76 | define Package/uboot/install/template |
| 77 | define Package/uboot-ar71xx-$(1)/install |
| 78 | $(INSTALL_DIR) $$(1) |
| 79 | $(CP) $(PKG_BUILD_DIR)/u-boot.bin $(BIN_DIR)/$(2) |
| 80 | endef |
| 81 | endef |
| 82 | |
| 83 | $(foreach u,$(UBOOTS), \ |
| 84 | $(eval $(call Package/uboot/install/template,$(u),openwrt-$(BOARD)-$(SUBTARGET)-$(u)-u-boot.bin)) \ |
| 85 | ) |
| 86 | |
| 87 | $(foreach u,$(UBOOTS), \ |
| 88 | $(eval $(call BuildUbootPackage,$(u))) \ |
| 89 | $(eval $(call BuildPackage,uboot-ar71xx-$(u))) \ |
| 90 | ) |
| 91 | |