##// END OF EJS Templates
a
a

Fichier de la dernière révision:

r458:17a59b052c06
r458:17a59b052c06
Show More
44-nexmon_monitor_patch.sh
106 lines | 3.9 KiB | application/x-sh | BashLexer
/ bootstrap.d / 44-nexmon_monitor_patch.sh
Unknown
a
r457 #!/bin/sh
Unknown
Nexmon
r444 #
Unknown
a
r449 # Build and Setup nexmon with monitor mode patch
Unknown
Nexmon
r444 #
# Load utility functions
. ./functions.sh
Unknown
a
r446 if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then
Unknown
a
r445
# Create temporary directory for nexmon sources
temp_dir=$(as_nobody mktemp -d)
# Fetch nexmon sources
as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}"
# Copy downloaded nexmon sources
mv "${temp_dir}/nexmon" "${R}"/tmp/
# Set permissions of the nexmon sources
chown -R root:root "${R}"/tmp/nexmon
Unknown
a
r446
# Set script Root
Unknown
a
r458 export NEXMON_ROOT="${R}"/tmp/nexmon
Unknown
a
r445
# Remove temporary directory for nexmon sources
rm -fr "${temp_dir}"
Unknown
a
r446 # Build nexmon firmware outside the build system, if we can.
Unknown
a
r457 cd "${NEXMON_ROOT}" || exit
Unknown
a
r446
# Disable statistics
touch DISABLE_STATISTICS
# Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh
Unknown
a
r450 #ARCH="${KERNEL_ARCH}"
#SUBARCH="${KERNEL_ARCH}"
Unknown
a
r458 export KERNEL="${KERNEL_IMAGE}"
export ARCH=arm
export SUBARCH=arm
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"
export Q=@
export NEXMON_SETUP_ENV=1
export HOSTUNAME=$(uname -s)
export PLATFORMUNAME=$(uname -m)
Unknown
a
r457 #. ./setup_env.sh
Unknown
a
r446
# Make nexmon
make
# Make ancient isl build
Unknown
a
r457 cd buildtools/isl-0.10 || exit
Unknown
set kernel default governor
r455 CC="${CC}"gcc
Unknown
a
r446 ./configure
make
Unknown
a
r445
Unknown
a
r446 # build patches
if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then
Unknown
a
r457 cd "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon || exit
Unknown
a
r446 make clean
# We do this so we don't have to install the ancient isl version into /usr/local/lib on systems.
Unknown
a
r457 LD_LIBRARY_PATH="${NEXMON_ROOT}"/buildtools/isl-0.10/.libs make ARCH="${KERNEL_ARCH}" CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi-
Unknown
a
r446
# copy RPi0W & RPi3 firmware
Unknown
a
r450 mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.org.bin
Unknown
a
r457 cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.nexmon.bin
cp -f "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin
Unknown
a
r446 fi
if [ "$RPI_MODEL" = 3P ] ; then
Unknown
a
r457 cd "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon || exit
Unknown
a
r446 make clean
# We do this so we don't have to install the ancient isl version into /usr/local/lib on systems.
Unknown
a
r457 LD_LIBRARY_PATH=${NEXMON_ROOT}/buildtools/isl-0.10/.libs make ARCH="${KERNEL_ARCH}" CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi-
Unknown
a
r446
# RPi3B+ firmware
Unknown
a
r450 mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.org.bin
Unknown
a
r457 cp "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.nexmon.bin
cp -f "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin
Unknown
a
r446 fi
Unknown
a
r454
Unknown
a
r458 # Install kernel module
"${LIB_DIR}"/modules/${KERNEL_VERSION}/
Unknown
a
r454 #Revert to previous directory
Unknown
a
r457 cd "${WORKDIR}" || exit
Unknown
a
r454
Unknown
a
r446 fi
Unknown
a
r458
## To make the RPi load the modified driver after reboot
# Find the path of the default driver at reboot
# e.g. '/lib/modules/4.14.71-v7+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko'
PATH_OF_DEFAULT_DRIVER_AT_REBOOT=$(modinfo brcmfmac | grep -m 1 -oP "^filename:(\s*?)(.*)$" | sed -e 's/^filename:\(\s*\)\(.*\)$/\2/g')
# Backup the original driver
mv $PATH_OF_DEFAULT_DRIVER_AT_REBOOT "$PATH_OF_DEFAULT_DRIVER_AT_REBOOT.orig"
# Copy the modified driver (Kernel 4.14)
if is_pizero ; then
cp ./patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac_4.14.y-nexmon/brcmfmac.ko $PATH_OF_DEFAULT_DRIVER_AT_REBOOT
else
cp ./patches/bcm43455c0/7_45_154/nexmon/brcmfmac_4.14.y-nexmon/brcmfmac.ko $PATH_OF_DEFAULT_DRIVER_AT_REBOOT
fi
# Probe all modules and generate new dependency
depmod -a