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

Jim Klimov jimklimov at cos.ru
Sat Mar 23 11:41:22 UTC 2013


On 2013-03-23 11:33, Jim Klimov wrote:
> I attach my current makefile (also automates creation of ndis.sys
> and ndis.inf from Broadcom files) and the gcc-444 build log, just
> in case you make more sense out of it.

Forgot the attachments :)

//Jim

-------------- next part --------------
rm -rf *.o ndiscvt inf-parse.c y.tab.h y.output inf-token.c bcmndis ndisapi ndis.h driver.s driver.sx
/opt/gcc/4.4.4/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -gdwarf-2 -c ../err.c -o err.o
/opt/gcc/4.4.4/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -gdwarf-2 -c ../inf.c -o inf.o
../inf.c: In function ???section_add???:
../inf.c:135: warning: incompatible implicit declaration of built-in function ???bzero???
../inf.c: In function ???find_assign???:
../inf.c:151: warning: incompatible implicit declaration of built-in function ???bzero???
../inf.c: In function ???assign_add???:
../inf.c:719: warning: incompatible implicit declaration of built-in function ???bzero???
../inf.c: In function ???regkey_add???:
../inf.c:761: warning: incompatible implicit declaration of built-in function ???bzero???
../inf.c: In function ???clear_words???:
../inf.c:796: warning: incompatible implicit declaration of built-in function ???bzero???
/opt/gcc/4.4.4/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -gdwarf-2 -c ../ndiscvt.c -o ndiscvt.o
../ndiscvt.c: In function ???insert_padding???:
../ndiscvt.c:117: warning: incompatible implicit declaration of built-in function ???bcopy???
../ndiscvt.c:144: warning: incompatible implicit declaration of built-in function ???bzero???
/opt/gcc/4.4.4/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -gdwarf-2 -c ../subr_pe.c -o subr_pe.o
../subr_pe.c: In function ???pe_get_dos_header???:
../subr_pe.c:105: warning: incompatible implicit declaration of built-in function ???bcopy???
../subr_pe.c: In function ???pe_get_optional_header???:
../subr_pe.c:177: warning: incompatible implicit declaration of built-in function ???bcopy???
../subr_pe.c: In function ???pe_get_file_header???:
../subr_pe.c:205: warning: incompatible implicit declaration of built-in function ???bcopy???
../subr_pe.c: In function ???pe_get_section_header???:
../subr_pe.c:235: warning: incompatible implicit declaration of built-in function ???bcopy???
../subr_pe.c: In function ???pe_get_section???:
../subr_pe.c:377: warning: incompatible implicit declaration of built-in function ???bcopy???
../subr_pe.c: In function ???pe_get_import_descriptor???:
../subr_pe.c:498: warning: incompatible implicit declaration of built-in function ???bcopy???
/usr/ccs/bin/yacc -d -v ../inf-parse.y

