| 1 | # |
| 2 | # Copyright (C) 2010-2012 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:=2012.04.01 |
| 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:=192bb231082d9159fb6e16de3039b6b2 |
| 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/sheevaplug |
| 30 | TITLE:=U-Boot for the SheevaPlug |
| 31 | endef |
| 32 | |
| 33 | define uboot/dockstar |
| 34 | TITLE:=U-Boot for the Seagate DockStar |
| 35 | endef |
| 36 | |
| 37 | define uboot/iconnect |
| 38 | TITLE:=U-Boot for the Iomega iConnect Wireless |
| 39 | endef |
| 40 | |
| 41 | define uboot/ib62x0 |
| 42 | TITLE:=U-Boot for the RaidSonic ICY BOX NAS6210 and NAS6220 |
| 43 | endef |
| 44 | |
| 45 | UBOOTS:=sheevaplug dockstar iconnect ib62x0 |
| 46 | |
| 47 | define Package/uboot/template |
| 48 | define Package/uboot-kirkwood-$(1) |
| 49 | SECTION:=boot |
| 50 | CATEGORY:=Boot Loaders |
| 51 | DEPENDS:=@TARGET_kirkwood |
| 52 | TITLE:=$(2) |
| 53 | URL:=http://www.denx.de/wiki/U-Boot |
| 54 | VARIANT:=$(1) |
| 55 | endef |
| 56 | endef |
| 57 | |
| 58 | define BuildUBootPackage |
| 59 | $(eval $(uboot/Default)) |
| 60 | $(eval $(uboot/$(1))) |
| 61 | $(call Package/uboot/template,$(1),$(TITLE)) |
| 62 | endef |
| 63 | |
| 64 | ifdef BUILD_VARIANT |
| 65 | $(eval $(call uboot/$(BUILD_VARIANT))) |
| 66 | UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) |
| 67 | UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin) |
| 68 | endif |
| 69 | |
| 70 | define Build/Prepare |
| 71 | $(call Build/Prepare/Default) |
| 72 | $(CP) ./files/* $(PKG_BUILD_DIR) |
| 73 | endef |
| 74 | |
| 75 | define Build/Configure |
| 76 | $(MAKE) -C $(PKG_BUILD_DIR) \ |
| 77 | $(UBOOT_CONFIG)_config |
| 78 | endef |
| 79 | |
| 80 | define Build/Compile |
| 81 | $(MAKE) -C $(PKG_BUILD_DIR) \ |
| 82 | u-boot.kwb \ |
| 83 | CROSS_COMPILE=$(TARGET_CROSS) |
| 84 | endef |
| 85 | |
| 86 | define Package/uboot/install/default |
| 87 | $(INSTALL_DIR) $(BIN_DIR) |
| 88 | $(CP) $(PKG_BUILD_DIR)/u-boot.bin \ |
| 89 | $(BIN_DIR)/openwrt-$(BOARD)-$(1)-u-boot.bin |
| 90 | $(CP) $(PKG_BUILD_DIR)/u-boot.kwb \ |
| 91 | $(BIN_DIR)/openwrt-$(BOARD)-$(1)-u-boot.kwb |
| 92 | $(INSTALL_DIR) $(BIN_DIR)/u-boot-kwboot/ |
| 93 | $(CP) $(PKG_BUILD_DIR)/tools/kwboot \ |
| 94 | $(BIN_DIR)/u-boot-kwboot/ |
| 95 | endef |
| 96 | |
| 97 | define Package/uboot/install/template |
| 98 | define Package/uboot-kirkwood-$(1)/install |
| 99 | $(call Package/uboot/install/default,$(2)) |
| 100 | endef |
| 101 | endef |
| 102 | |
| 103 | $(foreach u,$(UBOOTS), \ |
| 104 | $(eval $(call Package/uboot/install/template,$(u),$(u))) \ |
| 105 | ) |
| 106 | |
| 107 | $(foreach u,$(UBOOTS), \ |
| 108 | $(eval $(call BuildUBootPackage,$(u))) \ |
| 109 | $(eval $(call BuildPackage,uboot-kirkwood-$(u))) \ |
| 110 | ) |
| 111 | |