Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: Јаневски on May 08, 2018, 05:19:53 PM

Title: broadcom nexmon monitor mode
Post by: Јаневски on May 08, 2018, 05:19:53 PM
Hello,

Some time ago i came across: https://github.com/seemoo-lab/nexmon
Any thoughts on using nexmon for supporting monitor mode on the raspberry pi on board wifi?

Has anyone done it on tinycore? If so, how?
Is it doable?

I've seen people use it on a precompiled kali linux image.
I haven't had first hand experience with it, but i would love to see monitor mode on the pi on board wifi module.

Regards,
Jovan
Title: Re: broadcom nexmon monitor mode
Post by: Juanito on May 09, 2018, 05:49:13 AM
There are detailed instructions on the github page you mention above - did you try them?
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 05:26:35 AM
On make, i can't get past by:
Code: [Select]
/usr/local/bin/ld: cannot find -ll
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:75: b43-asm.bin] Error 1

Code: [Select]
$ tce-load -i -w flex flex-dev
flex is already installed!
flex-dev is already installed!
Title: Re: broadcom nexmon monitor mode
Post by: Juanito on May 27, 2018, 06:39:03 AM
If it were flex it was looking for it would be "-lfl", no?
Title: Re: broadcom nexmon monitor mode
Post by: Rich on May 27, 2018, 08:06:28 AM
Hi Juanito
If it were flex it was looking for it would be "-lfl", no?
According to this:
http://tinycorelinux.net/4.x/x86/tcz/flex.tcz.list
the x86 version of TC4 also contained a  libl:
Code: [Select]
/usr/local/include/FlexLexer.h
/usr/local/bin/lex
/usr/local/bin/flex
/usr/local/lib/libl.a
/usr/local/lib/libfl_pic.a
/usr/local/lib/libfl.a
Maybe it was a separate libray for  lex  that was later consolidated into  libfl ?
Title: Re: broadcom nexmon monitor mode
Post by: Rich on May 27, 2018, 10:34:34 AM
Hi Јаневски
It turns out that  /usr/local/lib/libl.a  is just a link to  /usr/local/lib/libfl.a.  Also,  /usr/local/bin/lex  is just a script that calls  flex  using
the  -l  parameter (maximal compatibility with original lex). Try this:
Code: [Select]
sudo ln -sf /usr/local/lib/libfl.a /usr/local/lib/libl.aThen run  make  again and see what error pops up next.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 12:57:18 PM
Yep that did it.
Now i am getting:
Code: [Select]
/buildtools/ucode_extractor/ucodeext -r bcmdhd_sta.bin -b 0x2D830 -l 0x8B82 -o ucode.bin
make[3]: /buildtools/ucode_extractor/ucodeext: Command not found
make[3]: *** [Makefile:7: ucode.bin] Error 127

I've ran # bash ./setup_env.sh first.
It seems to be shell environment related, which as a consequence causes this issue: https://github.com/seemoo-lab/nexmon/issues/41
Code: [Select]
The build command should be:

./buildtools/ucode_extractor/ucodeext -r bcmdhd_sta.bin -b 0x2D830 -l 0x8B82 -o ucode.bin
^
(Period goes there)

This is setup_env.sh, which passes without complaining if i run it using bash, if i do it with sh it says:
Code: [Select]
# bash ./setup_env.sh
# ./setup_env.sh
./setup_env.sh: line 2: syntax error: bad substitution
Code: [Select]
# cat setup_env.sh
OLD_PWD=$(pwd)
cd $(dirname ${BASH_SOURCE[0]})

export ARCH=arm
export SUBARCH=arm
export KERNEL=kernel7

export HOSTUNAME=$(uname -s)
export PLATFORMUNAME=$(uname -m)

export NEXMON_ROOT=$(pwd)

if [ $HOSTUNAME == "Darwin" ]; then
    export CC=$NEXMON_ROOT/buildtools/gcc-arm-none-eabi-5_4-2016q2-osx/bin/arm-none-eabi-
    export CCPLUGIN=$NEXMON_ROOT/buildtools/gcc-nexmon-plugin-osx/nexmon.so
    export ZLIBFLATE="openssl zlib"
else if [ $HOSTUNAME == "Linux" ] && [ $PLATFORMUNAME == "x86_64" ]; then
    export CC=$NEXMON_ROOT/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi-
    export CCPLUGIN=$NEXMON_ROOT/buildtools/gcc-nexmon-plugin/nexmon.so
    export ZLIBFLATE="zlib-flate -compress"
else if [[ $HOSTUNAME == "Linux" ]] && [[ $PLATFORMUNAME == "armv7l" || $PLATFORMUNAME == "armv6l" ]]; then
    export CC=$NEXMON_ROOT/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-armv7l/bin/arm-none-eabi-
    export CCPLUGIN=$NEXMON_ROOT/buildtools/gcc-nexmon-plugin-arm/nexmon.so
    export ZLIBFLATE="zlib-flate -compress"
else
    echo "Platform not supported!"
fi
fi
fi

export Q=@
export NEXMON_SETUP_ENV=1

cd "$OLD_PWD"
The manual says i shoud be using source ./setup_env.sh but it fails with:
Code: [Select]
# source ./setup_env.sh
/bin/sh: ./setup_env.sh: line 2: syntax error: bad substitution
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 01:24:53 PM
So i made ./setup_pi.sh and it seems to have set env vars properly and passed okay, this far...

Code: [Select]
# cat setup_pi.sh
export ARCH="arm"
export SUBARCH="arm"
export KERNEL="kernel7"

export HOSTUNAME=`uname -s`
export PLATFORMUNAME=`uname -m`

export NEXMON_ROOT=`pwd`

export CC=$NEXMON_ROOT/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-armv7l/bin/arm-none-eabi-
export CCPLUGIN=$NEXMON_ROOT/buildtools/gcc-nexmon-plugin-arm/nexmon.so
export ZLIBFLATE="zlib-flate -compress"

export Q=@
export NEXMON_SETUP_ENV=1
Code: [Select]
# source ./setup_pi.sh
# make
  BUILDING BUILDTOOLS
make[1]: Entering directory '/mnt/mmcblk0p4/nexmon/buildtools'
  BUILDING flash_patch_extractor
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/buildtools/flash_patch_extractor'
make[2]: 'fpext' is up to date.
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/buildtools/flash_patch_extractor'
  BUILDING ucode_extractor
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/buildtools/ucode_extractor'
make[2]: 'ucodeext' is up to date.
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/buildtools/ucode_extractor'
  BUILDING b43/assembler/b43-asm.bin
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/buildtools/b43/assembler'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/buildtools/b43/assembler'
  BUILDING b43/disassembler/b43-dasm
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/buildtools/b43/disassembler'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/buildtools/b43/disassembler'
make[1]: Leaving directory '/mnt/mmcblk0p4/nexmon/buildtools'
  EXTRACTING FLASHPATCHES AND UCODE
make[1]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares'
  EXECUTING MAKE FOR CHIP VERSION bcm4330/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4330'
  EXECUTING MAKE FOR FIRMWARE VERSION 5_90_100_41_sta/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4330/5_90_100_41_sta'
  EXTRACTING UCODE
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4330/5_90_100_41_sta'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4330'
  EXECUTING MAKE FOR CHIP VERSION bcm4335b0/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4335b0'
  EXECUTING MAKE FOR FIRMWARE VERSION 6.30.171.1_sta/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4335b0/6.30.171.1_sta'
  EXTRACTING UCODE
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4335b0/6.30.171.1_sta'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4335b0'
  EXECUTING MAKE FOR CHIP VERSION bcm4356/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4356'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_35_101_5_sta/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4356/7_35_101_5_sta'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4356/7_35_101_5_sta'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4356'
  EXECUTING MAKE FOR CHIP VERSION bcm43451b1/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43451b1'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_63_43_0/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43451b1/7_63_43_0'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
  REMOVE PRINTF FLASHPATCH to print to console buffer
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43451b1/7_63_43_0'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43451b1'
  EXECUTING MAKE FOR CHIP VERSION bcm4339/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4339'
  EXECUTING MAKE FOR FIRMWARE VERSION 6_37_34_43/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4339/6_37_34_43'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4339/6_37_34_43'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4339'
  EXECUTING MAKE FOR CHIP VERSION bcm43596a0/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43596a0'
  EXECUTING MAKE FOR FIRMWARE VERSION 9.75.155.45_sta_c0/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43596a0/9.75.155.45_sta_c0'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43596a0/9.75.155.45_sta_c0'
  EXECUTING MAKE FOR FIRMWARE VERSION 9.96.4_sta_c0/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43596a0/9.96.4_sta_c0'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43596a0/9.96.4_sta_c0'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43596a0'
  EXECUTING MAKE FOR CHIP VERSION bcm4358/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4358'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_112_300_14_sta/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4358/7_112_300_14_sta'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4358/7_112_300_14_sta'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_112_200_17_sta/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4358/7_112_200_17_sta'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4358/7_112_200_17_sta'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_112_201_3_sta/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4358/7_112_201_3_sta'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4358/7_112_201_3_sta'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm4358'
  EXECUTING MAKE FOR CHIP VERSION bcm43430a1/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_45_41_26/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_26'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_26'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_45_41_46/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1'
  EXECUTING MAKE FOR CHIP VERSION bcm43455c0/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455c0'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_45_154/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455c0/7_45_154'
  EXTRACTING UCODE
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455c0/7_45_154'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455c0'
  EXECUTING MAKE FOR CHIP VERSION bcm43438/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43438'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_45_41_26/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43438/7_45_41_26'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43438/7_45_41_26'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43438'
  EXECUTING MAKE FOR CHIP VERSION bcm43455/
make[2]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_120_7_1_sta_C0/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455/7_120_7_1_sta_C0'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455/7_120_7_1_sta_C0'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_120_5_1_sta_C0/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455/7_120_5_1_sta_C0'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455/7_120_5_1_sta_C0'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_45_77_0_hw/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455/7_45_77_0_hw'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455/7_45_77_0_hw'
  EXECUTING MAKE FOR FIRMWARE VERSION 7_45_77_0_hw_23_8_2017/
make[3]: Entering directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455/7_45_77_0_hw_23_8_2017'
  EXTRACTING UCODE
  EXTRACTING TEMPLATERAM
  EXTRACTING FLASHPATCHES
make[3]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455/7_45_77_0_hw_23_8_2017'
make[2]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares/bcm43455'
make[1]: Leaving directory '/mnt/mmcblk0p4/nexmon/firmwares'
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 01:43:13 PM
So then i continue with:
Code: [Select]
# cd /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
# make


          ###########   ###########   ##########    ##########           
         ############  ############  ############  ############         
         ##            ##            ##   ##   ##  ##        ##         
         ##            ##            ##   ##   ##  ##        ##         
         ###########   ####  ######  ##   ##   ##  ##    ######         
          ###########  ####  #       ##   ##   ##  ##    #    #         
                   ##  ##    ######  ##   ##   ##  ##    #    #         
                   ##  ##    #       ##   ##   ##  ##    #    #         
         ############  ##### ######  ##   ##   ##  ##### ######         
         ###########    ###########  ##   ##   ##   ##########           

            S E C U R E   M O B I L E   N E T W O R K I N G               


                               presents:                                 

              # ###   ###  #   # # ###  ###   ###  # ###                 
              ##   # #   #  # #  ##   ##   # #   # ##   #                 
              #    # #####   #   #    #    # #   # #    #                 
              #    # #      # #  #    #    # #   # #    #                 
              #    #  #### #   # #    #    #  ###  #    #                 

                The C-based Firmware Patching Framework                   


                           !!! WARNING !!!                               
    Our software may damage your hardware and may void your hardware’s   
     warranty! You use our tools at your own risk and responsibility     


  COLLECTING STATISTICS read /mnt/mmcblk0p4/nexmon/STATISTICS.md for more information
make[2]: *** [/mnt/mmcblk0p4/nexmon/patches/common/statistics.mk:21: statistics] Error 1
make[1]: *** [/mnt/mmcblk0p4/nexmon/patches/common/header.mk:31: header] Error 2
make: *** [Makefile:39: init] Error 2

 :o
Title: Re: broadcom nexmon monitor mode
Post by: Rich on May 27, 2018, 01:57:42 PM
Hi Јаневски
Maybe there are some clues in:
Quote
COLLECTING STATISTICS read /mnt/mmcblk0p4/nexmon/STATISTICS.md for more information
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 02:00:24 PM
Then i disable broken build platform statistics towards their mothership:
Code: [Select]
# mkdir -p /mnt/mmcblk0p4/nexmon/DISABLE_STATISTICS

And i get:
Code: [Select]
# cd /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
# make
...
  STATISTICS DISABLED to enable: delete /mnt/mmcblk0p4/nexmon/DISABLE_STATISTICS
  COMPILING src/ioctl.c => obj/ioctl.o (details: log/compiler.log)
  COMPILING src/autostart.c => obj/autostart.o (details: log/compiler.log)
  COMPILING src/injection.c => obj/injection.o (details: log/compiler.log)
  COMPILING src/patch.c => obj/patch.o (details: log/compiler.log)
  COMPILING src/version.c => obj/version.o (details: log/compiler.log)
  COMPILING src/local_wrapper.c => obj/local_wrapper.o (details: log/compiler.log)
  COMPILING src/sendframe.c => obj/sendframe.o (details: log/compiler.log)
  COMPILING src/monitormode.c => obj/monitormode.o (details: log/compiler.log)
  COPYING UCODE /mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46/ucode.bin => gen/ucode.bin
  COMPRESSING UCODE gen/ucode.bin => gen/ucode_compressed.bin
/bin/bash: zlib-flate: command not found
make: *** [Makefile:155: gen/ucode_compressed.bin] Error 127

Code: [Select]
# su tc -c "tce-load -i -w zlib_base-dev"
zlib_base-dev is already installed!
Title: Re: broadcom nexmon monitor mode
Post by: Rich on May 27, 2018, 02:08:34 PM
Hi Јаневски
Quote
/bin/bash: zlib-flate: command not found
Install  qpdf.tcz.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 02:15:47 PM
Code: [Select]
# su tc -c "tce-load -i -w qpdf"
Downloading: qpdf.tcz
Connecting to repo.tinycorelinux.net (89.22.99.37:80)
wget: server returned error: HTTP/1.1 404 Not Found
md5sum: qpdf.tcz.md5.txt: No such file or directory
Error on qpdf.tcz
# uname -a
Linux box 4.4.20-piCore_v7+ #1 SMP Wed Sep 7 22:53:19 CEST 2016 armv7l GNU/Linux
I have piCore 8.2...
Title: Re: broadcom nexmon monitor mode
Post by: Rich on May 27, 2018, 02:21:12 PM
Hi Јаневски
It is available in TC9.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 03:06:54 PM
I compiled qpdf.

Now compilation fails at:
Code: [Select]
# cd /mnt/mmcblk0p4/nexmon
# source ./setup_pi.sh
# cd /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
# make
...
  STATISTICS DISABLED to enable: delete /mnt/mmcblk0p4/nexmon/DISABLE_STATISTICS
  COMPILING src/version.c => obj/version.o (details: log/compiler.log)
  GENERATING C FILE gen/ucode_compressed.bin => src/ucode_compressed.c
/bin/bash: xxd: command not found
make: *** [Makefile:160: src/ucode_compressed.c] Error 127
Which according to the internet is vim-common and i don't seem to have it, yet.
Title: Re: broadcom nexmon monitor mode
Post by: Rich on May 27, 2018, 03:21:46 PM
Hi Јаневски
It appears  xxd  is available as part of  vim,  however, I don't see  vim  in the Pi repositories.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 03:50:47 PM
I compiled vim,

