Using ndisgen to create loadable module w/ broadcom on Compaq R3000z

Jung-uk Kim jkim at
Wed Jul 20 15:54:05 GMT 2005

On Wednesday 20 July 2005 09:17 am, Kelly Black wrote:
> Hello,
> I have a compaq R300z (okay, I'm sorry already!)  running
> freebsd-amd64 current. I recently tried to use ndisulator for the
> built in broadcom wireless and used the 64 bit windows drivers to
> try to generate a loadable module for the wireless device. I have
> had some trouble generating the loadable module, though. I last
> updated world and the kernel on Monday.
> I've tried searching the freebsd-amd64 and freebsd-current lists,
> and I've tried to search using google. So far I can't find anything
> to help. Has anyone managed to get this beast working?  Any help
> would be appreciated. I will paste an overview of what I've tried
> below:
> Here is the device info:
> root at localhost# pciconf -lvvv
> none3 at pci2:2:0: class=0x028000 card=0x12f4103c chip=0x432014e4
> rev=0x03 hdr=0x00 vendor   = 'Broadcom Corporation'
>     device   = 'BCM4306 802.11b/g Wireless LAN Controller'
> Copies of the driver files that I am using can be found at
> This is a 64 bit driver, and the inf file was converted to ascii
> using iconv.
> Here is the message I get when I use ndisgen:
> Compiling stub... done.
> Linking loadable kernel module... /usr/bin/ld: windrv_stub.o:
> relocation R_X86_64_32S can not be used when making a shared
> object; recompile with -fPIC windrv_stub.o: could not read symbols:
> Bad value linking failed. Exiting.
> I read through the ndisgen script to try to figure out what it was
> doing. I then did this (I added -fPIC):
> /usr/bin/cc -D_KERNEL -DDRV_DATA_START=BCMWL564_SYS_drv_data_start
> -I. /usr/share/misc/windrv_stub.c -data -symbolic  -c -o
> windrv_stub.o -fPIC
> /usr/bin/ld -Bshareable -d -warn-common -o BCMWL564_SYS.ko
> windrv_stub.o windrv.o
> /usr/bin/ld -r -d -warn-common -o BCMWL564_SYS.o windrv_stub.o
> windrv.o
> (The files windrv_stub.o and others were created when ndisgen
> called ndiscvt so I just left them alone.)
> When I do this the file compiles and links with no error messages.
> It creates a file called BCMWL564_SYS.ko. When I try to load the
> file using kldload I get these messages:
> kldload: can't load /tmp/broadcom/BCMWL564_SYS.ko: Exec format
> error
> and from the console window:
> kldload: Unsupported file type
> kldload: unexpected relocation type 7
> link_elf: symbol windrv_load undefined
> Any ideas?

Try the attached patch.  I have been using this for months without a 
problem. ;-)  In fact, I sent it to Bill but he didn't reply.


Jung-uk Kim

> Sincerely,
> Kel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndisgen.diff
Type: text/x-diff
Size: 10152 bytes
Desc: not available
Url :

More information about the freebsd-amd64 mailing list