@@ -1,100 +1,105 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 | # |
|
2 | # | |
3 | # Build and Setup nexmon with monitor mode patch |
|
3 | # Build and Setup nexmon with monitor mode patch | |
4 | # |
|
4 | # | |
5 |
|
5 | |||
6 | # Load utility functions |
|
6 | # Load utility functions | |
7 | . ./functions.sh |
|
7 | . ./functions.sh | |
8 |
|
8 | |||
9 | if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then |
|
9 | if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then | |
10 | # Copy existing nexmon sources into chroot directory |
|
10 | # Copy existing nexmon sources into chroot directory | |
11 | if [ -n "$NEXMONSRC_DIR" ] && [ -d "$NEXMONSRC_DIR" ] ; then |
|
11 | if [ -n "$NEXMONSRC_DIR" ] && [ -d "$NEXMONSRC_DIR" ] ; then | |
12 | # Copy local U-Boot sources |
|
12 | # Copy local U-Boot sources | |
13 | cp -r "${NEXMONSRC_DIR}" "${R}/tmp" |
|
13 | cp -r "${NEXMONSRC_DIR}" "${R}/tmp" | |
14 | else |
|
14 | else | |
15 | # Create temporary directory for nexmon sources |
|
15 | # Create temporary directory for nexmon sources | |
16 | temp_dir=$(as_nobody mktemp -d) |
|
16 | temp_dir=$(as_nobody mktemp -d) | |
17 |
|
17 | |||
18 | # Fetch nexmon sources |
|
18 | # Fetch nexmon sources | |
19 | as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}" |
|
19 | as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}" | |
20 |
|
20 | |||
21 | # Copy downloaded nexmon sources |
|
21 | # Copy downloaded nexmon sources | |
22 | mv "${temp_dir}/nexmon" "${R}"/tmp/ |
|
22 | mv "${temp_dir}/nexmon" "${R}"/tmp/ | |
23 |
|
23 | |||
24 | # Set permissions of the nexmon sources |
|
24 | # Set permissions of the nexmon sources | |
25 | chown -R root:root "${R}"/tmp/nexmon |
|
25 | chown -R root:root "${R}"/tmp/nexmon | |
26 |
|
26 | |||
27 | # Remove temporary directory for nexmon sources |
|
27 | # Remove temporary directory for nexmon sources | |
28 | rm -fr "${temp_dir}" |
|
28 | rm -fr "${temp_dir}" | |
29 | fi |
|
29 | fi | |
30 |
|
30 | |||
31 | # Set script Root |
|
31 | # Set script Root | |
32 | export NEXMON_ROOT="${R}"/tmp/nexmon |
|
32 | export NEXMON_ROOT="${R}"/tmp/nexmon | |
33 |
|
33 | |||
34 | # Build nexmon firmware outside the build system, if we can. |
|
34 | # Build nexmon firmware outside the build system, if we can. | |
35 | cd "${NEXMON_ROOT}" || exit |
|
35 | cd "${NEXMON_ROOT}" || exit | |
36 |
|
36 | |||
37 | # Make ancient isl build |
|
37 | # Make ancient isl build | |
|
38 | export CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- | |||
|
39 | export CC="${CC}"gcc | |||
38 |
|
|
40 | cd buildtools/isl-0.10 || exit | |
39 | CC="${CC}"gcc |
|
|||
40 | ./configure |
|
41 | ./configure | |
41 | make |
|
42 | make | |
|
43 | cd ../.. || exit | |||
42 |
|
44 | |||
43 | # Disable statistics |
|
45 | # Disable statistics | |
44 | touch DISABLE_STATISTICS |
|
46 | touch DISABLE_STATISTICS | |
45 |
|
47 | |||
46 | # Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh |
|
48 | # Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh | |
47 | #ARCH="${KERNEL_ARCH}" |
|
49 | #ARCH="${KERNEL_ARCH}" | |
48 | #SUBARCH="${KERNEL_ARCH}" |
|
50 | #SUBARCH="${KERNEL_ARCH}" | |
49 | export KERNEL="${KERNEL_IMAGE}" |
|
51 | export KERNEL="${KERNEL_IMAGE}" | |
50 | export ARCH=arm |
|
52 | export ARCH=arm | |
51 | export SUBARCH=arm |
|
53 | export SUBARCH=arm | |
52 | export CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- |
|
54 | ||
53 | export CCPLUGIN="${NEXMON_ROOT}"/buildtools/gcc-nexmon-plugin/nexmon.so |
|
55 | export CCPLUGIN="${NEXMON_ROOT}"/buildtools/gcc-nexmon-plugin/nexmon.so | |
54 | export ZLIBFLATE="zlib-flate -compress" |
|
56 | export ZLIBFLATE="zlib-flate -compress" | |
55 | export Q=@ |
|
57 | export Q=@ | |
56 | export NEXMON_SETUP_ENV=1 |
|
58 | export NEXMON_SETUP_ENV=1 | |
57 | export HOSTUNAME=$(uname -s) |
|
59 | export HOSTUNAME=$(uname -s) | |
58 | export PLATFORMUNAME=$(uname -m) |
|
60 | export PLATFORMUNAME=$(uname -m) | |
59 | #. ./setup_env.sh |
|
61 | #. ./setup_env.sh | |
60 |
|
62 | |||
61 | # Make nexmon |
|
63 | # Make nexmon | |
62 | make |
|
64 | make | |
63 |
|
65 | |||
64 | # Backup stock broadcom wlan driver - "${LIB_DIR}"/modules/${KERNEL_VERSION}/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko |
|
66 | # Backup stock broadcom wlan driver - "${LIB_DIR}"/modules/${KERNEL_VERSION}/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko | |
65 | brcmfmac_path=$(modinfo brcmfmac | grep -m 1 -oP "^filename:(\s*?)(.*)$" | sed -e 's/^filename:\(\s*\)\(.*\)$/\2/g') |
|
67 | #brcmfmac_path=$(modinfo brcmfmac | grep -m 1 -oP "^filename:(\s*?)(.*)$" | sed -e 's/^filename:\(\s*\)\(.*\)$/\2/g') | |
66 | mv "${brcmfmac_path}" "${brcmfmac_path}".orig |
|
68 | #brcmfmac_path="${LIB_DIR}"/modules/"${KERNEL_VERSION}"/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko | |
|
69 | #mv "${brcmfmac_path}" "${brcmfmac_path}".orig | |||
67 |
|
70 | |||
|
71 | # | |||
|
72 | ||||
68 | # build patches |
|
73 | # build patches | |
69 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then |
|
74 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then | |
70 | cd "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon || exit |
|
75 | cd "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon || exit | |
71 | make clean |
|
76 | make clean | |
72 |
|
77 | |||
73 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. |
|
78 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. | |
74 | 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- |
|
79 | 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- | |
75 |
|
80 | |||
76 | # copy RPi0W & RPi3 firmware |
|
81 | # copy RPi0W & RPi3 firmware | |
77 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.org.bin |
|
82 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.org.bin | |
78 | cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.nexmon.bin |
|
83 | cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.nexmon.bin | |
79 | cp -f "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin |
|
84 | cp -f "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin | |
80 |
|
85 | |||
81 | cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac_4.14.y-nexmon/brcmfmac.ko "${brcmfmac_path}" |
|
86 | cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac_4.14.y-nexmon/brcmfmac.ko "${brcmfmac_path}" | |
82 | fi |
|
87 | fi | |
83 |
|
88 | |||
84 | if [ "$RPI_MODEL" = 3P ] ; then |
|
89 | if [ "$RPI_MODEL" = 3P ] ; then | |
85 | cd "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon || exit |
|
90 | cd "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon || exit | |
86 | make clean |
|
91 | make clean | |
87 |
|
92 | |||
88 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. |
|
93 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. | |
89 | 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- |
|
94 | 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- | |
90 |
|
95 | |||
91 | # RPi3B+ firmware |
|
96 | # RPi3B+ firmware | |
92 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.org.bin |
|
97 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.org.bin | |
93 | cp "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.nexmon.bin |
|
98 | cp "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.nexmon.bin | |
94 | cp -f "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin |
|
99 | cp -f "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin | |
95 | fi |
|
100 | fi | |
96 |
|
101 | |||
97 | #Revert to previous directory |
|
102 | #Revert to previous directory | |
98 | cd "${WORKDIR}" || exit |
|
103 | cd "${WORKDIR}" || exit | |
99 |
|
104 | |||
100 | fi |
|
105 | fi |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant