| 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:=carl9170 |
| 12 | PKG_VERSION:=1.0.5.3 |
| 13 | PKG_RELEASE:=1 |
| 14 | |
| 15 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 |
| 16 | PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/chr/carl9170/$(PKG_VERSION) \ |
| 17 | @KERNEL/linux/kernel/people/chr/carl9170/old/$(PKG_VERSION) |
| 18 | PKG_MD5SUM:=91d714d1e5c5c62da1191ac5afd8bcb0 |
| 19 | |
| 20 | PKG_CONFIG_DEPENDS:= \ |
| 21 | CONFIG_PACKAGE_CARL9170_DEBUGFS \ |
| 22 | |
| 23 | include $(INCLUDE_DIR)/package.mk |
| 24 | |
| 25 | DRV_PATH:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170 |
| 26 | |
| 27 | define KernelPackage/carl9170 |
| 28 | SUBMENU:=Wireless Drivers |
| 29 | TITLE:=Driver for Atheros AR9170 USB sticks |
| 30 | DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core |
| 31 | URL:=http://www.kernel.org/pub/linux/kernel/people/chr/carl9170 |
| 32 | FILES:=$(DRV_PATH)/carl9170usb.$(LINUX_KMOD_SUFFIX) |
| 33 | AUTOLOAD:=$(call AutoLoad,60,carl9170usb) |
| 34 | MENU:=1 |
| 35 | endef |
| 36 | |
| 37 | define KernelPackage/carl9170/config |
| 38 | menu "Configuration" |
| 39 | depends PACKAGE_kmod-carl9170 |
| 40 | |
| 41 | config PACKAGE_CARL9170_DEBUGFS |
| 42 | bool "Enable Debugging (DebugFS) Support" |
| 43 | depends PACKAGE_MAC80211_DEBUGFS |
| 44 | help |
| 45 | Say Y if you need access to carl9170usb's statistics for QoS queue |
| 46 | status, rate control, etc... |
| 47 | |
| 48 | endmenu |
| 49 | endef |
| 50 | |
| 51 | define KernelPackage/carl9170/description |
| 52 | This package contains a driver for Atheros AR9170 USB sticks using the free firmware |
| 53 | endef |
| 54 | |
| 55 | define Build/Prepare |
| 56 | rm -rf $(PKG_BUILD_DIR) |
| 57 | mkdir -p $(PKG_BUILD_DIR) |
| 58 | $(HOST_TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_SOURCE) |
| 59 | $(HOST_TAR) -C $(PKG_BUILD_DIR) -xf $(PKG_BUILD_DIR)/$(PKG_VERSION)/driver/carl9170-driver-$(PKG_VERSION).tar |
| 60 | ln -s $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ |
| 61 | $(Build/Patch) |
| 62 | endef |
| 63 | |
| 64 | BUILDFLAGS = \ |
| 65 | CONFIG_CARL9170_USB=m \ |
| 66 | CONFIG_CARL9170_LEDS=$(if $(CONFIG_LEDS_TRIGGERS),y) \ |
| 67 | CONFIG_CARL9170_DEBUGFS=$(if $(CONFIG_PACKAGE_CARL9170_DEBUGFS),y) \ |
| 68 | CONFIG_MAC80211_DEBUGFS=$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),y) \ |
| 69 | |
| 70 | EXTRA_CFLAGS = \ |
| 71 | $(if $(CONFIG_ATH_USER_REGD),-DATH_USER_REGD) \ |
| 72 | $(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS -DCONFIG_CARL9170_LEDS) \ |
| 73 | $(if $(CONFIG_PACKAGE_CARL9170_DEBUGFS),-DCONFIG_CARL9170_DEBUGFS) \ |
| 74 | $(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),-DCONFIG_MAC80211_DEBUGFS) \ |
| 75 | |
| 76 | define Build/Compile |
| 77 | $(MAKE) -C $(LINUX_DIR) \ |
| 78 | SUBDIRS="$(DRV_PATH)" \ |
| 79 | ARCH="$(LINUX_KARCH)" \ |
| 80 | CROSS_COMPILE="$(KERNEL_CROSS)" \ |
| 81 | CC="$(TARGET_CC) -I$(STAGING_DIR)/usr/include/mac80211 $(EXTRA_CFLAGS)" \ |
| 82 | $(BUILDFLAGS) |
| 83 | endef |
| 84 | |
| 85 | define KernelPackage/carl9170/install |
| 86 | $(INSTALL_DIR) $(1)/lib/firmware |
| 87 | $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_VERSION)/firmware_build/carl9170-1.fw $(1)/lib/firmware/ |
| 88 | endef |
| 89 | |
| 90 | $(eval $(call KernelPackage,carl9170)) |
| 91 | |