Now:
Code: [Select]
# cd /mnt/mmcblk0p4/nexmon
# source ./setup_pi.sh
# cd /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
# make
...
  STATISTICS DISABLED to enable: delete /mnt/mmcblk0p4/nexmon/DISABLE_STATISTICS
  COMPILING src/ucode_compressed.c => obj/ucode_compressed.o (details: log/compiler.log)
  COMPILING src/version.c => obj/version.o (details: log/compiler.log)
  GENERATING C FILE /mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46/templateram.bin => src/templateram.c
  COMPILING src/templateram.c => obj/templateram.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/ucode_compression_code.c => obj/ucode_compression_code.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/wrapper.c => obj/wrapper.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/argprintf.c => obj/argprintf.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/helper.c => obj/helper.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/udptunnel.c => obj/udptunnel.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/objmem.c => obj/objmem.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/securitycookie.c => obj/securitycookie.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/radiotap.c => obj/radiotap.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46/flashpatches.c => obj/flashpatches.o (details: log/compiler.log)
  GENERATING LINKER FILE gen/nexmon.pre => gen/nexmon.ld
  GENERATING LINKER FILE gen/nexmon.pre => gen/flashpatches.ld
  GENERATING LINKER FILE gen/memory.ld
  LINKING OBJECTS => gen/patch.elf (details: log/linker.log, log/linker.err)
make: *** [Makefile:116: gen/patch.elf] Error 1

And after a lot of 'Removing unused section' lines the log/linker.err says:
Code: [Select]
...
/mnt/mmcblk0p4/nexmon/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-armv7l/bin/arm-none-eabi-ld: Removing unused section '.ARM.attributes' in file 'obj/ucode_compressed.o'
obj/ucode_compression_code.o: In function `wlc_ucode_write_compressed':
ucode_compression_code.c:(.text.wlc_ucode_write_compressed+0x40): undefined reference to `ucode_compressed_bin_len'
ucode_compression_code.c:(.text.wlc_ucode_write_compressed+0x50): undefined reference to `ucode_compressed_bin'
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 04:07:52 PM
According to google, at the moment there are 4 unique results regarding 'undefined reference to `ucode_compressed_bin_len'', one of which, that happens to be the first one, is the following issue:
https://github.com/seemoo-lab/nexmon/issues/146
Quote
matthiasseemoo commented on Nov 6, 2017
Unfortunately, we do not officially support Arch Linux, so you need to cope with the compilation errors on your own.

 @matthiasseemoo matthiasseemoo closed this on Nov 6, 2017

It's either unsupported, or i need to do it again, make in root dir then the rest again.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 06:20:08 PM
Update, now it went past the linker, however:
Code: [Select]
# cd /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
# make clean
# cp /usr/local/lib/libqpdf.so.21 /lib
# mkdir -p /lib/modules/4.4.20-piCore_v7+/build
# make clean
  CLEANING
  CLEANING DRIVER
make[1]: Entering directory '/lib/modules/4.4.20-piCore_v7+/build'
make[1]: *** No rule to make target 'clean'.  Stop.
make[1]: Leaving directory '/lib/modules/4.4.20-piCore_v7+/build'
make: *** [Makefile:229: clean] Error 2
# make


          ###########   ###########   ##########    ##########           
         ############  ############  ############  ############         
         ##            ##            ##   ##   ##  ##        ##         
         ##            ##            ##   ##   ##  ##        ##         
         ###########   ####  ######  ##   ##   ##  ##    ######         
          ###########  ####  #       ##   ##   ##  ##    #    #         
                   ##  ##    ######  ##   ##   ##  ##    #    #         
                   ##  ##    #       ##   ##   ##  ##    #    #         
         ############  ##### ######  ##   ##   ##  ##### ######         
         ###########    ###########  ##   ##   ##   ##########           

            S E C U R E   M O B I L E   N E T W O R K I N G               


                               presents:                                 

              # ###   ###  #   # # ###  ###   ###  # ###                 
              ##   # #   #  # #  ##   ##   # #   # ##   #                 
              #    # #####   #   #    #    # #   # #    #                 
              #    # #      # #  #    #    # #   # #    #                 
              #    #  #### #   # #    #    #  ###  #    #                 

                The C-based Firmware Patching Framework                   


                           !!! WARNING !!!                               
    Our software may damage your hardware and may void your hardware’s   
     warranty! You use our tools at your own risk and responsibility     


  STATISTICS DISABLED to enable: delete /mnt/mmcblk0p4/nexmon/DISABLE_STATISTICS
  COMPILING src/ioctl.c => obj/ioctl.o (details: log/compiler.log)
  COMPILING src/autostart.c => obj/autostart.o (details: log/compiler.log)
  COMPILING src/injection.c => obj/injection.o (details: log/compiler.log)
  COMPILING src/patch.c => obj/patch.o (details: log/compiler.log)
  COMPILING src/version.c => obj/version.o (details: log/compiler.log)
  COMPILING src/local_wrapper.c => obj/local_wrapper.o (details: log/compiler.log)
  COMPILING src/sendframe.c => obj/sendframe.o (details: log/compiler.log)
  COMPILING src/monitormode.c => obj/monitormode.o (details: log/compiler.log)
  COPYING UCODE /mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46/ucode.bin => gen/ucode.bin
  COMPRESSING UCODE gen/ucode.bin => gen/ucode_compressed.bin
  GENERATING C FILE gen/ucode_compressed.bin => src/ucode_compressed.c
  COMPILING src/ucode_compressed.c => obj/ucode_compressed.o (details: log/compiler.log)
  GENERATING C FILE /mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46/templateram.bin => src/templateram.c
  COMPILING src/templateram.c => obj/templateram.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/ucode_compression_code.c => obj/ucode_compression_code.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/wrapper.c => obj/wrapper.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/argprintf.c => obj/argprintf.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/helper.c => obj/helper.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/udptunnel.c => obj/udptunnel.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/objmem.c => obj/objmem.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/securitycookie.c => obj/securitycookie.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/radiotap.c => obj/radiotap.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46/flashpatches.c => obj/flashpatches.o (details: log/compiler.log)
  GENERATING LINKER FILE gen/nexmon.pre => gen/nexmon.ld
  GENERATING LINKER FILE gen/nexmon.pre => gen/flashpatches.ld
  GENERATING LINKER FILE gen/memory.ld
  LINKING OBJECTS => gen/patch.elf (details: log/linker.log, log/linker.err)
  GENERATING MAKE FILE gen/nexmon.pre => gen/nexmon.mk
  GENERATING MAKE FILE gen/nexmon.pre => gen/flashpatches.mk
  APPLYING FLASHPATCHES gen/flashpatches.mk => brcmfmac43430-sdio.bin (details: log/flashpatches.log)
  APPLYING PATCHES gen/nexmon.mk => brcmfmac43430-sdio.bin (details: log/patches.log)
  BUILDING DRIVER for kernel 4.4 brcmfmac_kernel44/brcmfmac.ko (details: log/driver.log)
make[1]: *** No targets specified and no makefile found.  Stop.
make: *** [Makefile:52: brcmfmac.ko] Error 2
I think i am missing some source files, either kernel or wifi modules, or my paths are wrong...

First it was complaining about this folder not existing /lib/modules/4.4.20-piCore_v7+/build then i manually created it, then it continued complaining that there is no Makefile inside.

Code: [Select]
# cat log/driver.log
make[1]: Entering directory '/lib/modules/4.4.20-piCore_v7+/build'
make[1]: Leaving directory '/lib/modules/4.4.20-piCore_v7+/build'

But i think i have the kernel headers installed...
Code: [Select]
# su tc -c "tce-load -i -w linux-4.4.y_api_headers"
linux-4.4.y_api_headers is already installed!
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 07:14:28 PM
But headers are only headers, that doesn't seem enough.

I'm going to see what's in here http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/ and i'll try to do something.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 09:41:50 PM
I did this:
Code: [Select]
cd /mnt/mmcblk0p4
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20_RaspberryPi_src.tar.xz
tar -xf 4.4.20_RaspberryPi_src.tar.xz
ln -s /mnt/mmcblk0p4/4.4.20 /lib/modules/`uname -r`/build
cd /mnt/mmcblk0p4/4.4.20
make mrproper
KERNEL=kernel7
make bcm2709_defconfig
make modules_prepare

Then, i went to nexmon and:
Code: [Select]
# cd /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
# make clean
  CLEANING
  CLEANING DRIVER
make[1]: Entering directory '/mnt/mmcblk0p4/4.4.20'
  CLEAN   /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac_kernel44/.tmp_versions
