# Broadcom NDIS HOWTO



## blackhaz (Dec 30, 2012)

Here is a quick HOWTO get Broadcom BCM43xx based wireless interfaces working with Windows driver via NDIS, instead of using native bwn which may not be reliable with some devices. There are pieces of information available on how to get it working here and there, so I thought I'd assemble the knowledge at one place. This procedure works well on my Lenovo G550 laptop with the BCM4312 802.11b/g LP-PHY card, running FreeBSD 9.0-RELEASE-p3 (amd64). 

There are a few reasons I decided to use the NDIS driver instead of native bwn:  


bwn reporting Fatal DMA errors with my card and disabling DMA does not help
bwn is limited to the 11b mode only   
bwn floods console with various error messages like unsupported rate 0, etc.


*Step #1*: Download and extract the Windows driver. I've used the Broadcom_BCM43xx_5.100.235.19_win5x.exe file available at [WikiDrivers].

*Step #2*: Follow instructions in the FreeBSD Handbook in order to create the FreeBSD kernel module out of the Windows driver's binary and information files. The procedure is well described in the Handbook, so I will just mention that you will need to use bcmwl564.sys for amd64 systems, and include bcmwlcoi64.dll when ndisgen(8) asks for any supplemental files. 

*Step #3*: Copy the newly generated kernel module to the correct place: 
`# cp bcmwl564_sys.ko /boot/modules/`

*Step #4*: For some reason, loading the kernel module during the boot causes kernel panic for me, so just comment out old bwn modules and simply enable NDIS during the boot time at this step. In /boot/loader.conf:


```
ndis_load="YES"
if_ndis_load="YES"
```

*Step #5*: Edit /etc/rc.conf to add interface, here is my example to connect to my Deneb home router at startup:


```
network_interfaces="ndis0"
wlans_ndis0="wlan0"
ifconfig_wlan0="mode 11g ssid Deneb WPA DHCP"
```

Note: Deneb is the SSID of my home router. Replace with whatever SSID you want to associate with on boot. 

*Step #6*: Use kldload(8) to load the Broadcom kernel module during the boot in order to avoid kernel panic. For this, create /etc/start_if.ndis0 with the following contents:  


```
mod="bcmwl564_sys" 

if ! kldstat -n $mod >/dev/null 2>&1; then
	kldload $mod
fi
```

*Step #7*: For some reason dhclient(8) does not work with the wlan0 interface by default if I use the NDIS driver. This has been covered in a few topics on this forum and I do not see anybody resolving this so far, so I use a workaround. Add the following command to the /etc/rc.local:    

[CMD=""]dhclient wlan0[/CMD]

This will start dhclient(8) during the boot. Don't forget to configure your /etc/wpa_supplicant.conf normally like you would do with any other driver in case you are using WPA. I don't use any special flags. 

Here is ifconfig(8) showing wireless ndis0 and wlan0 interfaces after reboot: 


```
ndis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether 00:26:82:f1:6b:5e
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
	status: associated
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:26:82:f1:6b:5e
	inet 192.168.100.103 netmask 0xffffff00 broadcast 192.168.100.255
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet OFDM/54Mbps mode 11g
	status: associated
	ssid Deneb channel 11 (2462 MHz 11g) bssid 00:1e:e5:46:26:e1
	country US authmode WPA2/802.11i privacy OFF powersavemode CAM
	powersavesleep 100 txpower 0 bmiss 7 mcastrate 6 mgmtrate 6
	scanvalid 60 protmode CTS roaming MANUAL bintval 0
```

So far everything works perfectly, and with 11g!


----------



## blackhaz (Jan 14, 2013)

Update: if you experience random kernel panics like these: 


```
freebsd kernel: panic: IRQL_NOT_GREATER_THAN
freebsd kernel: cpuid = 1
freebsd kernel: KDB: stack backtrace:
freebsd kernel: #0 0xffffffff809208a6 at kdb_backtrace+0x66
freebsd kernel: #1 0xffffffff808ea8be at panic+0x1ce
freebsd kernel: #2 0xffffffff81654ff2 at KfLowerIrql+0x62
freebsd kernel: #3 0xffffffff8165994d at ntoskrnl_dpc_thread+0x14d
freebsd kernel: #4 0xffffffff808bb9ef at fork_exit+0x11f
```

Check the patch suggested here. After patching, you will need to rebuild your kernel after this, following instructions in the Handbook.


----------



## andersbo87 (Mar 6, 2013)

Thank you so much! I've had those problems myself, so I'll definitely try your howto.


----------



## aimeec1995 (Sep 12, 2017)

I realize this post is older, however this kernel panics me with "unregisted use of FPU in kernel"


----------

