##// END OF EJS Templates
a
Unknown -
r476:824d03f1dd13
parent child
Show More
@@ -1,270 +1,271
1 1 #
2 2 # Setup RPi2/3 config and cmdline
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 #if [ "$BUILD_KERNEL" = true ] ; then
9 9 if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then
10 10 # Install boot binaries from local directory
11 11 cp "${RPI_FIRMWARE_DIR}"/boot/bootcode.bin "${BOOT_DIR}"/bootcode.bin
12 12 cp "${RPI_FIRMWARE_DIR}"/boot/fixup.dat "${BOOT_DIR}"/fixup.dat
13 13 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_cd.dat "${BOOT_DIR}"/fixup_cd.dat
14 14 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_x.dat "${BOOT_DIR}"/fixup_x.dat
15 15 cp "${RPI_FIRMWARE_DIR}"/boot/start.elf "${BOOT_DIR}"/start.elf
16 16 cp "${RPI_FIRMWARE_DIR}"/boot/start_cd.elf "${BOOT_DIR}"/start_cd.elf
17 17 cp "${RPI_FIRMWARE_DIR}"/boot/start_x.elf "${BOOT_DIR}"/start_x.elf
18 18 else
19 19 # Create temporary directory for boot binaries
20 20 temp_dir=$(as_nobody mktemp -d)
21 21
22 22 # Install latest boot binaries from raspberry/firmware github
23 23 as_nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin"
24 24 as_nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat"
25 25 as_nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat"
26 26 as_nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat"
27 27 as_nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf"
28 28 as_nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf"
29 29 as_nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf"
30 30
31 31 # Move downloaded boot binaries
32 32 mv "${temp_dir}/"* "${BOOT_DIR}/"
33 33
34 34 # Remove temporary directory for boot binaries
35 35 rm -fr "${temp_dir}"
36 36
37 37 # Set permissions of the boot binaries
38 38 chown -R root:root "${BOOT_DIR}"
39 39 chmod -R 600 "${BOOT_DIR}"
40 40 fi
41 41 #fi
42 42
43 43 # Setup firmware boot cmdline
44 44 if [ "$ENABLE_UBOOTUSB" = true ] ; then
45 45 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1 init=/bin/systemd"
46 46 else
47 47 if [ "$ENABLE_SPLITFS" = true ] ; then
48 48 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1 init=/bin/systemd"
49 49 else
50 50 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1 init=/bin/systemd"
51 51 fi
52 52 fi
53 53
54 54 # Add encrypted root partition to cmdline.txt
55 55 if [ "$ENABLE_CRYPTFS" = true ] ; then
56 56 if [ "$ENABLE_SPLITFS" = true ] ; then
57 57 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/")
58 58 else
59 59 if [ "$ENABLE_UBOOTUSB" = true ] ; then
60 60 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda2:${CRYPTFS_MAPPING}/")
61 61 else
62 62 CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/")
63 63 fi
64 64 fi
65 65 fi
66 66
67 67 if [ "$ENABLE_PRINTK" = true ] ; then
68 68 install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf"
69 69 fi
70 70
71 71 # Install udev rule for serial alias - serial0 = console serial1=bluetooth
72 72 install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules"
73 73
74 74 # Remove IPv6 networking support
75 75 if [ "$ENABLE_IPV6" = false ] ; then
76 76 CMDLINE="${CMDLINE} ipv6.disable=1"
77 77 fi
78 78
79 79 # Automatically assign predictable network interface names
80 80 if [ "$ENABLE_IFNAMES" = false ] ; then
81 81 CMDLINE="${CMDLINE} net.ifnames=0"
82 82 else
83 83 CMDLINE="${CMDLINE} net.ifnames=1"
84 84 fi
85 85
86 86 # Install firmware config
87 87 install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt"
88 88
89 89 #locks cpu at max frequency
90 90 if [ "$ENABLE_TURBO" = true ] ; then
91 91 echo "force_turbo=1" >> "${BOOT_DIR}/config.txt"
92 92 # helps to avoid sdcard corruption when force_turbo is enabled.
93 93 echo "boot_delay=1" >> "${BOOT_DIR}/config.txt"
94 94 fi
95 95
96 96 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
97 97
98 98 # Bluetooth enabled
99 99 if [ "$ENABLE_BLUETOOTH" = true ] ; then
100 100 # Create temporary directory for Bluetooth sources
101 101 temp_dir=$(as_nobody mktemp -d)
102 102
103 103 # Fetch Bluetooth sources
104 104 as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}"
105 105
106 106 # Copy downloaded sources
107 107 mv "${temp_dir}/pi-bluetooth" "${R}/tmp/"
108 108
109 109 # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/
110 110 as_nobody wget -q -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth
111 111 as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth
112 112
113 113 # Set permissions
114 114 chown -R root:root "${R}/tmp/pi-bluetooth"
115 115
116 116 # Install tools
117 117 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart"
118 118 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper"
119 119
120 120 # Install bluetooth udev rule
121 121 install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules"
122 122
123 123 # Install Firmware Flash file and apropiate licence
124 124 mkdir -p "$BLUETOOTH_FIRMWARE_DIR"
125 125 install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
126 126 install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
127 127 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service"
128 128 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service"
129 129
130 # Remove temporary directory
130 # Remove temporary directories
131 131 rm -fr "${temp_dir}"
132 rm -fr "${R}"/tmp/pi-bluetooth
132 133
133 134 # Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore UART0/ttyAMA0 over GPIOs 14 & 15. Slow Bluetooth and slow cpu. Use /dev/ttyS0 instead of /dev/ttyAMA0
134 135 if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then
135 136
136 137 # set overlay to swap ttyAMA0 and ttyS0
137 138 echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt"
138 139
139 140 # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken
140 141 if [ "$ENABLE_TURBO" = false ] ; then
141 142 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
142 143 fi
143 144 fi
144 145
145 146 # Activate services
146 147 chroot_exec systemctl enable pi-bluetooth.hciuart.service
147 148 chroot_exec systemctl enable pi-bluetooth.bthelper@serial1.service
148 149
149 150 else # if ENABLE_BLUETOOTH = false
150 151 # set overlay to disable bluetooth
151 152 echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt"
152 153 fi # ENABLE_BLUETOOTH end
153 154 fi
154 155
155 156 # may need sudo systemctl disable hciuart
156 157 if [ "$ENABLE_CONSOLE" = true ] ; then
157 158 echo "enable_uart=1" >> "${BOOT_DIR}/config.txt"
158 159 # add string to cmdline
159 160 CMDLINE="${CMDLINE} console=serial0,115200"
160 161
161 162 # Enable serial console systemd style
162 163 chroot_exec systemctl enable serial-getty@serial0.service
163 164 else
164 165 echo "enable_uart=0" >> "${BOOT_DIR}/config.txt"
165 166 # disable serial console systemd style
166 167 #chroot_exec systemctl disable serial-getty@serial0.service
167 168 fi
168 169
169 170 # Remove cmdline.txt entry of starting zswap
170 171 if [ "$KERNEL_ZSWAP" = true ] ; then
171 172 CMDLINE="${CMDLINE} zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4"
172 173 fi
173 174
174 175 if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then
175 176
176 177 # Remove cmdline.txt entry of starting zswap
177 178 if [ "$KERNEL_ZSWAP" = true ] ; then
178 179 sed -i 's|zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4||g'
179 180 fi
180 181 # Create temporary directory for systemd-swap sources
181 182 temp_dir=$(as_nobody mktemp -d)
182 183
183 184 # Fetch systemd-swap sources
184 185 as_nobody git -C "${temp_dir}" clone "${ZSWAP_URL}"
185 186
186 187 # Copy downloaded systemd-swap sources
187 188 mv "${temp_dir}/systemd-swap" "${R}/tmp/"
188 189
189 190 # Set permissions of the systemd-swap sources
190 191 chown -R root:root "${R}/tmp/systemd-swap"
191 192
192 193 # Remove temporary directory for systemd-swap sources
193 194 rm -fr "${temp_dir}"
194 195
195 196 # Change into downloaded src dir
196 197 cd "${R}/tmp/systemd-swap" || exit
197 198
198 199 # Build package
199 200 . ./systemd-swap/package.sh debian
200 201
201 202 # Install package
202 203 chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap-*any.deb
203 204
204 205 # Enable service
205 206 chroot_exec systemctl enable systemd-swap
206 207
207 208 # Change back into script root dir
208 209 cd "${WORKDIR}" || exit
209 210 fi
210 211
211 212 # Install firmware boot cmdline
212 213 echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt"
213 214
214 215 # Setup minimal GPU memory allocation size: 16MB (no X)
215 216 if [ "$ENABLE_MINGPU" = true ] ; then
216 217 echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt"
217 218 fi
218 219
219 220 # Setup boot with initramfs
220 221 if [ "$ENABLE_INITRAMFS" = true ] ; then
221 222 echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt"
222 223 fi
223 224
224 225 # Create firmware configuration and cmdline symlinks
225 226 ln -sf firmware/config.txt "${R}/boot/config.txt"
226 227 ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt"
227 228
228 229 # Install and setup kernel modules to load at boot
229 230 mkdir -p "${LIB_DIR}/modules-load.d/"
230 231 install_readonly files/modules/rpi2.conf "${LIB_DIR}/modules-load.d/rpi2.conf"
231 232
232 233 # Load hardware random module at boot
233 234 if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then
234 235 sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${LIB_DIR}/modules-load.d/rpi2.conf"
235 236 fi
236 237
237 238 # Load sound module at boot
238 239 if [ "$ENABLE_SOUND" = true ] ; then
239 240 sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
240 241 else
241 242 echo "dtparam=audio=off" >> "${BOOT_DIR}/config.txt"
242 243 fi
243 244
244 245 # Enable I2C interface
245 246 if [ "$ENABLE_I2C" = true ] ; then
246 247 echo "dtparam=i2c_arm=on" >> "${BOOT_DIR}/config.txt"
247 248 sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${LIB_DIR}/modules-load.d/rpi2.conf"
248 249 sed -i "s/^# i2c-dev/i2c-dev/" "${LIB_DIR}/modules-load.d/rpi2.conf"
249 250 fi
250 251
251 252 # Enable SPI interface
252 253 if [ "$ENABLE_SPI" = true ] ; then
253 254 echo "dtparam=spi=on" >> "${BOOT_DIR}/config.txt"
254 255 echo "spi-bcm2708" >> "${LIB_DIR}/modules-load.d/rpi2.conf"
255 256 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]; then
256 257 sed -i "s/spi-bcm2708/spi-bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
257 258 fi
258 259 fi
259 260
260 261 # Disable RPi2/3 under-voltage warnings
261 262 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
262 263 echo "avoid_warnings=${DISABLE_UNDERVOLT_WARNINGS}" >> "${BOOT_DIR}/config.txt"
263 264 fi
264 265
265 266 # Install kernel modules blacklist
266 267 mkdir -p "${ETC_DIR}/modprobe.d/"
267 268 install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf"
268 269
269 270 # Install sysctl.d configuration files
270 271 install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf"
@@ -1,53 +1,56
1 1 #
2 2 # Setup videocore - Raspberry Userland
3 3 #
4 4
5 5 # Load utility functions
6 6 . ./functions.sh
7 7
8 8 if [ "$ENABLE_VIDEOCORE" = true ] ; then
9 9 # Copy existing videocore sources into chroot directory
10 10 if [ -n "$VIDEOCORESRC_DIR" ] && [ -d "$VIDEOCORESRC_DIR" ] ; then
11 11 # Copy local videocore sources
12 12 cp -r "${VIDEOCORESRC_DIR}" "${R}/tmp/userland"
13 13 else
14 14 # Create temporary directory for videocore sources
15 15 temp_dir=$(as_nobody mktemp -d)
16 16
17 17 # Fetch videocore sources
18 18 as_nobody git -C "${temp_dir}" clone "${VIDEOCORE_URL}"
19 19
20 20 # Copy downloaded videocore sources
21 21 mv "${temp_dir}/userland" "${R}/tmp/"
22 22
23 23 # Set permissions of the U-Boot sources
24 24 chown -R root:root "${R}/tmp/userland"
25 25
26 26 # Remove temporary directory for U-Boot sources
27 27 rm -fr "${temp_dir}"
28 28 fi
29 29
30 30 # Create build dir
31 31 mkdir "${R}"/tmp/userland/build
32 32
33 33 # push us to build directory
34 34 cd "${R}"/tmp/userland/build
35 35
36 36 if [ "$RELEASE_ARCH" = "arm64" ] ; then
37 37 cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DARM64=ON -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_ASM_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland"
38 38 fi
39 39
40 40 if [ "$RELEASE_ARCH" = "armel" ] ; then
41 41 cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-g++ -DCMAKE_ASM_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DCMAKE_SYSTEM_PROCESSOR="arm" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland"
42 42 fi
43 43
44 44 if [ "$RELEASE_ARCH" = "armhf" ] ; then
45 45 cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_TOOLCHAIN_FILE="${R}"/tmp/userland/makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland"
46 46 fi
47 47
48 48 #build userland
49 49 make -j "$(nproc)"
50 50
51 51 #back to root of scriptdir
52 52 cd "${WORKDIR}"
53
54 # Remove videocore sources
55 rm -fr "${R}"/tmp/userland/
53 56 fi
@@ -1,104 +1,107
1 1 #!/bin/sh
2 2 #
3 3 # Build and Setup nexmon with monitor mode patch
4 4 #
5 5
6 6 # Load utility functions
7 7 . ./functions.sh
8 8
9 9 if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then
10 10 # Copy existing nexmon sources into chroot directory
11 11 if [ -n "$NEXMONSRC_DIR" ] && [ -d "$NEXMONSRC_DIR" ] ; then
12 12 # Copy local U-Boot sources
13 13 cp -r "${NEXMONSRC_DIR}" "${R}/tmp"
14 14 else
15 15 # Create temporary directory for nexmon sources
16 16 temp_dir=$(as_nobody mktemp -d)
17 17
18 18 # Fetch nexmon sources
19 19 as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}"
20 20
21 21 # Copy downloaded nexmon sources
22 22 mv "${temp_dir}/nexmon" "${R}"/tmp/
23 23
24 24 # Set permissions of the nexmon sources
25 25 chown -R root:root "${R}"/tmp/nexmon
26 26
27 27 # Remove temporary directory for nexmon sources
28 28 rm -fr "${temp_dir}"
29 29 fi
30 30
31 31 # Set script Root
32 32 export NEXMON_ROOT="${R}"/tmp/nexmon
33 33
34 34 # Build nexmon firmware outside the build system, if we can.
35 35 cd "${NEXMON_ROOT}" || exit
36 36
37 37 # Make ancient isl build
38 38 cd buildtools/isl-0.10 || exit
39 39 ./configure
40 40 make
41 41 cd ../.. || exit
42 42
43 43 # Disable statistics
44 44 touch DISABLE_STATISTICS
45 45
46 46 # Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh
47 47 #ARCH="${KERNEL_ARCH}"
48 48 #SUBARCH="${KERNEL_ARCH}"
49 49 export KERNEL="${KERNEL_IMAGE}"
50 50 export ARCH=arm
51 51 export SUBARCH=arm
52 52 export CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi-
53 53 export CC="${CC}"gcc
54 54 export CCPLUGIN="${NEXMON_ROOT}"/buildtools/gcc-nexmon-plugin/nexmon.so
55 55 export ZLIBFLATE="zlib-flate -compress"
56 56 export Q=@
57 57 export NEXMON_SETUP_ENV=1
58 58 export HOSTUNAME=$(uname -s)
59 59 export PLATFORMUNAME=$(uname -m)
60 60 #. ./setup_env.sh
61 61
62 62 # Make nexmon
63 63 make
64 64
65 65 # Backup stock broadcom wlan driver - "${LIB_DIR}"/modules/${KERNEL_VERSION}/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
66 66 #brcmfmac_path=$(modinfo brcmfmac | grep -m 1 -oP "^filename:(\s*?)(.*)$" | sed -e 's/^filename:\(\s*\)\(.*\)$/\2/g')
67 67 #brcmfmac_path="${LIB_DIR}"/modules/"${KERNEL_VERSION}"/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
68 68 #mv "${brcmfmac_path}" "${brcmfmac_path}".orig
69 69
70 70 #
71 71
72 72 # build patches
73 73 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then
74 74 cd "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon || exit
75 75 make clean
76 76
77 77 # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems.
78 78 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 79
80 80 # copy RPi0W & RPi3 firmware
81 81 mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.org.bin
82 82 cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.nexmon.bin
83 83 cp -f "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin
84 84
85 85 cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac_4.14.y-nexmon/brcmfmac.ko "${brcmfmac_path}"
86 86 fi
87 87
88 88 if [ "$RPI_MODEL" = 3P ] ; then
89 89 cd "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon || exit
90 90 make clean
91 91
92 92 # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems.
93 93 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 94
95 95 # RPi3B+ firmware
96 96 mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.org.bin
97 97 cp "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.nexmon.bin
98 98 cp -f "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin
99 99 fi
100 100
101 101 #Revert to previous directory
102 102 cd "${WORKDIR}" || exit
103 103
104 # Remove nexmon sources
105 rm -fr "${NEXMON_ROOT}"
106
104 107 fi
@@ -1,97 +1,108
1 1 #!/bin/sh
2 2 # This file contains utility functions used by rpi23-gen-image.sh
3 3
4 4 cleanup (){
5 5 set +x
6 6 set +e
7
8 # Remove exports from nexmon
9 unset KERNEL
10 unset ARCH
11 unset SUBARCH
12 unset CCPLUGIN
13 unset ZLIBFLATE
14 unset Q
15 unset NEXMON_SETUP_ENV
16 unset HOSTUNAME
17 unset PLATFORMUNAME
7 18
8 19 # Identify and kill all processes still using files
9 20 echo "killing processes using mount point ..."
10 21 fuser -k "${R}"
11 22 sleep 3
12 23 fuser -9 -k -v "${R}"
13 24
14 25 # Clean up temporary .password file
15 26 if [ -r ".password" ] ; then
16 27 shred -zu .password
17 28 fi
18 29
19 30 # Clean up all temporary mount points
20 31 echo "removing temporary mount points ..."
21 32 umount -l "${R}/proc" 2> /dev/null
22 33 umount -l "${R}/sys" 2> /dev/null
23 34 umount -l "${R}/dev/pts" 2> /dev/null
24 35 umount "$BUILDDIR/mount/boot/firmware" 2> /dev/null
25 36 umount "$BUILDDIR/mount" 2> /dev/null
26 37 cryptsetup close "${CRYPTFS_MAPPING}" 2> /dev/null
27 38 losetup -d "$ROOT_LOOP" 2> /dev/null
28 39 losetup -d "$FRMW_LOOP" 2> /dev/null
29 40 trap - 0 1 2 3 6
30 41 }
31 42
32 43 chroot_exec() {
33 44 # Exec command in chroot
34 45 LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot "${R}" "$@"
35 46 }
36 47
37 48 as_nobody() {
38 49 # Exec command as user nobody
39 50 sudo -E -u nobody LANG=C LC_ALL=C "$@"
40 51 }
41 52
42 53 install_readonly() {
43 54 # Install file with user read-only permissions
44 55 install -o root -g root -m 644 "$@"
45 56 }
46 57
47 58 install_exec() {
48 59 # Install file with root exec permissions
49 60 install -o root -g root -m 744 "$@"
50 61 }
51 62
52 63 use_template () {
53 64 # Test if configuration template file exists
54 65 if [ ! -r "./templates/${CONFIG_TEMPLATE}" ] ; then
55 66 echo "error: configuration template ${CONFIG_TEMPLATE} not found"
56 67 exit 1
57 68 fi
58 69
59 70 # Load template configuration parameters
60 71 . "./templates/${CONFIG_TEMPLATE}"
61 72 }
62 73
63 74 chroot_install_cc() {
64 75 # Install c/c++ build environment inside the chroot
65 76 if [ -z "${COMPILER_PACKAGES}" ] ; then
66 77 COMPILER_PACKAGES=$(chroot_exec apt-get -s install g++ make bc | grep "^Inst " | awk -v ORS=" " '{ print $2 }')
67 78 # Install COMPILER_PACKAGES in chroot
68 79 chroot_exec apt-get -q -y --allow-unauthenticated --no-install-recommends install "${COMPILER_PACKAGES}"
69 80 fi
70 81 }
71 82
72 83 chroot_remove_cc() {
73 84 # Remove c/c++ build environment from the chroot
74 85 if [ -n "${COMPILER_PACKAGES}" ] ; then
75 86 chroot_exec apt-get -qq -y --auto-remove purge "${COMPILER_PACKAGES}"
76 87 COMPILER_PACKAGES=""
77 88 fi
78 89 }
79 90 #GPL v2.0
80 91 #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh
81 92 set_kernel_config() {
82 93 # flag as $1, value to set as $2, config must exist at "./.config"
83 94 TGT="CONFIG_${1#CONFIG_}"
84 95 REP="${2}"
85 96 if grep -q "^${TGT}[^_]" .config; then
86 97 sed -i "s/^\(${TGT}=.*\|# ${TGT} is not set\)/${TGT}=${REP}/" .config
87 98 else
88 99 echo "${TGT}"="${2}" >> .config
89 100 fi
90 101 }
91 102
92 103 unset_kernel_config() {
93 104 # unsets flag with the value of $1, config must exist at "./.config"
94 105 TGT="CONFIG_${1#CONFIG_}"
95 106 sed -i "s/^${TGT}=.*/# ${TGT} is not set/" .config
96 107 }
97 108 # No newline at end of file
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant