diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index 56aab27..0591f58 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -107,9 +107,9 @@ if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules" # Install Firmware Flash file and apropiate licence - mkdir "${ETC_DIR}/firmware/" - install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" - install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" + mkdir -p "$BLUETOOTH_FIRMWARE_DIR" + install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx" + install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx" install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service" install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service" diff --git a/bootstrap.d/44-nexmon_monitor_patch.sh b/bootstrap.d/44-nexmon_monitor_patch.sh index fba0076..976e2b3 100644 --- a/bootstrap.d/44-nexmon_monitor_patch.sh +++ b/bootstrap.d/44-nexmon_monitor_patch.sh @@ -5,7 +5,7 @@ # Load utility functions . ./functions.sh -if [ "$ENABLE_NEXMON" = true ] ; then +if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then # Create temporary directory for nexmon sources temp_dir=$(as_nobody mktemp -d) @@ -18,49 +18,60 @@ if [ "$ENABLE_NEXMON" = true ] ; then # Set permissions of the nexmon sources chown -R root:root "${R}"/tmp/nexmon + + # Set script Root + NEXMON_ROOT="${R}"/tmp/nexmon # Remove temporary directory for nexmon sources rm -fr "${temp_dir}" -fi -# Build nexmon firmware outside the build system, if we can. -cd "${R}"/tmp/nexmon -# Disable statistics -touch DISABLE_STATISTICS -# Setup Enviroment -source setup_env.sh -# Make nexmon -make -# Make ancient isl build -cd buildtools/isl-0.10 -CC="$CROSS_COMPILE" -./configure -make + # Build nexmon firmware outside the build system, if we can. + cd "${NEXMON_ROOT}" + + # Disable statistics + touch DISABLE_STATISTICS + + # Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh + ARCH="${KERNEL_ARCH}" + SUBARCH="${KERNEL_ARCH}" + KERNEL="${KERNEL_IMAGE}" + CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- + CCPLUGIN="${NEXMON_ROOT}"/buildtools/gcc-nexmon-plugin/nexmon.so + ZLIBFLATE="zlib-flate -compress" + Q=@ + NEXMON_SETUP_ENV=1 + + # Make nexmon + make + + # Make ancient isl build + cd buildtools/isl-0.10 + CC=$CCgcc + ./configure + make -# build patches -cd ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon -# Make sure we use the cross compiler to build the firmware. -# We use the x86 cross compiler because we're building on amd64 -#unset CROSS_COMPILE -#export CROSS_COMPILE=${NEXMON_ROOT}/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- -make clean -# We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. -LD_LIBRARY_PATH=${NEXMON_ROOT}/buildtools/isl-0.10/.libs make ARCH=arm CC="$CROSS_COMPILE" -cd ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon -make clean -LD_LIBRARY_PATH=${NEXMON_ROOT}/buildtools/isl-0.10/.libs make ARCH=arm CC="$CROSS_COMPILE" -# RPi0w->3B firmware -mkdir -p "${basedir}"/kali-${architecture}/lib/firmware/brcm -cp ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.nexmon.bin -cp ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.bin -#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43430-sdio.txt -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.txt -# RPi3B+ firmware -cp ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.nexmon.bin -cp ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.bin -#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.txt -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.txt -# Make a backup copy of the rpi firmware in case people don't want to use the nexmon firmware. -# The firmware used on the RPi is not the same firmware that is in the firmware-brcm package which is why we do this. -#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43430-sdio.bin -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43430-sdio.rpi.bin -#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.bin -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.rpi.bin -# This is required for any wifi to work on the RPi 3B+ -#wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/master/brcm/brcmfmac43455-sdio.clm_blob -O "${basedir}"/kali-${architecture}/lib/firmware/brcm/brcmfmac43455-sdio.clm_blob + # build patches + if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then + cd ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon + make clean + + # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. + 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- + + # copy RPi0W & RPi3 firmware + 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 + fi + + if [ "$RPI_MODEL" = 3P ] ; then + cd ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon + make clean + + # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. + 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- + + # RPi3B+ firmware + 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 + fi +fi diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 043f228..8ddb426 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -77,6 +77,7 @@ LIB_DIR="${R}/lib" BOOT_DIR="${R}/boot/firmware" KERNEL_DIR="${R}/usr/src/linux" WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm" +BLUETOOTH_FIRMWARE_DIR="${ETC_DIR}/firmware/bt" # Firmware directory: Blank if download from github RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}