How to enable emachines m6805 wireless in FreeBSD

This is a shameless rip from this site, but I don't want the information to be lost, so I'm archiving it here. Thanks, dannyman, for this information. It was invaluable.

This is the second time I am going to use NDIS to allow FreeBSD to load the Windows drivers for a Dell laptop to access the built-in wireless. As this is my second time, it is good to make my own crib sheet of what I have to do, so I can do it even quicker next time, and because you, the reader, might find yourself here thanks to Google.

In both cases that I have done this I have been starting with FreeBSD 5.3. According to this crib sheet, you need to be fairly current with 5.x to do this. That crib sheet is also my main source of reference.

Step 1: Install NDIS code

cd /sys/modules/ndis && make && make install

Step 2: Figure out what hardware you have to support

This can be annoying . . . vendors ship different components in their machines, along with driver disks with all the possible variants of drivers, so you have to find the right driver. Unless you’re a big hardware weenie, you’re not sure, and pulling the right driver from the vendor can be hard.

If yours is a PCI device, you can ask pciconf to list what is on the system, and collate it with a vendor/device information database:

pciconf -lv

And here I see:

none6@pci2:4:0: class="0x028000" card=0x00031028 chip=0x432014e4 rev=0x03 hdr=0x00
vendor   = 'Broadcom Corporation'
device   = 'BCM4306 802.11b/g Wireless LAN Controller'
class    = network
Step 3: Go Get the Win2K/XP Driver

You have to pull this off the CDROM or a web site yourself. Bonus points when the driver is packaged in a self-extracting archive, then you have to borrow a Windows machine to get the .sys and .inf files. Joy!

In this case, Dell re-brands the Broadcom driver as a Dell driver, so I download the “Dell _Wireless (US) WLAN Network Adapter Card” from their web site, extract the files on my Windows box, and select the bcmwl5.inf and bcmwl5.sys …

Step 4: Copy those Drivers to /sys/modules/if_ndis

# ls *.inf *.sys
bcmwl5.inf      bcmwl5.sys      bcmwl5a.inf     bcmwlntp.sys
# cp bcmwl5.* /sys/modules/if_ndis
# ls /sys/modules/if_ndis
Makefile        bcmwl5.inf      bcmwl5.sys
# cd /sys/modules/if_ndis
Step 5: Magic

Take a deep breath, stretch your arms, think a happy though, and:

# ndiscvt -i bcmwl5.inf -s bcmwl5.sys -o ndis_driver_data.h
ndiscvt: line 13: e: syntax error.
ÿþ[#
Okay, don’t panic! I have seen this before. The ndiscvt works on ASCII files, but many a crafty driver has been distributing stuff in Unicode. If I look at bcmwl5.inf, I see:

# hd bcmwl5.inf | head -3
00000000  ff fe 3b 00 3b 00 0d 00  0a 00 3b 00 3b 00 20 00  |..;.;.....;.;. .|
00000010  62 00 63 00 6d 00 77 00  6c 00 35 00 2e 00 69 00  |b.c.m.w.l.5...i.|
00000020  6e 00 66 00 0d 00 0a 00  3b 00 3b 00 0d 00 0a 00  |n.f.....;.;.....|
For your edification, if a file looks like null-padded ASCII characters, then it is probably UTF-16.

# iconv -c -f utf-16 -t ascii bcmwl5.inf > bcmwl5.inf.ascii
# head -3 bcmwl5.inf.ascii
;;
;; bcmwl5.inf
;;
# ndiscvt -i bcmwl5.inf.ascii  -s bcmwl5.sys -o ndis_driver_data.h
Well, that was easy.

Step 6: Compile, Install

Basically:

make && make install

Load the module:

kldload ndis
kldload if_ndis

And, see if you have an Ethernet device:

# ifconfig ndis0
ndis0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
ether ff:ff:ff:ff:ff:ff
media: IEEE 802.11 Wireless Ethernet autoselect
status: no carrier
ssid ""
channel -1 authmode OPEN powersavemode OFF powersavesleep 100
rtsthreshold 2312 protmode CTS
wepmode OFF weptxkey 1
(You shouldn’t ever have that as a MAC address, unless you’re blogging sensitive data to the Internet. ;)

Loading NDIS at Boot

Once you are happy with your NDIS, add a line like this to /boot/loader.conf, which will cause the kernel to load your new module at boot time:

if_ndis_load="YES"
At this point, you’re ready to get back to your FreeBSD Handbook if you need further information.



Further notes on setting up wireless:

The wireless card needs to be configured for your ssid and wep settings. The following is from this page:

And you can turn on WEP on a client with this command:

# ifconfig wi0 inet 192.168.0.20 netmask 255.255.255.0 ssid my_net wepmode on wepkey 0x1234567890

Note that you should replace the 0x1234567890 with your wep key.


Although, for my network I want dhcp, and my card is ndis0. So I do the following:

ifconfig ndis0 ssid myssid wepmode on wepkey 0x123456789And stick that in a script and I can enable my wireless anytime I like.

Another note on getting DHCP working is to edit /etc/rc.conf and add the following line:

ifconfig_ndis0="DHCP"That will tell dhclient to look for DHCP servers for the wireless card.

 

If you get errors like:

 

kldstat
6    1 0xc3d33000 b000     if_ndis.ko
7    1 0xc3d3e000 13000    ndis.ko

Check the logs to see if the system is throwing any errors when it loads the NDIS module. Try using a different driver for the wireless card, see if you can get the original one that came from eMachines - see if that helps any. Also look in your logs and see if it's naming the device wlan0 or another similar name.

 



Back to Article Index

blog comments powered by Disqus