You are not logged in.

#1 2012-04-08 10:04:55

solstice
Member
Registered: 2006-10-27
Posts: 240
Website

temporary fix for ndiswrapper on linux 3.3 on i686

Hi,
You may have noticed that there is no package of ndiswrapper for linux 3.3 yet. The maintainer is working on it.

So in the mean time, you can to do it yourself. Here is how I have done it:
Use this patch to ndiwrapper sources (found on ndiswrapper bugtracker):

--- driver/ndis.c	2011-12-31 21:30:16.000000000 +0100
+++ driver/ndis.c.new	2012-04-08 11:14:16.746614153 +0200
@@ -2654,9 +2654,15 @@
 	(ULONG *idle, ULONG *kernel_user, ULONG *index)
 {
 	int cpu = smp_processor_id();
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+	*idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
+	*kernel_user = kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM] +
+	 kcpustat_cpu(cpu).cpustat[CPUTIME_USER];
+#else
 	*idle = kstat_cpu(cpu).cpustat.idle;
 	*kernel_user = kstat_cpu(cpu).cpustat.system +
 		kstat_cpu(cpu).cpustat.user;
+#endif
 	*index = cpu;
 }
 
--- driver/wrapndis.c	2011-12-31 21:30:16.000000000 +0100
+++ driver/wrapndis.c.new	2012-04-08 11:13:00.574116936 +0200
@@ -1684,6 +1684,7 @@
 		return 0;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
 static u32 ndis_get_rx_csum(struct net_device *dev)
 {
 	struct ndis_device *wnd = netdev_priv(dev);
@@ -1735,18 +1736,21 @@
 	else
 		return -EOPNOTSUPP;
 }