make[1]: Leaving directory '/mnt/mmcblk0p4/4.4.20'
# make


          ###########   ###########   ##########    ##########           
         ############  ############  ############  ############         
         ##            ##            ##   ##   ##  ##        ##         
         ##            ##            ##   ##   ##  ##        ##         
         ###########   ####  ######  ##   ##   ##  ##    ######         
          ###########  ####  #       ##   ##   ##  ##    #    #         
                   ##  ##    ######  ##   ##   ##  ##    #    #         
                   ##  ##    #       ##   ##   ##  ##    #    #         
         ############  ##### ######  ##   ##   ##  ##### ######         
         ###########    ###########  ##   ##   ##   ##########           

            S E C U R E   M O B I L E   N E T W O R K I N G               


                               presents:                                 

              # ###   ###  #   # # ###  ###   ###  # ###                 
              ##   # #   #  # #  ##   ##   # #   # ##   #                 
              #    # #####   #   #    #    # #   # #    #                 
              #    # #      # #  #    #    # #   # #    #                 
              #    #  #### #   # #    #    #  ###  #    #                 

                The C-based Firmware Patching Framework                   


                           !!! WARNING !!!                               
    Our software may damage your hardware and may void your hardware’s   
     warranty! You use our tools at your own risk and responsibility     


  STATISTICS DISABLED to enable: delete /mnt/mmcblk0p4/nexmon/DISABLE_STATISTICS
  COMPILING src/ioctl.c => obj/ioctl.o (details: log/compiler.log)
  COMPILING src/autostart.c => obj/autostart.o (details: log/compiler.log)
  COMPILING src/injection.c => obj/injection.o (details: log/compiler.log)
  COMPILING src/patch.c => obj/patch.o (details: log/compiler.log)
  COMPILING src/version.c => obj/version.o (details: log/compiler.log)
  COMPILING src/local_wrapper.c => obj/local_wrapper.o (details: log/compiler.log)
  COMPILING src/sendframe.c => obj/sendframe.o (details: log/compiler.log)
  COMPILING src/monitormode.c => obj/monitormode.o (details: log/compiler.log)
  COPYING UCODE /mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46/ucode.bin => gen/ucode.bin
  COMPRESSING UCODE gen/ucode.bin => gen/ucode_compressed.bin
  GENERATING C FILE gen/ucode_compressed.bin => src/ucode_compressed.c
  COMPILING src/ucode_compressed.c => obj/ucode_compressed.o (details: log/compiler.log)
  GENERATING C FILE /mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46/templateram.bin => src/templateram.c
  COMPILING src/templateram.c => obj/templateram.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/ucode_compression_code.c => obj/ucode_compression_code.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/wrapper.c => obj/wrapper.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/argprintf.c => obj/argprintf.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/helper.c => obj/helper.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/udptunnel.c => obj/udptunnel.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/objmem.c => obj/objmem.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/securitycookie.c => obj/securitycookie.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/patches/common/radiotap.c => obj/radiotap.o (details: log/compiler.log)
  COMPILING /mnt/mmcblk0p4/nexmon/firmwares/bcm43430a1/7_45_41_46/flashpatches.c => obj/flashpatches.o (details: log/compiler.log)
  GENERATING LINKER FILE gen/nexmon.pre => gen/nexmon.ld
  GENERATING LINKER FILE gen/nexmon.pre => gen/flashpatches.ld
  GENERATING LINKER FILE gen/memory.ld
  LINKING OBJECTS => gen/patch.elf (details: log/linker.log, log/linker.err)
  GENERATING MAKE FILE gen/nexmon.pre => gen/nexmon.mk
  GENERATING MAKE FILE gen/nexmon.pre => gen/flashpatches.mk
  APPLYING FLASHPATCHES gen/flashpatches.mk => brcmfmac43430-sdio.bin (details: log/flashpatches.log)
  APPLYING PATCHES gen/nexmon.mk => brcmfmac43430-sdio.bin (details: log/patches.log)
  BUILDING DRIVER for kernel 4.4 brcmfmac_kernel44/brcmfmac.ko (details: log/driver.log)

Then i did:
Code: [Select]
# make backup-firmware
cp /lib/firmware/brcm/brcmfmac43430-sdio.bin brcmfmac43430-sdio.bin.orig

However, i got a readonly file system error when trying to write the compiled module:
Code: [Select]
# make install-firmware


          ###########   ###########   ##########    ##########           
         ############  ############  ############  ############         
         ##            ##            ##   ##   ##  ##        ##         
         ##            ##            ##   ##   ##  ##        ##         
         ###########   ####  ######  ##   ##   ##  ##    ######         
          ###########  ####  #       ##   ##   ##  ##    #    #         
                   ##  ##    ######  ##   ##   ##  ##    #    #         
                   ##  ##    #       ##   ##   ##  ##    #    #         
         ############  ##### ######  ##   ##   ##  ##### ######         
         ###########    ###########  ##   ##   ##   ##########           

            S E C U R E   M O B I L E   N E T W O R K I N G               


                               presents:                                 

              # ###   ###  #   # # ###  ###   ###  # ###                 
              ##   # #   #  # #  ##   ##   # #   # ##   #                 
              #    # #####   #   #    #    # #   # #    #                 
              #    # #      # #  #    #    # #   # #    #                 
              #    #  #### #   # #    #    #  ###  #    #                 

                The C-based Firmware Patching Framework                   


                           !!! WARNING !!!                               
    Our software may damage your hardware and may void your hardware’s   
     warranty! You use our tools at your own risk and responsibility     


  STATISTICS DISABLED to enable: delete /mnt/mmcblk0p4/nexmon/DISABLE_STATISTICS
  COMPILING src/version.c => obj/version.o (details: log/compiler.log)
  GENERATING LINKER FILE gen/nexmon.pre => gen/nexmon.ld
  GENERATING LINKER FILE gen/nexmon.pre => gen/flashpatches.ld
  LINKING OBJECTS => gen/patch.elf (details: log/linker.log, log/linker.err)
  GENERATING MAKE FILE gen/nexmon.pre => gen/nexmon.mk
  GENERATING MAKE FILE gen/nexmon.pre => gen/flashpatches.mk
  APPLYING FLASHPATCHES gen/flashpatches.mk => brcmfmac43430-sdio.bin (details: log/flashpatches.log)
  APPLYING PATCHES gen/nexmon.mk => brcmfmac43430-sdio.bin (details: log/patches.log)
  BUILDING DRIVER for kernel 4.4 brcmfmac_kernel44/brcmfmac.ko (details: log/driver.log)
  COPYING brcmfmac43430-sdio.bin => /lib/firmware/brcm/brcmfmac43430-sdio.bin
cp: cannot create regular file '/lib/firmware/brcm/brcmfmac43430-sdio.bin': Read-only file system
make: *** [Makefile:184: install-firmware] Error 1

This part:
Code: [Select]
cp: cannot create regular file '/lib/firmware/brcm/brcmfmac43430-sdio.bin': Read-only file system
make: *** [Makefile:184: install-firmware] Error 1

Which means i tried to write on a squashfs read only mount point from a firmware tcz.
Title: Re: broadcom nexmon monitor mode
Post by: Rich on May 27, 2018, 10:40:32 PM
Hi Јаневски
...
Code: [Select]
cp: cannot create regular file '/lib/firmware/brcm/brcmfmac43430-sdio.bin': Read-only file system
make: *** [Makefile:184: install-firmware] Error 1

Which means i tried to write on a squashfs read only mount point from a firmware tcz.

Actually that's  firmware-rpi3-wireless.tcz  which contains:
Code: [Select]
lib/firmware/brcm/brcmfmac43430-sdio.txt
lib/firmware/brcm/brcmfmac43430-sdio.bin
lib/firmware/brcm/LICENSE

If you remove  firmware-rpi3-wireless.tcz  from your  onboot.lst  and reboot, you will then be able to write your file.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 10:51:32 PM
This is what i did to remove the default modules:
Code: [Select]
cd /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
ifconfig wlan0 down
rmmod brcmfmac
rmmod brcmutil
umount -f /tmp/tcloop/firmware-rpi3-wireless
rm -r -f /tmp/tcloop/firmware-rpi3-wireless
rm -r -f /lib/firmware/brcm
mkdir -p /lib/firmware/brcm
make install-firmware

