seemoo-lab / nexmon

The C-based Firmware Patching Framework for Broadcom/Cypress WiFi Chips that enables Monitor Mode, Frame Injection and much more
GNU General Public License v3.0
2.39k stars 448 forks source link

Error after compiling buildtools in Pi Zero W #159

Open Alphazork opened 6 years ago

Alphazork commented 6 years ago

I did: cd nexmon source setup_env.sh make

I get a lot of errors (all commands run under sudo):

BUILDING BUILDTOOLS
make[1]: Entering directory '/root/nexmon/buildtools'
  BUILDING flash_patch_extractor
make[2]: Entering directory '/root/nexmon/buildtools/flash_patch_extractor'
gcc -std=c99 -Wall -Wno-unused-result -O0 -D_BSD_SOURCE -o fpext.o -c fpext.c
In file included from /usr/include/stdio.h:27:0,
                 from fpext.c:3:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^~~~~~~
gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/armv7.o -c darm/armv7.c
gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/armv7-tbl.o -c darm/armv7-tbl.c
gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/darm.o -c darm/darm.c
gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/darm-tbl.o -c darm/darm-tbl.c
gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb2.o -c darm/thumb2.c
gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb2-decoder.o -c darm/thumb2-decoder.c
gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb2-tbl.o -c darm/thumb2-tbl.c
gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb.o -c darm/thumb.c
gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb-tbl.o -c darm/thumb-tbl.c
gcc -o fpext fpext.o darm/armv7.o darm/armv7-tbl.o darm/darm.o darm/darm-tbl.o darm/thumb2.o darm/thumb2-decoder.o darm/thumb2-tbl.o darm/thumb.o darm/thumb-tbl.o
make[2]: Leaving directory '/root/nexmon/buildtools/flash_patch_extractor'
  BUILDING ucode_extractor
make[2]: Entering directory '/root/nexmon/buildtools/ucode_extractor'
gcc -std=c99 -Wall -Wno-unused-result -O0 -D_BSD_SOURCE -o ucodeext.o -c ucodeext.c
In file included from /usr/include/stdio.h:27:0,
                 from ucodeext.c:3:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^~~~~~~
gcc -o ucodeext ucodeext.o
make[2]: Leaving directory '/root/nexmon/buildtools/ucode_extractor'
  BUILDING b43/assembler/b43-asm.bin
make[2]: Entering directory '/root/nexmon/buildtools/b43/assembler'
     DEPEND   dep/util.d
     YACC     parser.c
     LEX      scanner.c
     DEPEND   dep/scanner.d
     DEPEND   dep/parser.d
     DEPEND   dep/main.d
     DEPEND   dep/initvals.d
     DEPEND   dep/args.d
     CC       obj/args.o
     CC       obj/initvals.o
     CC       obj/main.o
main.c: In function ‘is_valid_imm’:
main.c:219:13: warning: left shift of negative value [-Wshift-negative-value]
  mask = (~0 << immediate_size) & 0xFFFF;
             ^~
     CC       obj/parser.o
parser.c: In function ‘yyparse’:
parser.c:4330:18: warning: passing argument 1 of ‘yyerror’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
         yyerror (yymsgp);
                  ^~~~~~
parser.y:26:13: note: expected ‘char *’ but argument is of type ‘const char *’
 extern void yyerror(char *);
             ^~~~~~~
     CC       obj/scanner.o
scanner.c: In function ‘yy_get_next_buffer’:
scanner.c:1098:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for ( n = 0; n < max_size && \
                  ^
scanner.c:2051:3: note: in expansion of macro ‘YY_INPUT’
   YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
   ^~~~~~~~
     CC       obj/util.o
     CC       b43-asm.bin
make[2]: Leaving directory '/root/nexmon/buildtools/b43/assembler'
  BUILDING b43/disassembler/b43-dasm
make[2]: Entering directory '/root/nexmon/buildtools/b43/disassembler'
     DEPEND   dep/util.d
     DEPEND   dep/main.d
     DEPEND   dep/args.d
     CC       obj/args.o
     CC       obj/main.o
     CC       obj/util.o
     CC       b43-dasm

If I just ignore the messages and try installing the pachtes it wont let me do it: libisl.so.10: cannot open shared object file: No such file or directory I really have no idea how to fix those, is it maybe a problem with nexmon itself? thank you

matthiasseemoo commented 6 years ago

read the readme file.

Am 16.12.2017 11:05 vorm. schrieb "Alphazork" notifications@github.com:

I did: cd nexmon source setup_env.sh make

I get a lot of errors (all commands run under sudo):

BUILDING BUILDTOOLS make[1]: Entering directory '/root/nexmon/buildtools' BUILDING flash_patch_extractor make[2]: Entering directory '/root/nexmon/buildtools/flash_patch_extractor' gcc -std=c99 -Wall -Wno-unused-result -O0 -D_BSD_SOURCE -o fpext.o -c fpext.c In file included from /usr/include/stdio.h:27:0, from fpext.c:3: /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]

warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

^~~ gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/armv7.o -c darm/armv7.c gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/armv7-tbl.o -c darm/armv7-tbl.c gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/darm.o -c darm/darm.c gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/darm-tbl.o -c darm/darm-tbl.c gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb2.o -c darm/thumb2.c gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb2-decoder.o -c darm/thumb2-decoder.c gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb2-tbl.o -c darm/thumb2-tbl.c gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb.o -c darm/thumb.c gcc -std=c99 -Wall -O2 -Wextra -Wno-missing-field-initializers -o darm/thumb-tbl.o -c darm/thumb-tbl.c gcc -o fpext fpext.o darm/armv7.o darm/armv7-tbl.o darm/darm.o darm/darm-tbl.o darm/thumb2.o darm/thumb2-decoder.o darm/thumb2-tbl.o darm/thumb.o darm/thumb-tbl.o make[2]: Leaving directory '/root/nexmon/buildtools/flash_patch_extractor' BUILDING ucode_extractor make[2]: Entering directory '/root/nexmon/buildtools/ucode_extractor' gcc -std=c99 -Wall -Wno-unused-result -O0 -D_BSD_SOURCE -o ucodeext.o -c ucodeext.c In file included from /usr/include/stdio.h:27:0, from ucodeext.c:3: /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]

warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

^~~ gcc -o ucodeext ucodeext.o make[2]: Leaving directory '/root/nexmon/buildtools/ucode_extractor' BUILDING b43/assembler/b43-asm.bin make[2]: Entering directory '/root/nexmon/buildtools/b43/assembler' DEPEND dep/util.d YACC parser.c LEX scanner.c DEPEND dep/scanner.d DEPEND dep/parser.d DEPEND dep/main.d DEPEND dep/initvals.d DEPEND dep/args.d CC obj/args.o CC obj/initvals.o CC obj/main.o main.c: In function ‘is_valid_imm’: main.c:219:13: warning: left shift of negative value [-Wshift-negative-value] mask = (~0 << immediate_size) & 0xFFFF; ^~ CC obj/parser.o parser.c: In function ‘yyparse’: parser.c:4330:18: warning: passing argument 1 of ‘yyerror’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] yyerror (yymsgp); ^~ parser.y:26:13: note: expected ‘char ’ but argument is of type ‘const char ’ extern void yyerror(char *); ^~~ CC obj/scanner.o scanner.c: In function ‘yy_get_next_buffer’: scanner.c:1098:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for ( n = 0; n < max_size && \ ^ scanner.c:2051:3: note: in expansion of macro ‘YY_INPUT’ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), ^~~~ CC obj/util.o CC b43-asm.bin make[2]: Leaving directory '/root/nexmon/buildtools/b43/assembler' BUILDING b43/disassembler/b43-dasm make[2]: Entering directory '/root/nexmon/buildtools/b43/disassembler' DEPEND dep/util.d DEPEND dep/main.d DEPEND dep/args.d CC obj/args.o CC obj/main.o CC obj/util.o CC b43-dasm

If I just ignore the messages and try installing the pachtes it wont let me do it: libisl.so.10: cannot open shared object file: No such file or directory I really have no idea how to fix those, is it maybe a problem with nexmon itself? thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/seemoo-lab/nexmon/issues/159, or mute the thread https://github.com/notifications/unsubscribe-auth/ALP_7veFywgWec3YWx_xqQmP1Fj8Tf2Pks5tA5XpgaJpZM4RESg9 .

Alphazork commented 6 years ago

And how exactly does that help? I followed all the steps

matthiasseemoo commented 6 years ago

search for libisl

Check if /usr/lib/arm-linux-gnueabihf/libisl.so.10 exists, if not, compile it from source:

Am 16.12.2017 12:16 nachm. schrieb "Alphazork" notifications@github.com:

And how exactly does that help? I followed all the steps

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/seemoo-lab/nexmon/issues/159#issuecomment-352177009, or mute the thread https://github.com/notifications/unsubscribe-auth/ALP_7nz5gFsbK7cM0EbmMqm7yt6haS3-ks5tA6Z4gaJpZM4RESg9 .

Alphazork commented 6 years ago

Thank You, but like I have said, I did follow all the steps and did also compile libisl from source. Exactly like in the readme. Any other idea?

matthiasseemoo commented 6 years ago

maybe you need to place the selfcompiled libisl.so into another library or you could define the LD_PRELOAD_PATH to the directory, where the compiled libisl can be found. the warnings you see at the beginning can be ignored. libisl is required in this particular version by the precompiled arm compiler we use. unfortunately, the newer libisl versions are not downward compatible.

Am 16.12.2017 12:55 nachm. schrieb "Alphazork" notifications@github.com:

Thank You, but like I have said, I did follow all the steps and did also compile libisl from source. Exactly like in the readme. Any other idea?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/seemoo-lab/nexmon/issues/159#issuecomment-352178926, or mute the thread https://github.com/notifications/unsubscribe-auth/ALP_7hRdCFM-q49L0diI-nT-jR8ik3POks5tA6-bgaJpZM4RESg9 .

Alphazork commented 6 years ago
root@raspberrypi:~/nexmon/buildtools/isl-0.10# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... /root/nexmon/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-armv7l/bin/arm-none-eabi-
checking whether the C compiler works... no
configure: error: in /root/nexmon/buildtools/isl-0.10:
configure: error: C compiler cannot create executables
See `config.log' for more details

I tried to compile it (the libisl) again and it seems my C compiler doesn't work ... I am serious lost at this point I also installed the build-essential package.

matthiasseemoo commented 6 years ago

you have to compile it without sourcing setup_evn.sh

Am 18.12.2017 7:35 nachm. schrieb "Alphazork" notifications@github.com:

root@raspberrypi:~/nexmon/buildtools/isl-0.10# ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for gcc... /root/nexmon/buildtools/gcc- arm-none-eabi-5_4-2016q2-linux-armv7l/bin/arm-none-eabi- checking whether the C compiler works... no configure: error: in /root/nexmon/buildtools/isl-0.10': configure: error: C compiler cannot create executables`

I tried to compile it again and it seems my C compiler doesn't work ... I am serious lost at this point I also installed the build-essential package.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/seemoo-lab/nexmon/issues/159#issuecomment-352518426, or mute the thread https://github.com/notifications/unsubscribe-auth/ALP_7oTHnKI7qzJfxWQQUcgRjPtVI8JJks5tBrB5gaJpZM4RESg9 .

Alphazork commented 6 years ago

wow it worked! Only now I realise that the readme file was 100% correct, I somehow skipped one step and tried to build the libisl library with sourcing setup_env.sh. Thank you so much!!

matthiasseemoo commented 6 years ago

Great to hear ;-)

Am 19.12.2017 2:46 nachm. schrieb "Alphazork" notifications@github.com:

wow it worked! Only now I realise that the readme file was 100% correct, I somehow skipped one step and tried to build the libisl library with sourcing setup_env.sh. Thank you so much!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/seemoo-lab/nexmon/issues/159#issuecomment-352754840, or mute the thread https://github.com/notifications/unsubscribe-auth/ALP_7vcZx-97fYZNoma6anpK2iWK_b5Aks5tB74vgaJpZM4RESg9 .

Alphazork commented 6 years ago

I continued with the installations and tried installing the firmware make install-firmware but the pi seems to get stuck while UNLOADING brcmfmac. It doens't respond to anything and I waited close to an hour. Is that normal?

matthiasseemoo commented 6 years ago

Try to reboot it.

On Tue, Dec 19, 2017 at 3:29 PM, Alphazork notifications@github.com wrote:

I continued with the installations and tried installing the firmware make install-firmware but the pi seems to get stuck while UNLOADING brcmfmac. It doens't respond to anything and I waited close to an hour. Is that normal?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/seemoo-lab/nexmon/issues/159#issuecomment-352770907, or mute the thread https://github.com/notifications/unsubscribe-auth/ALP_7gpuh0ovOfz6-sQnaFMecw4XqayNks5tB8hjgaJpZM4RESg9 .

-- Matthias Schulz Secure Mobile Networking Lab - SEEMOO

Email: matthias.schulz@seemoo.tu-darmstadt.de Web: http://www.seemoo.de/mschulz Phone (new): +49 6151 16-25478 Fax: +49 6151 16-25471

Department of Computer Science Center for Advanced Security Research Darmstadt Technische Universität Darmstadt Mornewegstr. 32 (Office 4.2.10, Building S4/14) D-64293 Darmstadt, Germany

Alphazork commented 6 years ago

I already did that, it is still stuck. Maybe it just takes a very long time on the Zero?

Edit: no it is definitely stuck, I can't stop the operation with control+C got this error after trying control+C UNLOADING brcmfmacpacket_write_wait: Connection to fe80::97a7:3175:c73c:700c%en0 port 22: Broken pipe

matthiasseemoo commented 6 years ago

no it should generalls work. you need the correct driver version for the bcm43430

Am 19.12.2017 3:54 nachm. schrieb "Alphazork" notifications@github.com:

I already did that, it is still stuck. Maybe it just takes a very long time on the Zero?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/seemoo-lab/nexmon/issues/159#issuecomment-352780715, or mute the thread https://github.com/notifications/unsubscribe-auth/ALP_7svjB4Uzoj8S3Qg3Qf-nFeZT88mAks5tB84lgaJpZM4RESg9 .

Alphazork commented 6 years ago

I'm sorry but do I need to install one? Because the Pi can connect normally to a network

Marselka commented 6 years ago

I have the same issue on RPI3 B with latest Raspbian release (2017-11-29). "nexutil -m" after using "nexutil -m2" freezing about 5 sec and returning "monitor:0"

On the April 2017 Raspbian it works well.

matthiasseemoo commented 6 years ago

Please send me the output of "nexutil -V"

On Fri, Dec 22, 2017 at 3:14 PM, Marsel Fayzullin notifications@github.com wrote:

I have the same issue on RPI3 B with latest Raspbian release (2017-11-29). "nexutil -m" after using "nexutil -m2" freezing about 5 sec and returning "monitor:0"

On the April 2017 Raspbian it works well.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/seemoo-lab/nexmon/issues/159#issuecomment-353605846, or mute the thread https://github.com/notifications/unsubscribe-auth/ALP_7ihTxe7gaA2W-Syc18n23U74Cztlks5tC7kogaJpZM4RESg9 .

-- Matthias Schulz Secure Mobile Networking Lab - SEEMOO

Email: matthias.schulz@seemoo.tu-darmstadt.de Web: http://www.seemoo.de/mschulz Phone (new): +49 6151 16-25478 Fax: +49 6151 16-25471