conflicts: 1 reduce/reduce
mv y.tab.c inf-parse.c
/opt/gcc/4.4.4/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -gdwarf-2 -c inf-parse.c -o inf-parse.o
rm -f inf-token.c
/usr/sfw/bin/flex -t ../inf-token.l > inf-token.c
/opt/gcc/4.4.4/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -gdwarf-2 -c inf-token.c -o inf-token.o
/opt/gcc/4.4.4/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -gdwarf-2 -c ../ndislink.c -o ndislink.o
/opt/gcc/4.4.4/bin/gcc -I../include -O -m64 -DLINKEDIMAGE -gdwarf-2 -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
*** Warning : untested driver
1542 quadword relocations
88 accesses to variables
2 accesses to system data
103 uses of xmm registers
88 imported functions
$Windows NT$ 
# 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
/opt/gcc/4.4.4/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 -D_KERNEL -DLINKEDIMAGE -D__amd64__ -D__amd64 -I../include -I. -I/usr/include -c ../if_ndis.c -m64 -o ndis.o
../if_ndis.c: In function ???get_drv_data???:
../if_ndis.c:234: warning: pointer targets in return differ in signedness
../if_ndis.c: In function ???ndis_cfg_esslist???:
../if_ndis.c:1064: warning: pointer targets in assignment differ in signedness
../if_ndis.c: In function ???ndis_attach???:
../if_ndis.c:3206: warning: pointer targets in assignment differ in signedness
/opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER ndis.o
/opt/gcc/4.4.4/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 -D_KERNEL -DLINKEDIMAGE -D__amd64__ -D__amd64 -I../include -I. -I/usr/include -c ./driver.s -m64 -o driver.o
# /opt/onbld/bin/i386/ctfconvert -g -l NDISWRAPPER driver.o
/usr/ccs/bin/ld -r -o bcmndis driver.o ndis.o
# /usr/ccs/bin/ld -r -o bcmndis driver.o ndis.o -melf_x86_64 -dy -N misc/ndisapi
# /usr/bin/ld -r -o bcmndis driver.o ndis.o -m64 -dy -N misc/ndisapi -N misc/mac -N ip
/opt/onbld/bin/i386/ctfmerge -l NDISWRAPPER -o bcmndis bcmndis
/opt/gcc/4.4.4/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 -D_KERNEL -DLINKEDIMAGE -D__amd64__ -D__amd64 -I../include -I. -c ../subr_ndis.c -o subr_ndis.o
../subr_ndis.c: In function ???ndis_unicode_to_ascii???:
../subr_ndis.c:400: warning: pointer targets in assignment differ in signedness
/opt/gcc/4.4.4/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 -D_KERNEL -DLINKEDIMAGE -D__amd64__ -D__amd64 -I../include -I. -c ../subr_ntoskrnl.c -o subr_ntoskrnl.o
../subr_ntoskrnl.c: In function ???win_strncmp???:
../subr_ntoskrnl.c:283: warning: pointer targets in passing argument 1 of ???strncmp??? differ in signedness
/usr/include/sys/sunddi.h:459: note: expected ???const char *??? but argument is of type ???const unsigned char *???
../subr_ntoskrnl.c:283: warning: pointer targets in passing argument 2 of ???strncmp??? differ in signedness
/usr/include/sys/sunddi.h:459: note: expected ???const char *??? but argument is of type ???const unsigned char *???
/opt/gcc/4.4.4/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 -D_KERNEL -DLINKEDIMAGE -D__amd64__ -D__amd64 -I../include -I. -c ../subr_hal.c -o subr_hal.o
/opt/gcc/4.4.4/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 -D_KERNEL -DLINKEDIMAGE -D__amd64__ -D__amd64 -I../include -I. -c ../kern_ndis.c -o kern_ndis.o
../kern_ndis.c:650: error: static declaration of ???strdup??? follows non-static declaration
/usr/include/sys/sunddi.h:426: note: previous declaration of ???strdup??? was here
gmake: *** [kern_ndis.o] 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) driver.o ndis.o :	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 -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 -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 -gdwarf-2

all: $(NDIS) $(NDISAPI) $(NDISCVT)

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) ndis.inf ndis.sys
	$(CC) $(CFLAGS) -o ndiscvt $(CVTOBJS)

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

ndis.o : ndis.h
	$(CC) $(CFLAGS) -c ../if_ndis.c -m64 -o ndis.o
	$(CTFCVT) $(CTFLAGS) ndis.o

driver.o : driver.s
	$(CC) $(CFLAGS) -c ./driver.s -m64 -o driver.o
	# $(CTFCVT) $(CTFLAGS) driver.o

$(NDIS) : ndis.o driver.o
	$(LD) -r -o $@ driver.o ndis.o
	# $(LD) -r -o $@ driver.o ndis.o -melf_x86_64 -dy -N misc/ndisapi
	# /usr/bin/ld -r -o $@ driver.o ndis.o -m64 -dy -N misc/ndisapi -N misc/mac -N ip
	$(CTFMERG) -l NDISWRAPPER -o $@ $@

ndisX : ndis.o driver.o $(NDISAPI)
	#$(LD) -r -o $@ driver.o ndis.o $(APIOBJS)
	#$(LD) -r -o $@ driver.o ndis.o $(APIOBJS) -melf_x86_64 -dy -N misc/ndisapi
	/usr/bin/ld -r -o $@ driver.o ndis.o $(APIOBJS)  -m64 -dy -N misc/mac -N ip
	$(CTFMERG) -l NDISWRAPPER -o $@ $@

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)
	# $(LD) -r -o $@ $(APIOBJS) -melf_x86_64
	# /usr/bin/ld -r -o $@ $(APIOBJS) -m64 -dy
	$(CTFMERG) -l NDISWRAPPER -o $@ $(APIOBJS)

clean:
	rm -rf *.o ndiscvt inf-parse.c y.tab.h y.output inf-token.c $(NDIS) ndisapi ndis.h driver.s driver.sx

install64: $(NDIS) ndisapi
	cp -pf $(NDIS) /kernel/drv/amd64
	cp -pf ndisapi /kernel/misc/amd64

install: install64

ndis.sys: bcmwl?64.sys
	cp -f bcmwl?64.sys ndis.sys

ndis.inf: bcmwl?.inf
	iconv -f utf-16 -t utf-8 bcmwl?.inf > ndis.inf


More information about the oi-dev mailing list