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

Jim Klimov jimklimov at cos.ru
Sun Mar 17 00:06:15 UTC 2013


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.

   There were a few more quirks along the way:

1) Not all headers are provided in your tarball's include/ subdir (nor
in ndis-1.2.1, even though they are referenced in the README).
The 1.2.6 source includes several more headers (like include/sys/*)
that are needed.

2) The Makefile seems like those from other ndis versions I've tried,
so I don't know why it did not define CFLAGS properly. I changed ":="
to ":" in those per-target assignments, and things began working.

3) A flag was needed for ndiscvt to build with "-m64", added to Makefile.

4) For a parameter-less invokation of gmake to build the project, as
illustrated by my build log, the "all" target needed to be moved up,
so that it is first and default.

5) Reference to "../driver.s" in the "ndis" build had to be fixed to
current dir.

Fixed Makefile is also attached.

I'll try to rinse and repeat with other bcmwl5 releases for now...

//Jim
-------------- next part --------------
/home/admin/ndis/ndis.1.3.beta/amd64# gmake 
/usr/sfw/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -c ../err.c -o err.o
/usr/sfw/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -c ../inf.c -o inf.o
/usr/sfw/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -c ../ndiscvt.c -o ndiscvt.o
/usr/sfw/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -c ../subr_pe.c -o subr_pe.o
/usr/ccs/bin/yacc -d -v ../inf-parse.y

conflicts: 1 reduce/reduce
mv y.tab.c inf-parse.c
/usr/sfw/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -c inf-parse.c -o inf-parse.o
rm -f inf-token.c
/usr/sfw/bin/flex -t ../inf-token.l > inf-token.c
/usr/sfw/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -c inf-token.c -o inf-token.o
/usr/sfw/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -c ../ndislink.c -o ndislink.o
/usr/sfw/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -o ndiscvt err.o inf.o ndiscvt.o subr_pe.o inf-token.o inf-parse.o ndislink.o
./ndiscvt -i ndis.inf -s ndis.sys -o ndis.h -a driver.s
1785 quadword relocations
56 accesses to variables
2 accesses to system data
71 uses of xmm registers
63 imported functions
$Windows NT$ 
/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. -I/usr/include -c ../if_ndis.c -o ndis.o
In file included from ../if_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
/opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER ndis.o
/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. -I/usr/include -c ./driver.s -o driver.o
./driver.s: Assembler messages:
./driver.s:168975: Error: junk `leaq xmmback36(%rip)' after register
./driver.s:169239: Error: junk `leaq xmmback3(%rip)' after register
gmake: *** [ndis] Error 1

-------------- next part --------------
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 3. Neither the names of the above-listed copyright holders nor the
#    names of any contributors may be be used to endorse or promote
#    products derived from this software without specific prior written
#    permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
# HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

.KEEP_STATE:

include ../Makefile.com

CVTOBJS = $(CVTSRCS:%.c=%.o) ndislink.o
APIOBJS = $(APISRCS:%.c=%.o) winx64_wrap.o

$(NDIS) :	CFLAGS =  -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. -I/usr/include

$(NDISAPI) :      CFLAGS =  -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.

ASMFLAGS = -O2 -fno-inline -Wall -ffreestanding -U_NO_LONGLONG \
	-D_KERNEL  -mcmodel=kernel -mno-red-zone -fno-strict-aliasing \
	-m64 -mtune=opteron -I../

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

all: ndiscvt ndis ndisapi

inf-parse.o:
	$(YACC) -d -v ../inf-parse.y
	mv y.tab.c inf-parse.c
	$(CC) $(CFLAGS) -c inf-parse.c -o inf-parse.o

inf-token.o: inf-parse.o
	rm -f inf-token.c
	$(LEX) -t ../inf-token.l > inf-token.c
	$(CC) $(CFLAGS) -c inf-token.c -o inf-token.o

%.o: ../%.c
	$(CC) $(CFLAGS) -c $< -o $@

ndiscvt: $(CVTOBJS)
	$(CC) $(CFLAGS) -o ndiscvt $(CVTOBJS)

ndis.h driver.s : ndiscvt
	./ndiscvt -i ndis.inf -s ndis.sys -o ndis.h -a driver.s

ndis : ndis.h driver.s
	$(CC) $(CFLAGS) -c ../if_ndis.c -o ndis.o
	$(CTFCVT) $(CTFLAGS) ndis.o
	$(CC) $(CFLAGS) -c ./driver.s -o driver.o
	$(CTFCVT) $(CTFLAGS) driver.o
	$(LD) -r -o bcmndis driver.o ndis.o
	$(CTFMERG) -l NDISWRAPPER -o bcmndis bcmndis

winx64_wrap.o: ../winx64_wrap.S
	$(CC) -c $(ASMFLAGS) ../winx64_wrap.S -o $@

ndisapi: $(APIOBJS)
	$(CTFCVT) $(CTFLAGS) subr_ndis.o
	$(CTFCVT) $(CTFLAGS) subr_ntoskrnl.o
	$(CTFCVT) $(CTFLAGS) subr_pe.o
	$(CTFCVT) $(CTFLAGS) subr_hal.o
	$(CTFCVT) $(CTFLAGS) kern_ndis.o
	$(CTFCVT) $(CTFLAGS) kern_windrv.o
	$(LD) -r -o $@ $(APIOBJS)
	$(CTFMERG) -l NDISWRAPPER -o $@ $(APIOBJS)

clean:
	rm -rf *.o ndiscvt inf-parse.c y.tab.h y.output inf-token.c bcmndis ndisapi


More information about the oi-dev mailing list