0d82296058640c2a9a2b8db9165eff73c4c4cbab
[openwrt.git] / package / rt2x00 / Makefile
1 #
2 # Copyright (C) 2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id: $
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=rt2x00
13 PKG_VERSION:=cvs-20070712
14
15 PKG_FW6X_NAME:=RT61_Firmware_V1.2.zip
16 PKG_FW6X_URL:=http://www.ralinktech.com.tw/data/
17 PKG_FW6X_MD5SUM:=d4c690c93b470bc9a681297c2adc6281
18
19 PKG_FW7X_NAME:=RT71W_Firmware_V1.8.zip
20 PKG_FW7X_URL:=http://www.ralinktech.com.tw/data/
21 PKG_FW7X_MD5SUM:=1e7a5dc574e0268574fcda3fd5cf52f7
22
23 include $(INCLUDE_DIR)/package.mk
24 ifeq ($(DUMP),)
25 include $(LINUX_DIR)/.config
26 endif
27
28 # XXX: remove @!TARGET_* later when we have PCI & USB support properly detected on all targets
29 define KernelPackage/rt2x00/Default
30 SUBMENU:=Wireless Drivers
31 TITLE:=Ralink Drivers for RT2x00 cards
32 DEPENDS:=@LINUX_2_6 @!TARGET_atheros @!TARGET_uml
33 KCONFIG:=CONFIG_MAC80211
34 endef
35
36 define KernelPackage/rt2x00-lib
37 $(call KernelPackage/rt2x00/Default)
38 DEPENDS+= @PCI_SUPPORT||USB_SUPPORT +kmod-mac80211
39 TITLE+= (LIB)
40 FILES:=$(PKG_BUILD_DIR)/rt2x00lib.$(LINUX_KMOD_SUFFIX)
41 AUTOLOAD:=$(call AutoLoad,25,blkcipher ecb arc4 rt2x00lib)
42 endef
43
44 define KernelPackage/rt2x00-pci
45 $(call KernelPackage/rt2x00/Default)
46 DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-lib +kmod-eeprom-93cx6
47 TITLE+= (PCI)
48 FILES:=$(PKG_BUILD_DIR)/rt2x00pci.$(LINUX_KMOD_SUFFIX)
49 AUTOLOAD:=$(call AutoLoad,26,rt2x00pci)
50 endef
51
52 define KernelPackage/rt2x00-usb
53 $(call KernelPackage/rt2x00/Default)
54 DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
55 TITLE+= (USB)
56 FILES:=$(PKG_BUILD_DIR)/rt2x00usb.$(LINUX_KMOD_SUFFIX)
57 AUTOLOAD:=$(call AutoLoad,26,rt2x00usb)
58 endef
59
60 define KernelPackage/rt2400-pci
61 $(call KernelPackage/rt2x00/Default)
62 DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
63 TITLE+= (RT2400 PCI)
64 FILES:=$(PKG_BUILD_DIR)/rt2400pci.$(LINUX_KMOD_SUFFIX)
65 AUTOLOAD:=$(call AutoLoad,27,rt2400pci)
66 endef
67
68 define KernelPackage/rt2500-pci
69 $(call KernelPackage/rt2x00/Default)
70 DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
71 TITLE+= (RT2500 PCI)
72 FILES:=$(PKG_BUILD_DIR)/rt2500pci.$(LINUX_KMOD_SUFFIX)
73 AUTOLOAD:=$(call AutoLoad,27,rt2500pci)
74 endef
75
76 define KernelPackage/rt2500-usb
77 $(call KernelPackage/rt2x00/Default)
78 DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-crc-itu-t
79 TITLE+= (RT2500 USB)
80 FILES:=$(PKG_BUILD_DIR)/rt2500usb.$(LINUX_KMOD_SUFFIX)
81 AUTOLOAD:=$(call AutoLoad,27,rt2500usb)
82 endef
83
84 define KernelPackage/rt61-pci
85 $(call KernelPackage/rt2x00/Default)
86 DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-crc-itu-t
87 TITLE+= (RT2x61 PCI)
88 FILES:=$(PKG_BUILD_DIR)/rt61pci.$(LINUX_KMOD_SUFFIX)
89 AUTOLOAD:=$(call AutoLoad,27,rt61pci)
90 endef
91
92 define KernelPackage/rt73-usb
93 $(call KernelPackage/rt2x00/Default)
94 DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
95 TITLE+= (RT73 USB)
96 FILES:=$(PKG_BUILD_DIR)/rt73usb.$(LINUX_KMOD_SUFFIX)
97 AUTOLOAD:=$(call AutoLoad,27,rt73usb)
98 endef
99
100 $(STAMP_PREPARED): $(DL_DIR)/$(PKG_FW6X_NAME) $(DL_DIR)/$(PKG_FW7X_NAME)
101
102 $(DL_DIR)/$(PKG_FW6X_NAME):
103 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_FW6X_NAME)" "$(PKG_FW6X_MD5SUM)" $(PKG_FW6X_URL)
104
105 $(DL_DIR)/$(PKG_FW7X_NAME):
106 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_FW7X_NAME)" "$(PKG_FW7X_MD5SUM)" $(PKG_FW7X_URL)
107
108 # only try to build if the kernel is recent enough (has in-kernel mac80211)
109 ifndef ($(CONFIG_MAC80211),)
110
111 PKG_EXTRA_KCONFIG:= \
112 CONFIG_RT2X00=y \
113 CONFIG_RT2X00_DEBUG=y \
114
115 ifneq ($(CONFIG_PACKAGE_kmod-rt2x00-pci),)
116 PKG_EXTRA_KCONFIG+= CONFIG_RT2X00PCI=y
117 endif
118 ifneq ($(CONFIG_PACKAGE_kmod-rt2x00-usb),)
119 PKG_EXTRA_KCONFIG+= CONFIG_RT2X00USB=y
120 endif
121 ifneq ($(CONFIG_PACKAGE_kmod-rt2400-pci),)
122 PKG_EXTRA_KCONFIG+= CONFIG_RT2400PCI=y
123 endif
124 ifneq ($(CONFIG_PACKAGE_kmod-rt2500-pci),)
125 PKG_EXTRA_KCONFIG+= CONFIG_RT2500PCI=y
126 endif
127 ifneq ($(CONFIG_PACKAGE_kmod-rt2500-usb),)
128 PKG_EXTRA_KCONFIG+= CONFIG_RT2500USB=y
129 endif
130 ifneq ($(CONFIG_PACKAGE_kmod-rt61-pci),)
131 PKG_EXTRA_KCONFIG+= CONFIG_RT61PCI=y
132 endif
133 ifneq ($(CONFIG_PACKAGE_kmod-rt73-usb),)
134 PKG_EXTRA_KCONFIG+= CONFIG_RT73USB=y
135 endif
136
137 PKG_EXTRA_CFLAGS:= \
138 -I$(STAGING_DIR)/usr/include/mac80211 \
139 $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
140 $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
141
142 define Build/Compile/it
143 $(MAKE) -C "$(LINUX_DIR)" \
144 ARCH="$(LINUX_KARCH)" \
145 CROSS_COMPILE="$(TARGET_CROSS)" \
146 SUBDIRS="$(PKG_BUILD_DIR)" \
147 $(PKG_EXTRA_KCONFIG) \
148 EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \
149 V="$(V)" \
150 modules
151 endef
152
153 endif
154
155 define Build/Prepare
156 $(call Build/Prepare/Default)
157 $(CP) -r src/* $(PKG_BUILD_DIR)/
158 unzip -jod $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_FW6X_NAME)
159 unzip -jod $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_FW7X_NAME)
160 endef
161
162 define Build/Configure
163 touch $(PKG_BUILD_DIR)/rt2x00_config.h
164 endef
165
166 define Build/Compile
167 $(call Build/Compile/it)
168 endef
169
170 define KernelPackage/rt61-pci/install
171 $(INSTALL_DIR) $(1)/lib/firmware
172 $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt2?61*.bin $(1)/lib/firmware/
173 endef
174
175 define KernelPackage/rt73-usb/install
176 $(INSTALL_DIR) $(1)/lib/firmware
177 $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt73.bin $(1)/lib/firmware/
178 endef
179
180 $(eval $(call KernelPackage,rt2x00-lib))
181 $(eval $(call KernelPackage,rt2x00-pci))
182 $(eval $(call KernelPackage,rt2x00-usb))
183 $(eval $(call KernelPackage,rt2400-pci))
184 $(eval $(call KernelPackage,rt2500-pci))
185 $(eval $(call KernelPackage,rt2500-usb))
186 $(eval $(call KernelPackage,rt61-pci))
187 $(eval $(call KernelPackage,rt73-usb))
This page took 0.06558 seconds and 3 git commands to generate.