# [SOLVED] -> ndiswrapper / wireless on a gentoo notebook

## stoker

hey -

  It took me a few days and some banging-of-my-head against a wall to get this to work, and I haven't been able to find anything concrete in the forums on how to do this (read: I found my solution elsewhere), so I figured I'd post my solution.  Hope it helps.

(keep in mind all this is from memory from the last couple days, so I'm not going to post lots of code here showing error messages and stuff, but I'll go through what I did to get it to work.  also, this is NOT A HOWTO!  these are just my notes on how I got through this problem; my solution may not work for you, but then again, it may.  good luck)

But first:

THE PROBLEM

I have a Dell Latitude D600 notebook system with a TrueMobile 1300 802.11b/g wireless card.  It doesn't "Just Work", and I didn't expect it to - but it definitely has to work, so this is the problem I'm addressing here.

THE SOLUTION

I have read that using ndiswrapper is the way to go for this driver, so that's what I used.  I have read in multiple places that ndiswrapper (well, more specifically the windows drivers ndiswrapper encapsulates) like to have 8K stacks, not 4K stacks as is the default in the gentoo kernel.  So, I went and recompiled my kernel with 8K stacks, which worked fine, then tried emerging ndiswrapper.

Edit: Change your kernel's 4K stacks to 8K by doing the following:

```
# cd /usr/src/linux

# make menuconfig

   (go to Kernel Hacking and deselect the 4K stack option)

# grep -i 4k .config

   (should indicate that CONFIG_4KSTACKS is not set)
```

At this time (while trying to "emerge ndiswrapper"), ndiswrapper gave me all kinds of pain, apparently because of my stack size change.  Then it struck me that changing something that "low level" in the kernel probably broke some of ndiswrapper's dependencies, so I did an "emerge -e ndiswrapper" (which included 109 packages), let it run overnight, and found to my pleasure that ndiswrapper had emerged successfully the following morning.

So, I've got ndiswrapper set up at this point.

I followed the instructions at http://ndiswrapper.sourceforge.net, which basically amounted to executing the following:

```
# lspci

  find your wireless card, and take note of the first string of numbers that precedes it.  mine read:

   0000:02:03.0 Network controller: Broadcom Corporation BCM4306 802.11b/g Wrieless LAN Controller (rev 02)

# lspci -n

  find the same code that was paired with your wireless card.  mine read:

  0000:02:03.0 Class 0280: 14e4:4320 (rev 02)
```

Now go to the ndiswrapper device list and find your card's drivers.  The string you want to search for is, in this example, 14e4:4320, because that's what's really important here.  I don't know if any driver that matches that code will work, because in my case there were a few, but one was for the Dell TrueMobile 1300 minipci card.  So I downloaded the drivers (named R90501.EXE) to my linux box and did the following:

```
# mkdir wlan

# mv R90501.EXE wlan

# cd wlan

# unzip R90501.EXE

# mkdir /lib/windrivers

# mv *.inf /lib/windrivers

# mv *.sys /lib/windrivers
```

Now you're prepared to install the drivers.  In my case, there were 4 files copied: bcmwl5.inf, bcmwl5.sys, bcmwl5a.inf, and bclwlntp.sys.  I'm going to use bcmwl5.inf to see if that works (which it did).  To do so, type the following:

```
# ndiswrapper -i /lib/windrivers/bcmwl5.inf

# modprobe ndiswrapper

```

If ndiswrapper comes back with all kinds of funny conversion warnings after installing the driver, don't sweat it, it didn't seem to affect anything on my end.

Now, check dmesg for your wlan status.  you *should* get something like this at the tail end:

```
ndiswrapper version 1.1 loaded (preempt=yes,smp=no)

ndiswrapper: driver bcmwl5 (Broadcom,11/27/2004, 3.100.35.0) loaded

PCI: Found IRQ for device 00:02:03.0

PCI: Sharing IRQ 11 with 0000:00:1f.5

PCI: Sharing IRQ 11 with 0000:00:1f.6

ndiswrapper: using irq 11

wlan0: ndiswrapper ethernet device <macid> using driver bcmwl5, configuration file 14E4:4320.5.conf

wlan0: encryption modes supported: WEB, WPA with TKIP, WPA with AES/CCMP
```

IF YOU GET AN ERROR that looks like this in dmesg:

```
ndiswrapper: (ndiswrapper_add_one_pci_dev:188): Windows driver couldn't initialize the device (C0000001)

ndiswrapper: probe of 0000:02:03.0 failed with error -22
```

TRY THE FOLLOWING: (this error caused me headaches for two days).

