ndiswrapper and madwifi

This commit is contained in:
Kevin Mihelich 2011-02-06 13:38:16 -05:00
parent 34ce252963
commit dfc16895b9
7 changed files with 262 additions and 0 deletions

41
core/ndiswrapper/PKGBUILD Normal file
View file

@ -0,0 +1,41 @@
#$Id: PKGBUILD 105330 2011-01-07 20:49:19Z tpowa $
#Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# PlugApps: Kevin Mihelich <kevin@plugapps.com>
# - remove -ARCH from kernver
plugrel=1
pkgname=ndiswrapper
_kernver=2.6.37
pkgver=1.56
pkgrel=7
pkgdesc="Module for NDIS (Windows Network Drivers) drivers supplied by vendors. For stock arch 2.6 kernel."
license=('GPL')
arch=(i686 x86_64)
url="http://ndiswrapper.sourceforge.net"
install="ndiswrapper.install"
depends=("ndiswrapper-utils=$pkgver" 'kernel26>=2.6.37' 'kernel26<2.6.38')
makedepends=('kernel26-headers>=2.6.37' 'kernel26-headers<2.6.38')
source=(http://downloads.sourceforge.net/sourceforge/ndiswrapper/ndiswrapper-$pkgver.tar.gz
kernel-2.6.35.patch
kernel-2.6.36.patch)
build()
{
cd $srcdir/ndiswrapper-$pkgver/driver
patch -Np2 -i $startdir/kernel-2.6.35.patch
patch -Np2 -i $startdir/kernel-2.6.36.patch
make KVERS=$_kernver
make DESTDIR=$pkgdir KVERS=$_kernver install
rm $pkgdir/lib/modules/$_kernver/modules.* #wtf?
sed -i -e "s/KERNEL_VERSION='.*'/KERNEL_VERSION='${_kernver}'/" $startdir/*.install
# move it to correct kernel directory
mkdir -p $pkgdir/lib/modules/$_kernver/kernel/drivers/net/wireless/ndiswrapper
mv $pkgdir/lib/modules/$_kernver/misc/* $pkgdir/lib/modules/$_kernver/kernel/drivers/net/wireless/ndiswrapper/
rm -r $pkgdir/lib/modules/$_kernver/misc/
}
md5sums=('1431f7ed5f8e92e752d330bbb3aed333'
'0a03d613b1fd545a75c5dd1a7c2aaec4'
'cc16ed13449f17e90865df688b180b2c')

View file

@ -0,0 +1,98 @@
diff -uNr ndiswrapper-1.56.old/driver/usb.c ndiswrapper-1.56/driver/usb.c
--- ndiswrapper-1.56.old/driver/usb.c 2010-02-10 18:09:32.000000000 -0800
+++ ndiswrapper-1.56/driver/usb.c 2010-07-25 02:29:25.442145846 -0700
@@ -191,9 +191,15 @@
if (wrap_urb->flags & WRAP_URB_COPY_BUFFER) {
USBTRACE("freeing DMA buffer for URB: %p %p",
urb, urb->transfer_buffer);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
usb_buffer_free(IRP_WRAP_DEVICE(irp)->usb.udev,
+ urb->transfer_buffer_length,
+ urb->transfer_buffer, urb->transfer_dma);
+#else
+ usb_free_coherent(IRP_WRAP_DEVICE(irp)->usb.udev,
urb->transfer_buffer_length,
urb->transfer_buffer, urb->transfer_dma);
+#endif
}
if (urb->setup_packet)
kfree(urb->setup_packet);
@@ -303,9 +309,16 @@
|| PageHighMem(virt_to_page(buf))
#endif
)) {
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
urb->transfer_buffer =
- usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
+ usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
+ &urb->transfer_dma);
+#else
+ urb->transfer_buffer =
+ usb_alloc_coherent(wd->usb.udev, buf_len, alloc_flags,
&urb->transfer_dma);
+#endif
if (!urb->transfer_buffer) {
WARNING("couldn't allocate dma buf");
IoAcquireCancelSpinLock(&irp->cancel_irql);
diff -uNr ndiswrapper-1.56.old/driver/wrapndis.c ndiswrapper-1.56/driver/wrapndis.c
--- ndiswrapper-1.56.old/driver/wrapndis.c 2010-02-10 18:09:32.000000000 -0800
+++ ndiswrapper-1.56/driver/wrapndis.c 2010-07-25 02:06:13.184631757 -0700
@@ -936,6 +936,10 @@
EXIT2(return);
}
+#ifndef netdev_mc_count
+#define netdev_mc_count(net_dev) net_dev->mc_count
+#endif
+
static void set_multicast_list(struct ndis_device *wnd)
{
struct net_device *net_dev;
@@ -950,20 +954,26 @@
packet_filter |= NDIS_PACKET_TYPE_PROMISCUOUS |
NDIS_PACKET_TYPE_ALL_LOCAL;
} else if (net_dev->flags & IFF_ALLMULTI ||
- net_dev->mc_count > wnd->multicast_size) {
+ netdev_mc_count(net_dev) > wnd->multicast_size) {
packet_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
TRACE2("0x%08x", packet_filter);
- } else if (net_dev->mc_count > 0) {
+ } else if (netdev_mc_count(net_dev) > 0) {
int i, size;
char *buf;
+#ifndef netdev_for_each_mc_addr
struct dev_mc_list *mclist;
- size = min(wnd->multicast_size, net_dev->mc_count);
- TRACE2("%d, %d", wnd->multicast_size, net_dev->mc_count);
+#else
+ struct netdev_hw_addr *mclist;
+#endif
+
+ size = min(wnd->multicast_size, netdev_mc_count(net_dev));
+ TRACE2("%d, %d", wnd->multicast_size, netdev_mc_count(net_dev));
buf = kmalloc(size * ETH_ALEN, GFP_KERNEL);
if (!buf) {
WARNING("couldn't allocate memory");
EXIT2(return);
}
+#ifndef netdev_for_each_mc_addr
mclist = net_dev->mc_list;
for (i = 0; i < size && mclist; mclist = mclist->next) {
if (mclist->dmi_addrlen != ETH_ALEN)
@@ -972,6 +982,15 @@
TRACE2(MACSTRSEP, MAC2STR(mclist->dmi_addr));
i++;
}
+#else
+ i = 0;
+ netdev_for_each_mc_addr(mclist, net_dev){
+ memcpy(buf + i++ * ETH_ALEN,
+ mclist->addr, ETH_ALEN);
+ TRACE2(MACSTRSEP, MAC2STR(mclist->addr));
+
+ }
+#endif
res = mp_set(wnd, OID_802_3_MULTICAST_LIST, buf, i * ETH_ALEN);
if (res == NDIS_STATUS_SUCCESS && i > 0)
packet_filter |= NDIS_PACKET_TYPE_MULTICAST;

View file

@ -0,0 +1,27 @@
--- ndiswrapper-1.56.orig/driver/loader.c 2010-02-11 03:09:32.000000000 +0100
+++ ndiswrapper-1.56/driver/loader.c 2010-10-24 01:38:13.000000000 +0200
@@ -750,13 +750,13 @@
}
/* called with loader_mutex is down */
-static int wrapper_ioctl(struct inode *inode, struct file *file,
+static long wrapper_unlocked_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct load_driver *load_driver;
struct load_device load_device;
struct load_driver_file load_bin_file;
- int ret;
+ long ret;
void __user *addr = (void __user *)arg;
ENTER1("cmd: %u", cmd);
@@ -831,7 +831,7 @@
static struct file_operations wrapper_fops = {
.owner = THIS_MODULE,
- .ioctl = wrapper_ioctl,
+ .unlocked_ioctl = wrapper_unlocked_ioctl,
.release = wrapper_ioctl_release,
};

View file

@ -0,0 +1,23 @@
# arg 1: the new package version
post_install()
{
ndiswrapper -m
KERNEL_VERSION='2.6.37-ARCH'
depmod -ae $KERNEL_VERSION > /dev/null 2>&1
}
# arg 1: the new package version
# arg 2: the old package version
post_upgrade()
{
ndiswrapper -m
KERNEL_VERSION='2.6.37-ARCH'
depmod -ae $KERNEL_VERSION > /dev/null 2>&1
}
# arg 1: the old package version
post_remove()
{
KERNEL_VERSION='2.6.37-ARCH'
depmod -ae $KERNEL_VERSION > /dev/null 2>&1
}

45
extra/madwifi/PKGBUILD Normal file
View file

@ -0,0 +1,45 @@
# $Id: PKGBUILD 105333 2011-01-07 20:54:16Z tpowa $
# Originally by kleptophobiac <kleptophobiac@gmail.com>
# Modified by James Rayner for the repositories <iphitus@gmail.com>
# PlugApps: Kevin Mihelich <kevin@plugapps.com>
# - remove -ARCH from kernver
plugrel=1
_kernver=2.6.37
pkgname=madwifi
pkgver=0.9.4.4133
pkgrel=4
pkgdesc="Madwifi drivers for Atheros wireless chipsets. For stock arch 2.6 kernel"
arch=(i686 x86_64)
license=('GPL')
url="http://madwifi-project.org"
depends=('madwifi-utils' 'kernel26>=2.6.37' 'kernel26<2.6.38')
makedepends=('kernel26-headers>=2.6.37' 'kernel26-headers<2.6.38')
makedepends=('sharutils')
install=madwifi-ng.install
# subversion source: svn checkout http:/madwifi-project.org/svn/madwifi/trunk madwifi
source=(ftp://ftp.archlinux.org/other/madwifi/madwifi-${pkgver}.tar.bz2
#http://downloads.sourceforge.net/madwifi/madwifi-${pkgver}.tar.gz
)
build() {
[ "${CARCH}" = "i686" ] && export ARCH=i386
#cd $startdir/src/$pkgname-$pkgver
cd $startdir/src/$pkgname
sed -i -e 's/-Werror//g' Makefile.inc
make KERNELPATH=/lib/modules/$_kernver/build KERNELRELEASE=$_kernver modules|| return 1
make KERNELPATH=/lib/modules/$_kernver/build KERNELRELEASE=$_kernver modules \
DESTDIR=$startdir/pkg KERNELRELEASE=$_kernver install-modules
sed -i -e "s/KERNEL_VERSION='.*'/KERNEL_VERSION='${_kernver}'/" $startdir/*.install
# install to wireless kernel directory
mkdir -p $startdir/pkg/lib/modules/$_kernver/kernel/drivers/net/wireless/madwifi
mv $startdir/pkg/lib/modules/$_kernver/net/* $startdir/pkg/lib/modules/$_kernver/kernel/drivers/net/wireless/madwifi
rm -r $startdir/pkg/lib/modules/$_kernver/net/
}
md5sums=('ca3c3504d000e7b3d7063af46271c932')

View file

@ -0,0 +1,14 @@
--- ath/if_athvar.h~ 2009-06-13 09:38:53.000000000 +0200
+++ ath/if_athvar.h 2009-06-13 09:38:53.000000000 +0200
@@ -103,11 +103,6 @@
/*
* Guess how the interrupt handler should work.
*/
-#if !defined(IRQ_NONE)
-typedef void irqreturn_t;
-#define IRQ_NONE
-#define IRQ_HANDLED
-#endif /* !defined(IRQ_NONE) */
#ifndef SET_MODULE_OWNER
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)

View file

@ -0,0 +1,14 @@
post_install() {
KERNEL_VERSION='2.6.37-ARCH'
depmod -ae $KERNEL_VERSION > /dev/null 2>&1
}
post_upgrade() {
KERNEL_VERSION='2.6.37-ARCH'
depmod -ae $KERNEL_VERSION > /dev/null 2>&1
}
post_remove() {
KERNEL_VERSION='2.6.37-ARCH'
depmod -ae $KERNEL_VERSION > /dev/null 2>&1
}