# 
# Copyright (C) 2009 DrayTek
#

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

PKG_NAME:=kmod-rt2860
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk

MAKEFLAGS_KMOD:= -C "$(LINUX_DIR)" \
                CROSS_COMPILE="$(TARGET_CROSS)" \
                ARCH="$(LINUX_KARCH)" \
                PATH="$(TARGET_PATH)" \
                SUBDIRS="$(PKG_BUILD_DIR)/ralink_rt2860_driver/Module/os/linux/"

define KernelPackage/rt2860
  SUBMENU:=Wireless Drivers
  DEPENDS:=@TARGET_vsc75xx
  TITLE:=Ralink WiFi RT2860 proprietary drivers
  DEPENDS:=+wireless-tools
  FILES:=$(PKG_BUILD_DIR)/binary/lib/modules/$(LINUX_VERSION)/rt2860ap.$(LINUX_KMOD_SUFFIX)
endef

define KernelPackage/rt2860/description
  This package contains Ralink WiFi RT2860 proprietary drivers for VSC75xx G-RocX.
endef

define Build/Compile
	@echo "Compiling..................."
	$(INSTALL_DIR) $(PKG_BUILD_DIR)/binary
	tar xzfO $(PKG_NAME)_$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)_arm.ipk ./data.tar.gz | tar -C $(PKG_BUILD_DIR)/binary -xzf -
endef

define KernelPackage/rt2860/install
	@echo "Install.................."
	$(CP) $(PKG_BUILD_DIR)/binary/* $(1)	
endef

$(eval $(call KernelPackage,rt2860))
