[oi-dev] Broadcom BCM4312 wireless on OpenIndiana 64-bit

Jim Klimov jimklimov at cos.ru
Sun Mar 17 10:42:22 UTC 2013


On 2013-03-17 08:54, Jean-Pierre wrote:
> Hi again,
>
> Jim Klimov wrote:
>> On 2013-03-17 01:06, Jim Klimov wrote:
>>> Hello Jean-Pierre,
>>>
>>> I tried your fix and it seems mostly correct - I applied the patch to
>>> a freshly untarred source that you published a couple of days ago, and
>>> the resulting ndiscvt binary built under OI 151a7 succeeded to make a
>>> driver.s file. However, it doesn't work fully, so the compilation of
>>> "ndis" target failed. Build log attached.
>>
>>
>> Apparently, the code which created the assembly text forgot to add
>> newlines before leaq instructions. I added them manually, and the
>
> Good point.
>
>> overall build fails at a bit later step now:
>>
>> /opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER driver.o
>> ERROR: ctfconvert: file does not contain dwarf type data (try compiling
>> with -g)
>> Removing driver.o
>
> I do no know what this ctfconvert is about (probably related
> to debugging), but I am quite sure this is useless (I do not
> even have this tool). Likewise the -g dumps symbols into the
> object file, only used for debugging, but this is probably
> meaningless for an assembler source. Maybe ctfconvert extracts
> the symbols created by -g and puts them in a specific file.
>
> I cannot help you on such matters.


Ok, this helped move forward - I commented away the line for ctfconvert
in the Makefile for driver.o, and added "-gdwarf-2" to the CFLAGS for
ndiscvt, because ctfconvert of its component objects also complained
without it:

$(NDISCVT) :    CFLAGS = -I../include -O -m64 -DLINKEDIMAGE -gdwarf-2

Now the single gmake command (with an interruption to add manually the
line-breaks before leaq, which I hope you'd automate by release time)
builds the project from scratch with Makefile, ndis.inf and ndis.sys
being the only files in the build-dir (amd64), up to ndisapi (the "all"
target) with a few warnings repeated for a number of files - probably
stemming from some same header file:

...
/usr/sfw/bin/gcc -fident -finline -fno-inline-functions -fno-builtin 
-fno-asm -nodefaultlibs -D__sun -O2 -gdwarf-2 -fno-strict-aliasing 
-fno-unit-at-a-time -fno-optimize-sibling-calls -m64 -mtune=opteron 
-Wall -Wno-unknown-pragmas -Wno-missing-braces -Wno-sign-compare 
-Wno-parentheses -Wno-uninitialized -Wno-implicit-function-declaration 
-Wno-unused -Wno-trigraphs -Wno-char-subscripts -Wno-switch 
-ffreestanding -mcmodel=kernel -mno-red-zone -D_KERNEL -DLINKEDIMAGE 
-D__amd64__ -D__amd64 -I../include -I. -c ../kern_ndis.c -o kern_ndis.o
In file included from ../kern_ndis.c:74:
../include/ntoskrnl_var.h:354: warning: "struct ndis_softc" declared 
inside parameter list
../include/ntoskrnl_var.h:354: warning: its scope is only this 
definition or declaration, which is probably not what you want
../include/ntoskrnl_var.h:354: warning: "struct irp" declared inside 
parameter list
../include/ntoskrnl_var.h:354: warning: "struct device_object" declared 
inside parameter list
../kern_ndis.c:651: warning: static declaration of 'strdup' follows 
non-static declaration
/usr/include/sys/sunddi.h:426: warning: previous declaration of 'strdup' 
was here
/usr/sfw/bin/gcc -fident -finline -fno-inline-functions -fno-builtin 
-fno-asm -nodefaultlibs -D__sun -O2 -gdwarf-2 -fno-strict-aliasing 
-fno-unit-at-a-time -fno-optimize-sibling-calls -m64 -mtune=opteron 
-Wall -Wno-unknown-pragmas -Wno-missing-braces -Wno-sign-compare 
-Wno-parentheses -Wno-uninitialized -Wno-implicit-function-declaration 
-Wno-unused -Wno-trigraphs -Wno-char-subscripts -Wno-switch 
-ffreestanding -mcmodel=kernel -mno-red-zone -D_KERNEL -DLINKEDIMAGE 
-D__amd64__ -D__amd64 -I../include -I. -c ../kern_windrv.c -o kern_windrv.o
In file included from ../kern_windrv.c:73:
../include/ntoskrnl_var.h:354: warning: "struct ndis_softc" declared 
inside parameter list
../include/ntoskrnl_var.h:354: warning: its scope is only this 
definition or declaration, which is probably not what you want
../include/ntoskrnl_var.h:354: warning: "struct irp" declared inside 
parameter list
../include/ntoskrnl_var.h:354: warning: "struct device_object" declared 
inside parameter list
/usr/sfw/bin/gcc -c -O2 -fno-inline -Wall -ffreestanding -U_NO_LONGLONG 
-D_KERNEL  -mcmodel=kernel -mno-red-zone -fno-strict-aliasing -m64 
-mtune=opteron -I../ ../winx64_wrap.S -o winx64_wrap.o
/opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER subr_ndis.o
/opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER subr_ntoskrnl.o
/opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER subr_pe.o
/opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER subr_hal.o
/opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER kern_ndis.o
/opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER kern_windrv.o
/usr/ccs/bin/ld -r -o ndisapi subr_ndis.o subr_ntoskrnl.o subr_pe.o 
subr_hal.o kern_ndis.o kern_windrv.o winx64_wrap.o
/opt/onbld/bin/i386/ctfmerge -l NDISWRAPPER -o ndisapi subr_ndis.o 
subr_ntoskrnl.o subr_pe.o subr_hal.o kern_ndis.o kern_windrv.o winx64_wrap.o

It has nominally succeeded for 64-bit variants of ndis5 and ndis6
drivers from varied vendors of laptops with broadcom wifi chips.

Unfortunately, this was built on another host than my laptop and I must
run now, so I won't test the resulting driver with the hardware until
some time later. Intrigue and suspense grows ;)

PS: I automated the "leaq" problem with sed/tr in the Makefile like
this, so the whole build from scratch happens by one command:

ndis.h driver.s : ndiscvt
         ./ndiscvt -i ndis.inf -s ndis.sys -o ndis.h -a driver.s
         rm -f driver.sx; mv -f driver.s driver.sx
         cat driver.sx | sed 's/^\( .*\)\( leaq .*\)$/\1=\2/' | tr '=' 
'\n' > driver.s
         rm -f driver.sx

HTH,
//Jim Klimov





More information about the oi-dev mailing list