Tuesday, April 22, 2008

NDIS Wrapper on Indiana

I've been setting up a laptop (a Dell D600, as it happens) so I thought I would try the Indiana preview on it.

Things have moved on a bit since I did this last - the onboard ethernet is recognised out of the box. But not the wireless. Off to try the NDIS Wrapper trick.

Now, I've got the Windows driver, which gives me the .inf and .sys files, and I downloaded the latest ndis package. Now to build it.

Unlike Solaris 10, where you type make and it works first time, Indiana has been cut down to fit onto the live CD and so you need some extra stuff. Several iterations of trial and error later, and the required steps are:

pfexec pkg install SUNWgcc
pfexec pkg install SUNWhea
pfexec pkg install SUNWflexlex
pfexec pkg install SUNWgm4


(Clearly, the dependency information for these packages is incomplete. Without gm4, flex gives an error message than couldn't ever be described as useful.)

With that, the "make ndiscvt" step works. Then you need to copy the .sys and .inf files into place and run

./ndiscvt -i ndis.inf -s ndis.sys -o ndis.h

if that fails with the error

ndiscvt: line 13: e: syntax error.

then the .inf file is in utf-16 format, so you need to

iconv -f utf-16 -t ascii path/to/bcmwl5.inf > ndis.inf

and run the ndiscvt step again.

Then it really is as simple as

make ndis
pfexec cp bcmndis /kernel/drv/bcmndis
make ndisapi
pfexec cp ndisapi /kernel/misc


Looking at "/usr/X11/bin/scanpci -v", we see

pci bus 0x0002 cardnum 0x03 function 0x00: vendor 0x14e4 device 0x4320
Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller
CardVendor 0x1028 card 0x0001 (Dell TrueMobile 1300 WLAN Mini-PCI Card)
STATUS 0x0010 COMMAND 0x0106
CLASS 0x02 0x80 0x00 REVISION 0x02
BIST 0x00 HEADER 0x00 LATENCY 0x20 CACHE 0x00
BASE0 0xfafee000 addr 0xfafee000 MEM
MAX_LAT 0x00 MIN_GNT 0x00 INT_PIN 0x01 INT_LINE 0x0b
BYTE_0 0x01 BYTE_1 0x00 BYTE_2 0xc2 BYTE_3 0xff


So we need to (see the numbers for vendor and device in the first line above)

add_drv -i '"pci14e4,4320"' bcmndis

and Yay!, it attaches.

11 comments:

Unknown said...

The flex dependency on gm4 was fixed by "778 flex dependency on gm4 missing", so manual work won't be needed with the next drop of the distro. - Stephen

Anonymous said...

Hello, I walked through your instructions but "make ndis" gives me an error.

../if_ndis.c:148:28: macro "DDI_DEFINE_STREAM_OPS" requires 10 arguments, but only 9 given
../if_ndis.c:147: warning: type defaults to `int' in declaration of `DDI_DEFINE_STREAM_OPS'
../if_ndis.c:147: warning: data definition has no type or storage class
../if_ndis.c:154: error: `ndis_dev_ops' undeclared here (not in a function)
../if_ndis.c:154: error: initializer element is not constant
../if_ndis.c:154: error: (near initialization for `ndis_modldrv.drv_dev_ops')
*** Error code 1
make: Fatal error: Command failed for target `ndis'

Can you make sense of this? Thanks in advance :)

Peter Tribble said...

Which versions of OpenSolaris and the ndis wrapper are you using?

The error looks like a mismatch, with an old version of the ndis wrapper. The driver framework has changed. If you've got OpenSolaris 2009.06, then you should be using v1.2.3 of the ndis wrapper. The ndis wrapper page should have all the right versions on it.

Chris said...

Hello again. Thanks for quick and accurate response. Apparently I installed ndiswrapper 1.1. After using v1.2.3 I completed all steps successfully. In the pdf document written by Carlton the interface is named bcmndis0. But my ifconfig don't recognize the interface (ifconfig bcmndis0 plumb)

In Device Driver Utility the hardware have been assigned the bcmndis driver as it should, right? Why haven't the interface been created?

Peter Tribble said...

You'll probably need to look through scanpci and do the add_drv step as well.

Assuming the driver attaches, then the ifconfig should work.

(Rather than guessing driver instance names you could try 'ifconfig -a plumb' and then 'ifconfig -a' which will plumb all interfaces and let you see what devices are there.)

Chris said...

Hmm.. I've already done add_drv. So this command gives me an error if I type it in more than one time.
#add_drv -i '"pci14e4,4312"' bcmndis
("pci14e4,4312") already in use as a driver or alias.

The relevant #scanpci output:
pci bus 0x0001 cardnum 0x00 function 0x00: vendor 0x14e4 device 0x4312
Broadcom Corporation BCM4312 802.11a/b/g

The ifconfig -a prints out two interfaces, lo0 and nge0. Can this lack of interface mean I choosen wrong MS driver?

Ren said...

I tried ./ndiscvt.c -i ndis.inf -s ndis.sys -o ndis.h
copy the files, but i can't because permission is denied and I am root acess.
how can I solve this?

Ren said...

Now, I have this

renato@renato:~/Downloads/ndis-0.1/amd64# add_drv -i '"pci14e4,4320"'
.make.state bcmwl564.sys inf-token.o ndis ndisapi subr_ntoskrnl.o
bcm43xx.cat err.o inf.o ndis.h ndiscvt subr_pe.o
bcm43xx64.cat inf-parse.c kern_ndis.o ndis.inf ndiscvt.o winx64_wrap.o
bcmwl5.inf inf-parse.o kern_windrv.o ndis.o subr_hal.o y.output
bcmwl5.sys inf-token.c Makefile ndis.sys subr_ndis.o y.tab.h
renato@renato:~/Downloads/ndis-0.1/amd64# add_drv -i '"pci14e4,4320"' bcmdis
Cannot find module (bcmdis).
renato@renato:~/Downloads/ndis-0.1/amd64#

Ren said...

I until to the end, but my driver is no attaching..


devfsadm -i bcmndis
devfsadm: driver failed to attach: bcmndis


can u help me?

Unknown said...

Hi
I have read everyting about the NDIS Wrapper.Everyone who writes about NDS Wrapper is Open Solaris user. I've installed Solaris 10 on my dell notebook.Can I use NDIS Wrapper to install my wifi driver on solaris 10.

Peter Tribble said...

ozzy: yes, if you look at my previous post (http://ptribble.blogspot.com/2007/10/solaris-on-laptop.html) then it works on Solaris 10 just fine.

You may need to use older versions of the ndis wrapper toolkit, though.