Add the string "acpi=noirq" to your kernel options when you boot.  I found that as soon as I added that string to my kernel options, everything Just Worked.  Awesome.

And finally, you might want to do the following once you've got it working correctly:

```

# echo ndiswrapper >> /etc/modules.autoload.d/kernel-2.6

# cd /etc/conf.d

# nano -w net

   add the following: iface_wlan0="dhcp"  (change this to suit your needs)

# cd /etc/init.d

# cp net.eth0 net.wlan0

# rc-update add net.wlan0 default
```

this will set it up so that your wireless connection is enabled and started at boot time.

so yeah, hope this helps save a few of you some of the same headaches I ran into.

take it easy -

stoke

----------

## cgmd

stoker...

Very timely post... thanks.

I'm new at this and trying to follow, but stuck at not being able to unzip my *.exe driver. Do I need a special utility for this??

Thanks...

----------

## stoker

 *cgmd wrote:*   

> stoker...
> 
> Very timely post... thanks.
> 
> I'm new at this and trying to follow, but stuck at not being able to unzip my *.exe driver. Do I need a special utility for this??
> ...

 

you shouldn't - that is, unzip (yes, unzip is actually the name of the program) should be in the base install, I think.

if you type:

```
# unzip DRIVERS.EXE
```

and it comes back complaining that "unzip: command not found" or something along those lines, then just emerge it - it's part of app-arch.

honestly, I didn't realize you could unzip a self-extracting EXE either until I read a post somewhere else on the 'net that indicated that you can.  learn something new every day, eh?

good luck, let me know if you get it working.

----------

## cgmd

stoker...

Thanks... I didn't have unzip emerged!

Gradually trying to work through this...

My two files transferred to /lib/windrivers/ are bcmwl5.sys and lsbcmnds.inf.

ndiswrapper accepts lsbcmnds.inf, but declares bcmwl5.sys "invalid"

My dmesg output is not what I want:

```
ndiswrapper: version magic '2.6.11-gentoo-r9 preempt PENTIUM4 gcc-3.3' should be '2.6.11-gentoo-r9 preempt PENTIUM4 4KSTACKS gcc-3.3'

ndiswrapper: version magic '2.6.11-gentoo-r9 preempt PENTIUM4 gcc-3.3' should be '2.6.11-gentoo-r9 preempt PENTIUM4 4KSTACKS gcc-3.3'

```

Any thoughts??

Thanks...

----------

## stoker

 *cgmd wrote:*   

> stoker...
> 
> My dmesg output is not what I want:
> 
> ```
> ...

 

actually, yes.  I ran into this exact problem as well.  note how it says '2.6.11-gentoo-r9 preempt PENTIUM4 gcc-3.3' should be '2.6.11-gentoo-r9 preempt PENTIUM4 4KSTACKS gcc-3.3'.  This indicated to me that the problem was with the new kernel stack size.  although I didn't give the exact error messages, I think I alluded to it ... from my original post:

 *I wrote:*   

> At this time (while trying to "emerge ndiswrapper"), ndiswrapper gave me all kinds of pain, apparently because of my stack size change. Then it struck me that changing something that "low level" in the kernel probably broke some of ndiswrapper's dependencies, so I did an "emerge -e ndiswrapper" (which included 109 packages), let it run overnight, and found to my pleasure that ndiswrapper had emerged successfully the following morning. 

 

so try doing an "emerge -e ndiswrapper" to re-emerge all of ndiswrapper's dependencies and see if that works.  be sure to have something else to occupy your time for a while, 'cause it takes a few hours; when I did this, portage wanted to emerge 109 packages, including XOrg.  so yeah.  changing your stack size apparently affects a lot of stuff.

stoker

----------

## cgmd

stoker...

OK... I'll give that a try!

Thanks... I'll report back...

----------

## cgmd

I am back, but still with problems...

After the "emerge -e ndiswrapper", I still get the same dmesg error  as above...

Also, I'm not getting a clean "modprobe ndiswrapper":

```
#modprobe ndiswrapper

