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