However, now i got:
Code: [Select]
# make install-firmware


          ###########   ###########   ##########    ##########           
         ############  ############  ############  ############         
         ##            ##            ##   ##   ##  ##        ##         
         ##            ##            ##   ##   ##  ##        ##         
         ###########   ####  ######  ##   ##   ##  ##    ######         
          ###########  ####  #       ##   ##   ##  ##    #    #         
                   ##  ##    ######  ##   ##   ##  ##    #    #         
                   ##  ##    #       ##   ##   ##  ##    #    #         
         ############  ##### ######  ##   ##   ##  ##### ######         
         ###########    ###########  ##   ##   ##   ##########           

            S E C U R E   M O B I L E   N E T W O R K I N G               


                               presents:                                 

              # ###   ###  #   # # ###  ###   ###  # ###                 
              ##   # #   #  # #  ##   ##   # #   # ##   #                 
              #    # #####   #   #    #    # #   # #    #                 
              #    # #      # #  #    #    # #   # #    #                 
              #    #  #### #   # #    #    #  ###  #    #                 

                The C-based Firmware Patching Framework                   


                           !!! WARNING !!!                               
    Our software may damage your hardware and may void your hardware’s   
     warranty! You use our tools at your own risk and responsibility     


  STATISTICS DISABLED to enable: delete /mnt/mmcblk0p4/nexmon/DISABLE_STATISTICS
  COMPILING src/version.c => obj/version.o (details: log/compiler.log)
  GENERATING LINKER FILE gen/nexmon.pre => gen/nexmon.ld
  GENERATING LINKER FILE gen/nexmon.pre => gen/flashpatches.ld
  LINKING OBJECTS => gen/patch.elf (details: log/linker.log, log/linker.err)
  GENERATING MAKE FILE gen/nexmon.pre => gen/nexmon.mk
  GENERATING MAKE FILE gen/nexmon.pre => gen/flashpatches.mk
  APPLYING FLASHPATCHES gen/flashpatches.mk => brcmfmac43430-sdio.bin (details: log/flashpatches.log)
  APPLYING PATCHES gen/nexmon.mk => brcmfmac43430-sdio.bin (details: log/patches.log)
  BUILDING DRIVER for kernel 4.4 brcmfmac_kernel44/brcmfmac.ko (details: log/driver.log)
  COPYING brcmfmac43430-sdio.bin => /lib/firmware/brcm/brcmfmac43430-sdio.bin
  RELOADING brcmfmac
insmod: can't insert 'brcmfmac_kernel44/brcmfmac.ko': invalid module format
make: *** [Makefile:187: install-firmware] Error 8

And even if i manually try to insert the module:
Code: [Select]
# insmod brcmfmac_kernel44/brcmfmac.ko
insmod: can't insert 'brcmfmac_kernel44/brcmfmac.ko': invalid module format

nexutl is compilable, but i get an error if i try to run it - quite expected.
Title: Re: broadcom nexmon monitor mode
Post by: Rich on May 27, 2018, 11:19:51 PM
Hi Јаневски
... And even if i manually try to insert the module:
Code: [Select]
# insmod brcmfmac_kernel44/brcmfmac.ko
insmod: can't insert 'brcmfmac_kernel44/brcmfmac.ko': invalid module format

I think  invalid module format  usually means there is some mismatch in the version number between the kernel and module.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 27, 2018, 11:40:55 PM
Hi Јаневски
... And even if i manually try to insert the module:
Code: [Select]
# insmod brcmfmac_kernel44/brcmfmac.ko
insmod: can't insert 'brcmfmac_kernel44/brcmfmac.ko': invalid module format

I think  invalid module format  usually means there is some mismatch in the version number between the kernel and module.

Yes their kernel magic is not the same:
Code: [Select]
# modinfo brcmfmac_kernel44/brcmfmac.ko
filename:       brcmfmac_kernel44/brcmfmac.ko
license:        Dual BSD/GPL
author:         Broadcom Corporation
description:    Broadcom 802.11 wireless LAN fullmac driver.
alias:          usb:v0A5Cp0BDCd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD27d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD1Fd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD17d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD1Ed*dc*dsc*dp*ic*isc*ip*in*
alias:          sdio:c*v02D0d4354*
alias:          sdio:c*v02D0d4345*
alias:          sdio:c*v02D0dA9A6*
alias:          sdio:c*v02D0d4335*
alias:          sdio:c*v02D0dA962*
alias:          sdio:c*v02D0dA94D*
alias:          sdio:c*v02D0dA94C*
alias:          sdio:c*v02D0d4334*
alias:          sdio:c*v02D0d4330*
alias:          sdio:c*v02D0d4329*
alias:          sdio:c*v02D0d4324*
alias:          sdio:c*v02D0dA887*
srcversion:     489A257663CD4221CF8BDED
depends:       
vermagic:       4.4.20-v7 SMP mod_unload modversions ARMv7
parm:           roamoff:do not use internal roaming engine
parm:           fcmode:mode of firmware signalled flow control
parm:           p2pon:enable legacy p2p management functionality
parm:           debug:level of debug output
parm:           feature_disable:Disable features
parm:           txglomsz:maximum tx packet chain size [SDIO]
firmware:       brcm/brcmfmac4354-sdio.txt
firmware:       brcm/brcmfmac4354-sdio.bin
firmware:       brcm/brcmfmac43455-sdio.txt
firmware:       brcm/brcmfmac43455-sdio.bin
firmware:       brcm/brcmfmac43430-sdio.txt
firmware:       brcm/brcmfmac43430-sdio.bin
firmware:       brcm/brcmfmac4339-sdio.txt
firmware:       brcm/brcmfmac4339-sdio.bin
firmware:       brcm/brcmfmac43362-sdio.txt
firmware:       brcm/brcmfmac43362-sdio.bin
firmware:       brcm/brcmfmac4335-sdio.txt
firmware:       brcm/brcmfmac4335-sdio.bin
firmware:       brcm/brcmfmac43341-sdio.txt
firmware:       brcm/brcmfmac43341-sdio.bin
firmware:       brcm/brcmfmac43340-sdio.txt
firmware:       brcm/brcmfmac43340-sdio.bin
firmware:       brcm/brcmfmac4334-sdio.txt
firmware:       brcm/brcmfmac4334-sdio.bin
firmware:       brcm/brcmfmac4330-sdio.txt
firmware:       brcm/brcmfmac4330-sdio.bin
firmware:       brcm/brcmfmac4329-sdio.txt
firmware:       brcm/brcmfmac4329-sdio.bin
firmware:       brcm/brcmfmac43241b5-sdio.txt
firmware:       brcm/brcmfmac43241b5-sdio.bin
firmware:       brcm/brcmfmac43241b4-sdio.txt
firmware:       brcm/brcmfmac43241b4-sdio.bin
firmware:       brcm/brcmfmac43241b0-sdio.txt
firmware:       brcm/brcmfmac43241b0-sdio.bin
firmware:       brcm/brcmfmac43143-sdio.txt
firmware:       brcm/brcmfmac43143-sdio.bin
firmware:       brcm/brcmfmac43569.bin
firmware:       brcm/brcmfmac43242a.bin
firmware:       brcm/brcmfmac43236b.bin
firmware:       brcm/brcmfmac43143.bin
# modinfo brcmfmac
filename:       kernel.tclocal/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
license:        Dual BSD/GPL
author:         Broadcom Corporation
description:    Broadcom 802.11 wireless LAN fullmac driver.
alias:          usb:v0A5Cp0BDCd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD27d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD1Fd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD17d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD1Ed*dc*dsc*dp*ic*isc*ip*in*
alias:          sdio:c*v02D0d4354*
alias:          sdio:c*v02D0d4345*
alias:          sdio:c*v02D0dA9A6*
alias:          sdio:c*v02D0d4335*
alias:          sdio:c*v02D0dA962*
alias:          sdio:c*v02D0dA94D*
alias:          sdio:c*v02D0dA94C*
alias:          sdio:c*v02D0d4334*
alias:          sdio:c*v02D0d4330*
alias:          sdio:c*v02D0d4329*
alias:          sdio:c*v02D0d4324*
alias:          sdio:c*v02D0dA887*
srcversion:     B33E7691EAF20C9A34D6807
depends:        brcmutil,cfg80211
vermagic:       4.4.20-piCore_v7+ SMP mod_unload modversions ARMv7
parm:           roamoff:do not use internal roaming engine
parm:           fcmode:mode of firmware signalled flow control
parm:           p2pon:enable legacy p2p management functionality
parm:           debug:level of debug output
parm:           feature_disable:Disable features
parm:           txglomsz:maximum tx packet chain size [SDIO]
firmware:       brcm/brcmfmac4354-sdio.txt
firmware:       brcm/brcmfmac4354-sdio.bin
firmware:       brcm/brcmfmac43455-sdio.txt
firmware:       brcm/brcmfmac43455-sdio.bin
firmware:       brcm/brcmfmac43430-sdio.txt
firmware:       brcm/brcmfmac43430-sdio.bin
firmware:       brcm/brcmfmac4339-sdio.txt
firmware:       brcm/brcmfmac4339-sdio.bin
firmware:       brcm/brcmfmac43362-sdio.txt
firmware:       brcm/brcmfmac43362-sdio.bin
firmware:       brcm/brcmfmac4335-sdio.txt
firmware:       brcm/brcmfmac4335-sdio.bin
firmware:       brcm/brcmfmac43341-sdio.txt
firmware:       brcm/brcmfmac43341-sdio.bin
firmware:       brcm/brcmfmac43340-sdio.txt
firmware:       brcm/brcmfmac43340-sdio.bin
firmware:       brcm/brcmfmac4334-sdio.txt
firmware:       brcm/brcmfmac4334-sdio.bin
firmware:       brcm/brcmfmac4330-sdio.txt
firmware:       brcm/brcmfmac4330-sdio.bin
firmware:       brcm/brcmfmac4329-sdio.txt
firmware:       brcm/brcmfmac4329-sdio.bin
firmware:       brcm/brcmfmac43241b5-sdio.txt
firmware:       brcm/brcmfmac43241b5-sdio.bin
firmware:       brcm/brcmfmac43241b4-sdio.txt
firmware:       brcm/brcmfmac43241b4-sdio.bin
firmware:       brcm/brcmfmac43241b0-sdio.txt
firmware:       brcm/brcmfmac43241b0-sdio.bin
firmware:       brcm/brcmfmac43143-sdio.txt
firmware:       brcm/brcmfmac43143-sdio.bin
firmware:       brcm/brcmfmac43569.bin
firmware:       brcm/brcmfmac43242a.bin
firmware:       brcm/brcmfmac43236b.bin
firmware:       brcm/brcmfmac43143.bin