Department of Computer Science Center for Advanced Security Research Darmstadt Technische Universität Darmstadt Mornewegstr. 32 (Office 4.2.10, Building S4/14) D-64293 Darmstadt, Germany

Marselka commented 6 years ago

I will be able two days later. Thank you.

Marselka commented 6 years ago

So, the output of "nexutil -V" `pi@raspberrypi:~ $ nexutil -V firmware 7.45.41.46 (r666254 CY) FWID 01-f8a78378 vendorid 0x14e4 deviceid 0x43e2 radiorev 0x3da000 chipnum 0xa9a6 chiprev 0x1 chippackage 0x4 corerev 0x27 boardid 0x726 boardvendor 0x14e4 boardrev P101 driverrev 0x72d292e ucoderev 0x413080c bus 0x0 phytype 0xc phyrev 0x0 anarev 0x0 nvramrev 0x0

platform firmware vendorid deviceid radiorev chipnum chiprev chippackage corerev boardid boardvendor boardrev driverrev ucoderev bus phytype phyrev anarev nvramrev
unknown 7.45.41.46 (r666254 CY) FWID 01-f8a78378 0x14e4 0x43e2 0x3da000 0xa9a6 0x1 0x4 0x27 0x726 0x14e4 P101 0x72d292e 0x413080c 0x0 0xc 0x0 0x0 0x0

`

matthiasseemoo commented 6 years ago

The firmware version looks correct. You can try to load the patched firmware with the original driver and check if it works. It it does not, you should check for changes in the Wi-Fi driver between your version and the old version that was still compatible.

On Mon, Dec 25, 2017 at 8:59 AM, Marsel Fayzullin notifications@github.com wrote:

So, the output of "nexutil -V" pi@raspberrypi:~ $ nexutil -V firmware 7.45.41.46 (r666254 CY) FWID 01-f8a78378 vendorid 0x14e4 deviceid 0x43e2 radiorev 0x3da000 chipnum 0xa9a6 chiprev 0x1 chippackage 0x4 corerev 0x27 boardid 0x726 boardvendor 0x14e4 boardrev P101 driverrev 0x72d292e ucoderev 0x413080c bus 0x0 phytype 0xc phyrev 0x0 anarev 0x0 nvramrev 0x0 platform firmware vendorid deviceid radiorev chipnum chiprev chippackage corerev boardid boardvendor boardrev driverrev ucoderev bus phytype phyrev anarev nvramrev unknown 7.45.41.46 (r666254 CY) FWID 01-f8a78378 0x14e4 0x43e2 0x3da000 0xa9a6 0x1 0x4 0x27 0x726 0x14e4 P101 0x72d292e 0x413080c 0x0 0xc 0x0 0x0 0x0

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/seemoo-lab/nexmon/issues/159#issuecomment-353845078, or mute the thread https://github.com/notifications/unsubscribe-auth/ALP_7mk2ED_3fhAfhLe-383i5-v_2C9Nks5tD1XigaJpZM4RESg9 .

-- Matthias Schulz Secure Mobile Networking Lab - SEEMOO

Email: matthias.schulz@seemoo.tu-darmstadt.de Web: http://www.seemoo.de/mschulz Phone (new): +49 6151 16-25478 Fax: +49 6151 16-25471

Department of Computer Science Center for Advanced Security Research Darmstadt Technische Universität Darmstadt Mornewegstr. 32 (Office 4.2.10, Building S4/14) D-64293 Darmstadt, Germany

Marselka commented 6 years ago

Could you explain what exact original driver and patched firmware should I load and from where?

You can try to load the patched firmware with the original driver and check if it works.

Alphazork commented 6 years ago

So I installed the Re4son-Kernel and then tired to install nexmon:

modprobe: ERROR: could not insert 'brcmfmac': Exec format error
Error completing: modprobe

What is this 'brcmfmac'?

JuniorJPDJ commented 6 years ago

Your wifi driver

abhishek541 commented 6 years ago

I am also getting stuck at UNLOADING brcmfmac. Any way to resolve that ?