From 88966a4516b3f221e6dac098af23b3a7806cf72d 2018-11-28 01:30:50 From: Unknown Date: 2018-11-28 01:30:50 Subject: [PATCH] a --- diff --git a/README.md b/README.md index e32ad25..dbd9469 100644 --- a/README.md +++ b/README.md @@ -242,7 +242,7 @@ Path to a directory (`userland`) of [Source code for a C-based firmware patching ##### `ENABLE_NEXMON`=false Install and enable the [Source code for a C-based firmware patching framework for Broadcom/Cypress WiFi chips that enables you to write your own firmware patches, for example, to enable monitor mode with radiotap headers and frame injection](https://github.com/seemoo-lab/nexmon.git). -##### `NEXMON_DIR`="" +##### `NEXMONSRC_DIR`="" Path to a directory (`nexmon`) of [Source code for ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) that will be copied, configured, build and installed inside the chroot. ##### `ENABLE_IPTABLES`=false diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index b669013..a14c8fc 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -32,8 +32,7 @@ if [ "$BUILD_KERNEL" = true ] ; then else as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux fi - fi - + fi # Copy downloaded kernel sources cp -r "${temp_dir}/linux/"* "${KERNEL_DIR}" diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index 5e33831..40c7ada 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -5,7 +5,7 @@ # Load utility functions . ./functions.sh -if [ "$BUILD_KERNEL" = true ] ; then +#if [ "$BUILD_KERNEL" = true ] ; then if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then # Install boot binaries from local directory cp "${RPI_FIRMWARE_DIR}"/boot/bootcode.bin "${BOOT_DIR}"/bootcode.bin @@ -38,7 +38,7 @@ if [ "$BUILD_KERNEL" = true ] ; then chown -R root:root "${BOOT_DIR}" chmod -R 600 "${BOOT_DIR}" fi -fi +#fi # Setup firmware boot cmdline if [ "$ENABLE_UBOOTUSB" = true ] ; then diff --git a/bootstrap.d/44-nexmon_monitor_patch.sh b/bootstrap.d/44-nexmon_monitor_patch.sh index aa37ef0..8e2984f 100644 --- a/bootstrap.d/44-nexmon_monitor_patch.sh +++ b/bootstrap.d/44-nexmon_monitor_patch.sh @@ -7,28 +7,39 @@ . ./functions.sh if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then + # 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) - # Create temporary directory for nexmon sources - temp_dir=$(as_nobody mktemp -d) + # Fetch nexmon sources + as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}" - # Fetch nexmon sources - as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}" + # Copy downloaded nexmon sources + mv "${temp_dir}/nexmon" "${R}"/tmp/ - # Copy downloaded nexmon sources - mv "${temp_dir}/nexmon" "${R}"/tmp/ + # Set permissions of the nexmon sources + chown -R root:root "${R}"/tmp/nexmon - # Set permissions of the nexmon sources - chown -R root:root "${R}"/tmp/nexmon - + # Remove temporary directory for nexmon sources + rm -fr "${temp_dir}" + fi + # Set script Root export NEXMON_ROOT="${R}"/tmp/nexmon - # Remove temporary directory for nexmon sources - rm -fr "${temp_dir}" - # Build nexmon firmware outside the build system, if we can. cd "${NEXMON_ROOT}" || exit + # Make ancient isl build + cd buildtools/isl-0.10 || exit + CC="${CC}"gcc + ./configure + make + # Disable statistics touch DISABLE_STATISTICS @@ -49,12 +60,6 @@ if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then # Make nexmon make - - # Make ancient isl build - cd buildtools/isl-0.10 || exit - CC="${CC}"gcc - ./configure - make # Backup stock broadcom wlan driver - "${LIB_DIR}"/modules/${KERNEL_VERSION}/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko brcmfmac_path=$(modinfo brcmfmac | grep -m 1 -oP "^filename:(\s*?)(.*)$" | sed -e 's/^filename:\(\s*\)\(.*\)$/\2/g') diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 2529d28..27dec1c 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -159,7 +159,7 @@ ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=false} ENABLE_NEXMON=${ENABLE_NEXMON:=false} VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""} FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""} -NEXMON_DIR=${NEXMON_DIR:=""} +NEXMONSRC_DIR=${NEXMONSRC_DIR:=""} ENABLE_HARDNET=${ENABLE_HARDNET:=false} ENABLE_IPTABLES=${ENABLE_IPTABLES:=false} ENABLE_SPLITFS=${ENABLE_SPLITFS:=false} @@ -372,6 +372,11 @@ if [ "$ENABLE_VIDEOCORE" = true ] ; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cmake" fi +# Add deps for nexmon +if [ "$ENABLE_NEXMON" = true ] ; then + REQUIRED_PACKAGES="${REQUIRED_PACKAGES},libgmp3-dev,gawk,qpdf,bison,flex,make,autoconf,automake,build-essential,libtool" +fi + # Add libncurses5 to enable kernel menuconfig if [ "$KERNEL_MENUCONFIG" = true ] ; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses-dev" @@ -486,9 +491,9 @@ if [ -n "$FBTURBOSRC_DIR" ] && [ ! -d "$FBTURBOSRC_DIR" ] ; then exit 1 fi -# Check if specified NEXMON_DIR directory exists -if [ -n "$NEXMON_DIR" ] && [ ! -d "$NEXMON_DIR" ] ; then - echo "error: '${NEXMON_DIR}' specified directory not found (NEXMON_DIR)!" +# Check if specified NEXMONSRC_DIR directory exists +if [ -n "$NEXMONSRC_DIR" ] && [ ! -d "$NEXMONSRC_DIR" ] ; then + echo "error: '${NEXMONSRC_DIR}' specified directory not found (NEXMONSRC_DIR)!" exit 1 fi