Mine is:
Code: [Select]
vermagic:       4.4.20-v7 SMP mod_unload modversions ARMv7
The old is:
Code: [Select]
vermagic:       4.4.20-piCore_v7+ SMP mod_unload modversions ARMv7
kernel:
Code: [Select]
# uname -r
4.4.20-piCore_v7+

Now i need to find how to modify this value, or provide the proper kernel source if that's the problem and if available.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 28, 2018, 01:29:22 AM
Code: [Select]
# cd /mnt/mmcblk0p4/4.4.20
# echo "#define UTS_RELEASE \"4.4.20-piCore_v7+\"" > include/generated/utsrelease.h
# cd /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
# make
# make install-firmware
...
  STATISTICS DISABLED to enable: delete /mnt/mmcblk0p4/nexmon/DISABLE_STATISTICS
  COMPILING src/version.c => obj/version.o (details: log/compiler.log)
  GENERATING LINKER FILE gen/nexmon.pre => gen/nexmon.ld
  GENERATING LINKER FILE gen/nexmon.pre => gen/flashpatches.ld
  LINKING OBJECTS => gen/patch.elf (details: log/linker.log, log/linker.err)
  GENERATING MAKE FILE gen/nexmon.pre => gen/nexmon.mk
  GENERATING MAKE FILE gen/nexmon.pre => gen/flashpatches.mk
  APPLYING FLASHPATCHES gen/flashpatches.mk => brcmfmac43430-sdio.bin (details: log/flashpatches.log)
  APPLYING PATCHES gen/nexmon.mk => brcmfmac43430-sdio.bin (details: log/patches.log)
  BUILDING DRIVER for kernel 4.4 brcmfmac_kernel44/brcmfmac.ko (details: log/driver.log)
  COPYING brcmfmac43430-sdio.bin => /lib/firmware/brcm/brcmfmac43430-sdio.bin
  RELOADING brcmfmac
insmod: can't insert 'brcmfmac_kernel44/brcmfmac.ko': invalid module format
make: *** [Makefile:187: install-firmware] Error 8

Code: [Select]
# cd /mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
# modinfo brcmfmac_kernel44/brcmfmac.ko
filename:       brcmfmac_kernel44/brcmfmac.ko
license:        Dual BSD/GPL
author:         Broadcom Corporation
description:    Broadcom 802.11 wireless LAN fullmac driver.
alias:          usb:v0A5Cp0BDCd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD27d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD1Fd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD17d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0A5CpBD1Ed*dc*dsc*dp*ic*isc*ip*in*
alias:          sdio:c*v02D0d4354*
alias:          sdio:c*v02D0d4345*
alias:          sdio:c*v02D0dA9A6*
alias:          sdio:c*v02D0d4335*
alias:          sdio:c*v02D0dA962*
alias:          sdio:c*v02D0dA94D*
alias:          sdio:c*v02D0dA94C*
alias:          sdio:c*v02D0d4334*
alias:          sdio:c*v02D0d4330*
alias:          sdio:c*v02D0d4329*
alias:          sdio:c*v02D0d4324*
alias:          sdio:c*v02D0dA887*
srcversion:     489A257663CD4221CF8BDED
depends:       
vermagic:       4.4.20-piCore_v7+ SMP mod_unload modversions ARMv7
parm:           roamoff:do not use internal roaming engine
parm:           fcmode:mode of firmware signalled flow control
parm:           p2pon:enable legacy p2p management functionality
parm:           debug:level of debug output
parm:           feature_disable:Disable features
parm:           txglomsz:maximum tx packet chain size [SDIO]
firmware:       brcm/brcmfmac4354-sdio.txt
firmware:       brcm/brcmfmac4354-sdio.bin
firmware:       brcm/brcmfmac43455-sdio.txt
firmware:       brcm/brcmfmac43455-sdio.bin
firmware:       brcm/brcmfmac43430-sdio.txt
firmware:       brcm/brcmfmac43430-sdio.bin
firmware:       brcm/brcmfmac4339-sdio.txt
firmware:       brcm/brcmfmac4339-sdio.bin
firmware:       brcm/brcmfmac43362-sdio.txt
firmware:       brcm/brcmfmac43362-sdio.bin
firmware:       brcm/brcmfmac4335-sdio.txt
firmware:       brcm/brcmfmac4335-sdio.bin
firmware:       brcm/brcmfmac43341-sdio.txt
firmware:       brcm/brcmfmac43341-sdio.bin
firmware:       brcm/brcmfmac43340-sdio.txt
firmware:       brcm/brcmfmac43340-sdio.bin
firmware:       brcm/brcmfmac4334-sdio.txt
firmware:       brcm/brcmfmac4334-sdio.bin
firmware:       brcm/brcmfmac4330-sdio.txt
firmware:       brcm/brcmfmac4330-sdio.bin
firmware:       brcm/brcmfmac4329-sdio.txt
firmware:       brcm/brcmfmac4329-sdio.bin
firmware:       brcm/brcmfmac43241b5-sdio.txt
firmware:       brcm/brcmfmac43241b5-sdio.bin
firmware:       brcm/brcmfmac43241b4-sdio.txt
firmware:       brcm/brcmfmac43241b4-sdio.bin
firmware:       brcm/brcmfmac43241b0-sdio.txt
firmware:       brcm/brcmfmac43241b0-sdio.bin
firmware:       brcm/brcmfmac43143-sdio.txt
firmware:       brcm/brcmfmac43143-sdio.bin
firmware:       brcm/brcmfmac43569.bin
firmware:       brcm/brcmfmac43242a.bin
firmware:       brcm/brcmfmac43236b.bin
firmware:       brcm/brcmfmac43143.bin

