44-nexmon_monitor_patch.sh
97 lines
| 3.5 KiB
| application/x-sh
|
BashLexer
/ bootstrap.d / 44-nexmon_monitor_patch.sh
Unknown
|
r457 | #!/bin/sh | ||
Unknown
|
r444 | # | ||
Unknown
|
r449 | # Build and Setup nexmon with monitor mode patch | ||
Unknown
|
r444 | # | ||
# Load utility functions | ||||
. ./functions.sh | ||||
Unknown
|
r446 | if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then | ||
Unknown
|
r471 | # Copy existing nexmon sources into chroot directory | ||
if [ -n "$NEXMONSRC_DIR" ] && [ -d "$NEXMONSRC_DIR" ] ; then | ||||
# Copy local U-Boot sources | ||||
cp -r "${NEXMONSRC_DIR}" "${R}/tmp" | ||||
else | ||||
# Create temporary directory for nexmon sources | ||||
temp_dir=$(as_nobody mktemp -d) | ||||
Unknown
|
r445 | |||
Unknown
|
r471 | # Fetch nexmon sources | ||
as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}" | ||||
Unknown
|
r445 | |||
Unknown
|
r471 | # Copy downloaded nexmon sources | ||
mv "${temp_dir}/nexmon" "${R}"/tmp/ | ||||
Unknown
|
r445 | |||
Unknown
|
r471 | # Set permissions of the nexmon sources | ||
chown -R root:root "${R}"/tmp/nexmon | ||||
Unknown
|
r445 | |||
Unknown
|
r471 | # Remove temporary directory for nexmon sources | ||
rm -fr "${temp_dir}" | ||||
fi | ||||
Unknown
|
r446 | # Set script Root | ||
Unknown
|
r458 | export NEXMON_ROOT="${R}"/tmp/nexmon | ||
Unknown
|
r445 | |||
Unknown
|
r446 | # Build nexmon firmware outside the build system, if we can. | ||
Unknown
|
r457 | cd "${NEXMON_ROOT}" || exit | ||
Unknown
|
r446 | |||
Unknown
|
r471 | # Make ancient isl build | ||
cd buildtools/isl-0.10 || exit | ||||
./configure | ||||
make | ||||
Unknown
|
r473 | cd ../.. || exit | ||
Unknown
|
r471 | |||
Unknown
|
r446 | # Disable statistics | ||
touch DISABLE_STATISTICS | ||||
# Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh | ||||
Unknown
|
r458 | export KERNEL="${KERNEL_IMAGE}" | ||
export ARCH=arm | ||||
export SUBARCH=arm | ||||
Unknown
|
r475 | export CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- | ||
export CC="${CC}"gcc | ||||
Unknown
|
r458 | 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
|
r446 | |||
# Make nexmon | ||||
make | ||||
Unknown
|
r445 | |||
Unknown
|
r446 | # build patches | ||
if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then | ||||
Unknown
|
r457 | cd "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon || exit | ||
Unknown
|
r479 | sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/Makefile | ||
Unknown
|
r446 | make clean | ||
# We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. | ||||
Unknown
|
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
|
r446 | |||
# copy RPi0W & RPi3 firmware | ||||
Unknown
|
r450 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.org.bin | ||
Unknown
|
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
|
r446 | fi | ||
if [ "$RPI_MODEL" = 3P ] ; then | ||||
Unknown
|
r457 | cd "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon || exit | ||
Unknown
|
r479 | sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/Makefile | ||
Unknown
|
r446 | make clean | ||
# We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. | ||||
Unknown
|
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
|
r446 | |||
# RPi3B+ firmware | ||||
Unknown
|
r450 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.org.bin | ||
Unknown
|
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
|
r446 | fi | ||
Unknown
|
r454 | |||
#Revert to previous directory | ||||
Unknown
|
r457 | cd "${WORKDIR}" || exit | ||
Unknown
|
r454 | |||
Unknown
|
r476 | # Remove nexmon sources | ||
rm -fr "${NEXMON_ROOT}" | ||||
Unknown
|
r446 | fi | ||