FATAL: Error inserting ndiswrapper (/lib/modules/2.6.11-gentoo-r9/misc/ndiswrapper.ko):  Invalid module format
```

I'm not sure what is meant by "Invalid module format"?? :Confused: 

Everything else appears smooth up until that modprobe step, and I guess that affects the dmesg output.

Any idea how to troubleshoot???

Thanks, again...

----------

## stoker

 *cgmd wrote:*   

> I am back, but still with problems...
> 
> After the "emerge -e ndiswrapper", I still get the same dmesg error  as above...
> 
> Also, I'm not getting a clean "modprobe ndiswrapper":
> ...

 

hm, running out of ideas but my bag's not empty yet  :Wink: 

before you do anything else, if you haven't rebooted your system since recompiling with 4KSTACKS, you should try that.  trying to run software that's been compiled for 8K stacks over a kernel that's been compiled for 4K stacks might not work so well.

now, the error with emerging ndiswrapper with -e: I'm not sure how to fix this if you followed my directions and came up with different results.  does the error you've mentioned occur while emerging ndiswrapper, or does ndiswrapper emerge fine, but just causes those error messages when you try to do anything with it?

secondly, about the invalid module format when you modprobe ndiswrapper.  I've only seen that kind of message when there's an incompatibility between the module and your kernel.  again, rebooting your system if you haven't reloaded the newest 8K stack kernel could make a difference here, I think.

oh, here's a thought... do you have the following config options set in your kernel?

```
CONFIG_NET_RADIO=y

CONFIG_NET_WIRELESS=y
```

you need to have those enabled for ndiswrapper to work.  otherwise I don't think ndiswrapper will have anything to hook into.

also, here's some other useful info I found at http://ndiswrapper.sourceforge.net/phpwiki/index.php/FAQ :

 *ndiswrapper.sourceforge.net wrote:*   

> 
> 
> ! When I run "modprobe ndiswrapper", I get "Invalid module format" error. What do I do?
> 
> This happens for couple of reasons. First, the kernel running should have been compiled from the same sources as ndiswrapper is. Secondly, the compiler used for compiling kernel should be same as the one used to compile ndiswrapper. To make sure these conditions are met, run "=cat /proc/version=" and "=modinfo ndiswrapper=" and make sure that they match (both compiler and kernel versions). If they don't match, you need to recompile either ndiswrapper or kernel or both. One sure way to get it right is to make sure that you have proper kernel headers installed: check that (type exactly as below)
> ...

 

anyway, I'll look around a bit more.  if you're still having problems, please make available your kernel config, and relevant messages from dmesg, /var/log/messages, lspci, etc.  it'll help with debugging.

stoker

----------

## stoker

incidentally, it cannot be underestimated the usefulness of Google when it comes to determining the causes of errors.  for example, if you run into an issue with ndiswrapper causing an "Invalid module format" error, try doing a Google search for:

```
ndiswrapper "invalid module format"
```

and see what comes back.

some useful sites (in addition to forums.gentoo.com of course  :Wink: ) are:

http://ndiswrapper.sourceforge.net/phpwiki/index.php/FAQ

http://ndiswrapper.sourceforge.net/phpwiki/index.php/Installation

http://ndiswrapper.sourceforge.net/phpwiki/index.php/Troubleshooting

http://gentoo-wiki.com/HOWTO_Wireless_Configuration_and_Startup

may seem obvious, but sometimes it's the obvious things we overlook.  that whole forest / trees thing.

----------

## cgmd

stoker...

After 2 days of working your suggestions (most of the time being spent with the 'modprobe ndiswrapper' problem), I got over the modprobe hurdle with a 'make install'  followed by 'emerge ndiswrapper'. The rest of your outline went smoothly, and I now have a functioning wlan!!  :Laughing: 

Just want to take this opportunity to thank you for your suggested protocol and help...

----------

## MdaG

I've got a DELL D800 with the same wlan card as you, but I haven't gotten it to work yet. Now I have an idea what to do. Thanks!

I've documented some of my own issues here.

Notice that the wlan topic isn't there "yet".  :Wink: 

----------

## Boodrow

Stoker...

That was an excellent writeup!!  That worked for my XPS Wlan0 install. 

One thing that I did figure out.  I have the 802.11 a/b/g wireless card, not the standard 802.11 b/g card.  So I had a hard time on the windows side of the house trying to get the correct driver.  

I used the driver I *thought* was the right one and used ndiswrapper to install the driver.  When I did a "ndiswrapper -l" it showed "driver present hardware present".

Now when I did a modprobe ndiswrapper and then did a dmesg I got the corresponding error:

"ndiswrapper: (ndiswrapper_add_one_pci_dev:188): Windows driver couldn't initialize the device (C0000001) 

ndiswrapper: probe of 0000:02:03.0 failed with error -22"

I added the noirq statement into my kernel and got the same error again.  Thats when I decided to change to a different driver.  Once I did that, WHALLA! it worked. 

Just some food for thought... Make sure you have the correct driver loaded too  :Smile: 

B.

----------