Code: [Select]
vermagic:       4.4.20-piCore_v7+ SMP mod_unload modversions ARMv7
:o

It looks like my kernel source really doesn't correspond with the compiled kernel i have. It must have some other way of verification too, like hash of something or other.
Title: Re: broadcom nexmon monitor mode
Post by: curaga on May 28, 2018, 02:27:05 AM
You ran "make bcm2709_defconfig", that is, you used the correct kernel source but different config. Download the correct config from the same directory, unpack it as ".config" in the kernel dir, and run "make oldconfig" instead of the bcm*defconfig.
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 28, 2018, 07:43:48 PM
You ran "make bcm2709_defconfig", that is, you used the correct kernel source but different config. Download the correct config from the same directory, unpack it as ".config" in the kernel dir, and run "make oldconfig" instead of the bcm*defconfig.

I added the .config and still got the same, however, after adding the symvers i managed to compile and load the kernel module.

Now, i don't see wlan0 and on nexutil -m2 i get Segmentation fault, dmesg complains about a null pointer somewhere. Maybe it's a conflict with the existing broadcom util driver, but i believe i am not compiling the module as i should, most likely i've messed up something in putting together the kernel sources.

Does this part look sane to you?
Code: [Select]
# uname -a
Linux box 4.4.20-piCore_v7+ #1 SMP Wed Sep 7 22:53:19 CEST 2016 armv7l GNU/Linux
Code: [Select]
cd /mnt/mmcblk0p4
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20_RaspberryPi_src.tar.xz
tar -xf 4.4.20_RaspberryPi_src.tar.xz
ln -s /mnt/mmcblk0p4/4.4.20 /lib/modules/`uname -r`/build
cd /mnt/mmcblk0p4/4.4.20
make mrproper
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20-piCore_v7%2B_.config.xz
unxz 4.4.20-piCore_v7\%2B_.config.xz
mv 4.4.20-piCore_v7\%2B_.config .config
KERNEL=kernel7+
#KERNEL=4.4.20-piCore_v7+
#make bcm2709_defconfig
make oldconfig
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20-piCore_v7%2B_Module.symvers.xz
unxz 4.4.20-piCore_v7%2B_Module.symvers.xz
mv 4.4.20-piCore_v7%2B_Module.symvers Module.symvers
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20-piCore_v7%2B_System.map.xz
unxz 4.4.20-piCore_v7%2B_System.map.xz
mv 4.4.20-piCore_v7%2B_System.map System.map
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20-piCore_v7%2B_modules.tar.xz
tar -xf 4.4.20-piCore_v7%2B_modules.tar.xz
make modules_prepare
echo "#define UTS_RELEASE \"4.4.20-piCore_v7+\"" > include/generated/utsrelease.h

Code: [Select]
# ls -la /mnt/mmcblk0p4/4.4.20
total 14040
drwxr-xr-x  26 root root      4096 May 29 01:58 .
drwxr-xr-x   7 tc   staff     4096 May 28 03:05 ..
-rw-r--r--   1 root root    132817 May 29 01:57 .config
-rw-r--r--   1 root root    132817 May 29 01:57 .config.old
-rw-r--r--   1 root root        31 Sep  7  2016 .get_maintainer.ignore
-rw-r--r--   1 root root      1280 Sep  7  2016 .gitignore
-rw-r--r--   1 root root      5537 Sep  7  2016 .mailmap
-rw-r--r--   1 root root       351 May 29 01:58 .missing-syscalls.d
drwxr-xr-x   2 root root      4096 May 29 01:58 .tmp_versions
lrwxrwxrwx   1 root root        21 May 28 23:34 4.4.20 -> /mnt/mmcblk0p4/4.4.20
-rw-r--r--   1 root root  10638732 May 28 23:30 4.4.20-piCore_v7%2B_modules.tar.xz
-rw-r--r--   1 root root     18693 Sep  7  2016 COPYING
-rw-r--r--   1 root root     97181 Sep  7  2016 CREDITS
drwxr-xr-x 112 root root     12288 May 28 23:32 Documentation
-rw-r--r--   1 root root      2622 Sep  7  2016 Kbuild
-rw-r--r--   1 root root       252 Sep  7  2016 Kconfig
-rw-r--r--   1 root root    337034 Sep  7  2016 MAINTAINERS
-rw-r--r--   1 root root     54818 Sep  7  2016 Makefile
-rw-r--r--   1 root root    665047 May 29 01:57 Module.symvers
-rw-r--r--   1 root root     18599 Sep  7  2016 README
-rw-r--r--   1 root root      7485 Sep  7  2016 REPORTING-BUGS
-rw-r--r--   1 root root   2097915 May 29 01:57 System.map
drwxr-xr-x  33 root root      4096 May 28 23:33 arch
drwxr-xr-x   3 root root      4096 May 28 23:33 block
drwxr-xr-x   2 root root      4096 May 28 23:33 certs
drwxr-xr-x   4 root root      4096 May 28 23:31 crypto
drwxr-xr-x 128 root root      4096 May 28 23:32 drivers
drwxr-xr-x  36 1003 staff     4096 May 29 01:57 firmware
drwxr-xr-x  73 root root      4096 May 28 23:34 fs
drwxr-xr-x  30 root root      4096 May 29 01:57 include
drwxr-xr-x   2 root root      4096 May 28 23:33 init
drwxr-xr-x   2 root root      4096 May 28 23:31 ipc
drwxr-xr-x  16 root root      4096 May 29 01:58 kernel
drwxr-xr-x  12 root root     12288 May 28 23:31 lib
drwxr-xr-x   3 root root      4096 May 28 23:31 mm
drwxr-xr-x   3 1003 staff     4096 Sep  8  2016 modules
drwxr-xr-x  60 root root      4096 May 28 23:33 net
drwxr-xr-x  16 root root      4096 May 28 23:33 samples
drwxr-xr-x  13 root root      4096 May 29 01:58 scripts
drwxr-xr-x   9 root root      4096 May 28 23:31 security
drwxr-xr-x  23 root root      4096 May 28 23:31 sound
drwxr-xr-x  23 root root      4096 May 28 23:33 tools
drwxr-xr-x   2 root root      4096 May 28 23:33 usr
drwxr-xr-x   4 root root      4096 May 28 23:31 virt