+#endif
 
 static struct ethtool_ops ndis_ethtool_ops = {
 	.get_drvinfo	= ndis_get_drvinfo,
 	.get_link	= ndis_get_link,
 	.get_wol	= ndis_get_wol,
 	.set_wol	= ndis_set_wol,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
 	.get_tx_csum	= ndis_get_tx_csum,
 	.get_rx_csum	= ndis_get_rx_csum,
 	.set_tx_csum	= ndis_set_tx_csum,
 	.set_rx_csum	= ndis_set_rx_csum,
 	.get_sg		= ndis_get_sg,
 	.set_sg		= ndis_set_sg,
+#endif
 };
 
 static int notifier_event(struct notifier_block *notifier, unsigned long event,

http://paste.pocoo.org/show/577872/

the new PKGBUILD

# $Id: PKGBUILD 67349 2012-03-09 16:43:42Z ttopper $
# Maintainer:  Thorsten Töpper <atsutane-tu@freethoughts.de>
# Contributor: SpepS <dreamspepser at yahoo dot it>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>

_extramodules=extramodules-3.3-ARCH
_kver="$(cat /lib/modules/${_extramodules}/version)"
pkgname=ndiswrapper
pkgver=1.57
pkgrel=7
pkgdesc="Module for NDIS (Windows Network Drivers) drivers supplied by vendors."
license=('GPL')
arch=('i686' 'x86_64')
url="http://ndiswrapper.sourceforge.net"
install=ndiswrapper.install
depends=('linux>=3.3' 'linux<3.4' 'wireless_tools' 'perl')
makedepends=('linux-headers')
provides=("$pkgname-utils" "$pkgname-bin")
replaces=("$pkgname-utils" "$pkgname-bin")
source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz" linux33.patch)
options=('!strip')
md5sums=('7a401dc540938bf07893c67f418b6152' '061e59a934ca3ae4be55a86d86b2c1f5')

build() {
  cd "$srcdir/$pkgname-$pkgver"

  # modinfo path fix
  sed -i "/modinfo/s/s/usr\//" driver/Makefile
  patch -i $srcdir/linux33.patch -N -p0

  make KVERS=$_kver
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  make INST_DIR="lib/modules/$_extramodules" \
    KVERS=$_kver DESTDIR="$pkgdir/" install

  gzip "$pkgdir/lib/modules/$_extramodules/$pkgname.ko"
}

# vim:set ts=2 sw=2 et:

http://paste.pocoo.org/show/577873/

you need to modify ndiswrapper.install to use EXTRAMODULES='extramodules-3.3-ARCH'

One extra step is needed for i686 users. One need to patch the linux kernel headers that seems to have a bug to allow ndiwrapper to compile
So you can make your own package with the patch, or simply patch it on your system. That's the "hack" I used

the patch

--- /usr/src/linux-3.3.2-1-ARCH/arch/x86/include/asm/cmpxchg.h	2012-03-19 00:15:34.000000000 +0100
+++ /usr/src/linux-3.3.2-1-ARCH/arch/x86/include/asm/cmpxchg.h	2012-04-16 19:25:44.000000000 +0200
@@ -43,7 +43,7 @@
 		switch (sizeof(*(ptr))) {				\
 		case __X86_CASE_B:					\
 			asm volatile (lock #op "b %b0, %1\n"		\
-				      : "+r" (__ret), "+m" (*(ptr))	\
+				      : "+q" (__ret), "+m" (*(ptr))	\
 				      : : "memory", "cc");		\
 			break;						\
 		case __X86_CASE_W:					\
@@ -173,7 +173,7 @@
 		switch (sizeof(*(ptr))) {				\
 		case __X86_CASE_B:					\
 			asm volatile (lock "addb %b1, %0\n"		\
-				      : "+m" (*(ptr)) : "ri" (inc)	\
+				      : "+m" (*(ptr)) : "qi" (inc)	\
 				      : "memory", "cc");		\
 			break;						\
 		case __X86_CASE_W:					\

http://paste.pocoo.org/show/582503/
the first part of the patch was found in ndiswrapper bugtracker, the second part of the patch was found on the LKML

Last edited by solstice (2012-04-16 17:38:35)

Offline

#2 2012-04-18 07:33:38

JohnnyAce
Member
Registered: 2009-08-09
Posts: 22

Re: temporary fix for ndiswrapper on linux 3.3 on i686

Now that linux-headers is updated to version 3.3.2-1. Do I still need to use that header patch? Also any news from maintainer about official ndiswrapper-package for i686 architecture, seems that x86_64 users already got their updated package.

Offline

#3 2012-04-18 08:39:28

solstice
Member
Registered: 2006-10-27
Posts: 240
Website

Re: temporary fix for ndiswrapper on linux 3.3 on i686

You could see I have updated the patch to work against linux-headers-3.3.2-1. May be, I should have advertized it.

The maintainer has updated the x86_64 package and must have talked with the maintainer of linux-headers package to include the patch. I guess he has refused to do so ? I had no news from the maintainer after the initial contact, reply phase. I email him right now.

I am surprise this does not cause much more attention or reaction. noone is using ndiswrapper ? or is it i686 + ndiswrapper that is rarre nowadays ?

Offline

#4 2012-04-18 20:42:51

simkin
Member
Registered: 2009-09-15
Posts: 2

Re: temporary fix for ndiswrapper on linux 3.3 on i686

solstice wrote:

I am surprise this does not cause much more attention or reaction. noone is using ndiswrapper ? or is it i686 + ndiswrapper that is rarre nowadays ?

I was just putting off the upgrade tongue
Worked fine here on i686. Thanks wink

Offline

#5 2012-04-24 13:59:56

vas
Member
Registered: 2012-04-23
Posts: 1

Re: temporary fix for ndiswrapper on linux 3.3 on i686

Hi,
I am a beginner in Arch and I have problems. This are the things I did:

  1. Downloaded ndiswrapper 1.57 source from sourceforge.

  2. Extracted this .tar.gz archive into my home folder.

  3. Saved first patch from the topic to file ndis.patch in ndiswrapper source folder.

  4. Run terminal and executed:

    cd ~/ndiswrapper-1.57/
    patch -p0 <ndis.patch

    Two files were sucesfully patched.

  5. Executed:

    sudo make uninstall

    and here I've got a problem:

    rm -f /usr/share/man/man8/ndiswrapper.8
    rm -f /usr/share/man/man8/loadndisdriver.8
    make -C driver uninstall
    make[1]: Entering directory `/home/vas/ndiswrapper-1.57/driver'
    Makefile:36: *** Cannot find kernel version in /lib/modules/3.3.2-1-ARCH/build, is it configured?.  Stop.
    make[1]: Leaving directory `/home/vas/ndiswrapper-1.57/driver'
    make: *** [uninstall] Error 2

Solved by installing ndiswrapper from community repo.

Last edited by vas (2012-04-26 17:35:24)

Offline

#6 2012-04-24 19:57:45

caesar753
Member
Registered: 2010-09-08
Posts: 33

Re: temporary fix for ndiswrapper on linux 3.3 on i686

same error on my PentiumIV! i think there has yet been opened a bug https://bugs.archlinux.org/task/29493, but nobody cares! I hope the mantainer will do something ...

Offline

#7 2012-04-25 05:36:02

JohnnyAce
Member
Registered: 2009-08-09
Posts: 22

Re: temporary fix for ndiswrapper on linux 3.3 on i686

caesar753 wrote:

same error on my PentiumIV! i think there has yet been opened a bug https://bugs.archlinux.org/task/29493, but nobody cares! I hope the mantainer will do something ...

There is already a new ndiswrapper on a testing repos http://www.archlinux.org/packages/commu … iswrapper/, and I think it should fix these problems. Now you have to just wait it to come to the community repos.

Offline

#8 2012-04-25 09:20:32

solstice
Member
Registered: 2006-10-27
Posts: 240
Website

Re: temporary fix for ndiswrapper on linux 3.3 on i686

@vas: you should look at how to make package on archlinux, using PKGBUILD, makepkg and AUR.
Look in the wiki for any help: https://wiki.archlinux.org

Offline

Board footer

Powered by FluxBB