@@ -1,99 +1,97 | |||||
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 | cd buildtools/isl-0.10 || exit |
|
38 | cd buildtools/isl-0.10 || exit | |
39 | ./configure |
|
39 | ./configure | |
40 | make |
|
40 | make | |
41 | cd ../.. || exit |
|
41 | cd ../.. || exit | |
42 |
|
42 | |||
43 | # Disable statistics |
|
43 | # Disable statistics | |
44 | touch DISABLE_STATISTICS |
|
44 | touch DISABLE_STATISTICS | |
45 |
|
45 | |||
46 | # Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh |
|
46 | # Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh | |
47 | export KERNEL="${KERNEL_IMAGE}" |
|
47 | export KERNEL="${KERNEL_IMAGE}" | |
48 | export ARCH=arm |
|
48 | export ARCH=arm | |
49 | export SUBARCH=arm |
|
49 | export SUBARCH=arm | |
50 | export CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- |
|
50 | export CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- | |
51 | export CC="${CC}"gcc |
|
51 | export CC="${CC}"gcc | |
52 | export CCPLUGIN="${NEXMON_ROOT}"/buildtools/gcc-nexmon-plugin/nexmon.so |
|
52 | export CCPLUGIN="${NEXMON_ROOT}"/buildtools/gcc-nexmon-plugin/nexmon.so | |
53 | export ZLIBFLATE="zlib-flate -compress" |
|
53 | export ZLIBFLATE="zlib-flate -compress" | |
54 | export Q=@ |
|
54 | export Q=@ | |
55 | export NEXMON_SETUP_ENV=1 |
|
55 | export NEXMON_SETUP_ENV=1 | |
56 | export HOSTUNAME=$(uname -s) |
|
56 | export HOSTUNAME=$(uname -s) | |
57 | export PLATFORMUNAME=$(uname -m) |
|
57 | export PLATFORMUNAME=$(uname -m) | |
58 |
|
58 | |||
59 | # Make nexmon |
|
59 | # Make nexmon | |
60 | make |
|
60 | make | |
61 |
|
61 | |||
62 | # build patches |
|
62 | # build patches | |
63 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then |
|
63 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then | |
64 | cd "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon || exit |
|
64 | cd "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon || exit | |
65 | sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/Makefile |
|
65 | sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/Makefile | |
66 | make clean |
|
66 | make clean | |
67 |
|
67 | |||
68 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. |
|
68 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. | |
69 | 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- |
|
69 | 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- | |
70 |
|
70 | |||
71 | # copy RPi0W & RPi3 firmware |
|
71 | # copy RPi0W & RPi3 firmware | |
72 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.org.bin |
|
72 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.org.bin | |
73 | cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.nexmon.bin |
|
73 | cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.nexmon.bin | |
74 | cp -f "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin |
|
74 | cp -f "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin | |
75 |
|
||||
76 | cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac_4.14.y-nexmon/brcmfmac.ko "${brcmfmac_path}" |
|
|||
77 | fi |
|
75 | fi | |
78 |
|
76 | |||
79 | if [ "$RPI_MODEL" = 3P ] ; then |
|
77 | if [ "$RPI_MODEL" = 3P ] ; then | |
80 | cd "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon || exit |
|
78 | cd "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon || exit | |
81 | sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/Makefile |
|
79 | sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/Makefile | |
82 | make clean |
|
80 | make clean | |
83 |
|
81 | |||
84 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. |
|
82 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. | |
85 | 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- |
|
83 | 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- | |
86 |
|
84 | |||
87 | # RPi3B+ firmware |
|
85 | # RPi3B+ firmware | |
88 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.org.bin |
|
86 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.org.bin | |
89 | cp "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.nexmon.bin |
|
87 | cp "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.nexmon.bin | |
90 | cp -f "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin |
|
88 | cp -f "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin | |
91 | fi |
|
89 | fi | |
92 |
|
90 | |||
93 | #Revert to previous directory |
|
91 | #Revert to previous directory | |
94 | cd "${WORKDIR}" || exit |
|
92 | cd "${WORKDIR}" || exit | |
95 |
|
93 | |||
96 | # Remove nexmon sources |
|
94 | # Remove nexmon sources | |
97 | rm -fr "${NEXMON_ROOT}" |
|
95 | rm -fr "${NEXMON_ROOT}" | |
98 |
|
96 | |||
99 | fi |
|
97 | fi |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant