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