PS: Failure info.
Code: [Select]
# pwd
/mnt/mmcblk0p4/nexmon/patches/bcm43430a1/7_45_41_46/nexmon
# rmmod brcmfmac
# rmmod brcmutil
# modprobe brcmutil
# insmod brcmfmac_kernel44/brcmfmac.ko
# nexutil -m2
Segmentation fault
Code: [Select]
# dmesg
...
[278916.962690] usbcore: deregistering interface driver brcmfmac
[278950.722072] brcmfmac: Unknown symbol brcmu_pktq_mlen (err 0)
[278950.727857] brcmfmac: Unknown symbol brcmu_pkt_buf_free_skb (err 0)
[278950.733522] brcmfmac: Unknown symbol brcmu_pktq_init (err 0)
[278950.738593] brcmfmac: Unknown symbol brcmu_pktq_penq_head (err 0)
[278950.743600] brcmfmac: Unknown symbol brcmu_dotrev_str (err 0)
[278950.748941] brcmfmac: Unknown symbol brcmu_pktq_flush (err 0)
[278950.753398] brcmfmac: Unknown symbol brcmu_pktq_peek_tail (err 0)
[278950.757873] brcmfmac: Unknown symbol brcmu_pktq_pdeq_match (err 0)
[278950.762001] brcmfmac: Unknown symbol brcmu_pktq_mdeq (err 0)
[278950.765835] brcmfmac: Unknown symbol brcmu_pktq_penq (err 0)
[278950.769517] brcmfmac: Unknown symbol brcmu_pktq_pdeq_tail (err 0)
[278950.773246] brcmfmac: Unknown symbol brcmu_pkt_buf_get_skb (err 0)
[278950.776916] brcmfmac: Unknown symbol brcmu_d11_attach (err 0)
[278965.510390] brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done for chip 43430 rev 1 pmurev 24
[278965.517794] usbcore: registered new interface driver brcmfmac
[278965.522108] brcmfmac_sdio mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.txt failed with error -2
[278983.775900] brcmfmac: nexmon_nl_ioctl_handler: NEXMON: nexmon_nl_ioctl_handler: Enter
[278983.782173] brcmfmac: nexmon_nl_ioctl_handler: NEXMON: nexmon_nl_ioctl_handler: 0058454e 20 36
[278983.788501] brcmfmac: nexmon_nl_ioctl_handler: NEXMON: nexmon_nl_ioctl_handler: calling brcmf_fil_cmd_data_set, cmd: 108
[278983.794749] Unable to handle kernel NULL pointer dereference at virtual address 000004c0
[278983.801205] pgd = 9f2d8000
[278983.804529] [000004c0] *pgd=37c7b831, *pte=00000000, *ppte=00000000
[278983.808001] Internal error: Oops: 17 [#7] SMP ARM
[278983.811347] Modules linked in: brcmfmac(O) brcmutil cls_u32 sch_prio ip6table_filter ip6_tables xt_CT xt_length xt_limit xt_tcpudp xt_physdev br_netfilter bridge stp llc iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_raw iptable_filter ip_tables x_tables sch_tbf sch_netem ipv6 i2c_dev cfg80211 rfkill snd_soc_bcm2835_i2s snd_soc_core snd_pcm_dmaengine snd_bcm2835 snd_pcm snd_timer snd squashfs spi_bcm2835 i2c_bcm2708 bcm2835_gpiomem bcm2835_wdt uio_pdrv_genirq uio [last unloaded: brcmutil]
[278983.838392] CPU: 2 PID: 16035 Comm: nexutil Tainted: G      D    O    4.4.20-piCore_v7+ #1
[278983.846494] Hardware name: BCM2709
[278983.850620] task: adff5080 ti: b1698000 task.ti: b1698000
[278983.854830] PC is at brcmf_fil_cmd_data_set+0x1c/0x6c [brcmfmac]
[278983.859021] LR is at nexmon_nl_ioctl_handler+0x168/0x380 [brcmfmac]
[278983.863082] pc : [<7f877304>]    lr : [<7f87dd10>]    psr: 60000013
                sp : b1699db0  ip : b1699dd8  fp : b1699dd4
[278983.871110] r10: b8725240  r9 : 00000000  r8 : 00000000
[278983.875100] r7 : 000004c0  r6 : 7f894b4c  r5 : ade7f310  r4 : 000004c0
[278983.879044] r3 : 00000004  r2 : ade7f320  r1 : 0000006c  r0 : 000004c0
[278983.883039] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[278983.887058] Control: 10c5383d  Table: 1f2d806a  DAC: 00000055
[278983.891078] Process nexutil (pid: 16035, stack limit = 0xb1698210)
[278983.894958] Stack: (0xb1699db0 to 0xb169a000)
[278983.898764] 9da0:                                     ade7f310 b1699dcc ade7f300 ade7f310
[278983.906610] 9dc0: 7f894b4c 000004c0 b1699e04 b1699dd8 7f87dd10 7f8772f4 00000014 00000024
[278983.914854] 9de0: b3151800 b3150800 b3151800 00000024 b8725240 00000000 b1699e34 b1699e08
[278983.923778] 9e00: 80508318 7f87dbb4 00000000 7fffffff b3151800 b1699ec4 b3151800 00000000
[278983.933137] 9e20: 00000024 00000000 b1699e94 b1699e38 805087dc 805081a0 bfbaf617 af089b84
[278983.943105] 9e40: 00000000 b908b268 b3151800 00000000 00000001 a8c1cd00 00000000 00003ea3
[278983.953502] 9e60: 00000000 00000000 805063dc 00000000 00000000 b8ee1c80 00000121 8000fc68
[278983.964408] 9e80: b1698000 00000000 b1699ea4 b1699e98 804bb910 805084bc b1699f8c b1699ea8
[278983.975995] 9ea0: 804bc98c 804bb8f8 b1699ecc b1699eb8 805067b0 fffffff7 00000000 0103f2a8
[278983.988241] 9ec0: 00000024 00000000 00000000 00000001 00000000 00000000 b1699ec4 00000000
[278984.001072] 9ee0: 00000000 00000000 00000000 0103f288 b1699fa4 b1699f00 804bc748 805067f4
[278984.014473] 9f00: 00000000 00000000 00000010 00000000 00000000 00000011 00000001 00000001
[278984.028414] 9f20: b1699f6c b1699f30 804c13d0 804bf624 b1699f74 80172db0 b1699f54 b1699f48
[278984.042960] 9f40: 80172db0 00000008 00000001 b8ee1b00 7ec53510 00000014 b1698000 00000000
[278984.057887] 9f60: b1699fa4 b1699f70 804bcbc8 804c113c 00000008 7ec53a78 00015154 00000000
[278984.072872] 9f80: b1699fa4 b1699f90 804bc9dc 804bc8d0 00000000 00000000 00000000 b1699fa8
[278984.087928] 9fa0: 8000faa0 804bc9c0 7ec53a78 00015154 00000003 0103f2a8 00000024 00000000
[278984.103015] 9fc0: 7ec53a78 00015154 00000000 00000121 00000000 00000000 00000000 7ec534fc
[278984.118155] 9fe0: 00000000 7ec534b4 0001429c 0002e65c 40000010 00000003 93084693 f83af7ff
[278984.133423] [<7f877304>] (brcmf_fil_cmd_data_set [brcmfmac]) from [<7f87dd10>] (nexmon_nl_ioctl_handler+0x168/0x380 [brcmfmac])
[278984.148313] [<7f87dd10>] (nexmon_nl_ioctl_handler [brcmfmac]) from [<80508318>] (netlink_unicast+0x184/0x254)
[278984.162565] [<80508318>] (netlink_unicast) from [<805087dc>] (netlink_sendmsg+0x32c/0x34c)
[278984.176351] [<805087dc>] (netlink_sendmsg) from [<804bb910>] (sock_sendmsg+0x24/0x34)
[278984.189718] [<804bb910>] (sock_sendmsg) from [<804bc98c>] (SyS_sendto+0xc8/0xf0)
[278984.202614] [<804bc98c>] (SyS_sendto) from [<804bc9dc>] (SyS_send+0x28/0x30)
[278984.209030] [<804bc9dc>] (SyS_send) from [<8000faa0>] (ret_fast_syscall+0x0/0x1c)
[278984.221136] Code: e24dd008 e52de004 e8bd4000 e1a04000 (e5900000)
[278984.226410] ---[ end trace 413dd680596d897b ]---

Code: [Select]
# lsmod | egrep "brcm"
brcmfmac             2288969  0
brcmutil                5901  1 brcmfmac
cfg80211              440795  1 brcmfmac
Title: Re: broadcom nexmon monitor mode
Post by: Јаневски on May 28, 2018, 09:51:32 PM
I tried this too, but i get the same segfault after module load and typing nexutil -m2:
Code: [Select]
cd /mnt/mmcblk0p4/4.4.20
make mrproper
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20-piCore_v7%2B_.config.xz
unxz 4.4.20-piCore_v7\%2B_.config.xz
mv 4.4.20-piCore_v7\%2B_.config .config
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20-piCore_v7%2B_Module.symvers.xz
unxz 4.4.20-piCore_v7%2B_Module.symvers.xz
mv 4.4.20-piCore_v7%2B_Module.symvers Module.symvers
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20-piCore_v7%2B_System.map.xz
unxz 4.4.20-piCore_v7%2B_System.map.xz
mv 4.4.20-piCore_v7%2B_System.map System.map
wget http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20-piCore_v7%2B_modules.tar.xz
tar -xf 4.4.20-piCore_v7%2B_modules.tar.xz
KERNEL=kernel7+
make oldconfig
make modules_prepare
echo "#define UTS_RELEASE \"4.4.20-piCore_v7+\"" > include/generated/utsrelease.h
Title: Re: broadcom nexmon monitor mode
Post by: curaga on May 29, 2018, 03:26:50 AM
That looks like a bug in the module, not something you caused.