##// END OF EJS Templates
a
Unknown -
r449:946eb9ed27e3
parent child
Show More
@@ -1,233 +1,237
1 #
1 #
2 # Setup RPi2/3 config and cmdline
2 # Setup RPi2/3 config and cmdline
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 if [ "$BUILD_KERNEL" = true ] ; then
8 if [ "$BUILD_KERNEL" = true ] ; then
9 if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then
9 if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then
10 # Install boot binaries from local directory
10 # Install boot binaries from local directory
11 cp "${RPI_FIRMWARE_DIR}"/boot/bootcode.bin "${BOOT_DIR}"/bootcode.bin
11 cp "${RPI_FIRMWARE_DIR}"/boot/bootcode.bin "${BOOT_DIR}"/bootcode.bin
12 cp "${RPI_FIRMWARE_DIR}"/boot/fixup.dat "${BOOT_DIR}"/fixup.dat
12 cp "${RPI_FIRMWARE_DIR}"/boot/fixup.dat "${BOOT_DIR}"/fixup.dat
13 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_cd.dat "${BOOT_DIR}"/fixup_cd.dat
13 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_cd.dat "${BOOT_DIR}"/fixup_cd.dat
14 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_x.dat "${BOOT_DIR}"/fixup_x.dat
14 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_x.dat "${BOOT_DIR}"/fixup_x.dat
15 cp "${RPI_FIRMWARE_DIR}"/boot/start.elf "${BOOT_DIR}"/start.elf
15 cp "${RPI_FIRMWARE_DIR}"/boot/start.elf "${BOOT_DIR}"/start.elf
16 cp "${RPI_FIRMWARE_DIR}"/boot/start_cd.elf "${BOOT_DIR}"/start_cd.elf
16 cp "${RPI_FIRMWARE_DIR}"/boot/start_cd.elf "${BOOT_DIR}"/start_cd.elf
17 cp "${RPI_FIRMWARE_DIR}"/boot/start_x.elf "${BOOT_DIR}"/start_x.elf
17 cp "${RPI_FIRMWARE_DIR}"/boot/start_x.elf "${BOOT_DIR}"/start_x.elf
18 else
18 else
19 # Create temporary directory for boot binaries
19 # Create temporary directory for boot binaries
20 temp_dir=$(as_nobody mktemp -d)
20 temp_dir=$(as_nobody mktemp -d)
21
21
22 # Install latest boot binaries from raspberry/firmware github
22 # Install latest boot binaries from raspberry/firmware github
23 as_nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin"
23 as_nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin"
24 as_nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat"
24 as_nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat"
25 as_nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat"
25 as_nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat"
26 as_nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat"
26 as_nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat"
27 as_nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf"
27 as_nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf"
28 as_nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf"
28 as_nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf"
29 as_nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf"
29 as_nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf"
30
30
31 # Move downloaded boot binaries
31 # Move downloaded boot binaries
32 mv "${temp_dir}/"* "${BOOT_DIR}/"
32 mv "${temp_dir}/"* "${BOOT_DIR}/"
33
33
34 # Remove temporary directory for boot binaries
34 # Remove temporary directory for boot binaries
35 rm -fr "${temp_dir}"
35 rm -fr "${temp_dir}"
36
36
37 # Set permissions of the boot binaries
37 # Set permissions of the boot binaries
38 chown -R root:root "${BOOT_DIR}"
38 chown -R root:root "${BOOT_DIR}"
39 chmod -R 600 "${BOOT_DIR}"
39 chmod -R 600 "${BOOT_DIR}"
40 fi
40 fi
41 fi
41 fi
42
42
43 # Setup firmware boot cmdline
43 # Setup firmware boot cmdline
44 if [ "$ENABLE_UBOOTUSB" = true ] ; then
44 if [ "$ENABLE_UBOOTUSB" = true ] ; then
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"
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 else
46 else
47 if [ "$ENABLE_SPLITFS" = true ] ; then
47 if [ "$ENABLE_SPLITFS" = true ] ; then
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"
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 else
49 else
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"
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 fi
51 fi
52 fi
52 fi
53
53
54 # Add encrypted root partition to cmdline.txt
54 # Add encrypted root partition to cmdline.txt
55 if [ "$ENABLE_CRYPTFS" = true ] ; then
55 if [ "$ENABLE_CRYPTFS" = true ] ; then
56 if [ "$ENABLE_SPLITFS" = true ] ; then
56 if [ "$ENABLE_SPLITFS" = true ] ; then
57 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/")
57 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/")
58 else
58 else
59 if [ "$ENABLE_UBOOTUSB" = true ] ; then
59 if [ "$ENABLE_UBOOTUSB" = true ] ; then
60 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda2:${CRYPTFS_MAPPING}/")
60 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda2:${CRYPTFS_MAPPING}/")
61 else
61 else
62 CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/")
62 CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/")
63 fi
63 fi
64 fi
64 fi
65 fi
65 fi
66
66
67 #locks cpu at max frequency
67 #locks cpu at max frequency
68 if [ "$ENABLE_TURBO" = true ] ; then
68 if [ "$ENABLE_TURBO" = true ] ; then
69 echo "force_turbo=1" >> "${BOOT_DIR}/config.txt"
69 echo "force_turbo=1" >> "${BOOT_DIR}/config.txt"
70 fi
70 fi
71
71
72 if [ "$ENABLE_PRINTK" = true ] ; then
72 if [ "$ENABLE_PRINTK" = true ] ; then
73 install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf"
73 install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf"
74 fi
74 fi
75
75
76 # Install udev rule for serial alias
76 # Install udev rule for serial alias
77 install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules"
77 install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules"
78
78
79 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
79 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
80
80
81 # RPI0,3,3P Use default ttyS0 (mini-UART)as serial interface
81 # RPI0,3,3P Use default ttyS0 (mini-UART)as serial interface
82 SET_SERIAL="ttyS0"
82 SET_SERIAL="ttyS0"
83
83
84 # Bluetooth enabled
84 # Bluetooth enabled
85 if [ "$ENABLE_BLUETOOTH" = true ] ; then
85 if [ "$ENABLE_BLUETOOTH" = true ] ; then
86 # Create temporary directory for Bluetooth sources
86 # Create temporary directory for Bluetooth sources
87 temp_dir=$(as_nobody mktemp -d)
87 temp_dir=$(as_nobody mktemp -d)
88
88
89 # Fetch Bluetooth sources
89 # Fetch Bluetooth sources
90 as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}"
90 as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}"
91
91
92 # Copy downloaded sources
92 # Copy downloaded sources
93 mv "${temp_dir}/pi-bluetooth" "${R}/tmp/"
93 mv "${temp_dir}/pi-bluetooth" "${R}/tmp/"
94
94
95 # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/
95 # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/
96 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
96 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
97 as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth
97 as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth
98
98
99 # Set permissions
99 # Set permissions
100 chown -R root:root "${R}/tmp/pi-bluetooth"
100 chown -R root:root "${R}/tmp/pi-bluetooth"
101
101
102 # Install tools
102 # Install tools
103 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart"
103 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart"
104 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper"
104 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper"
105
105
106 # Install bluetooth udev rule
106 # Install bluetooth udev rule
107 install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules"
107 install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules"
108
108
109 # Install Firmware Flash file and apropiate licence
109 # Install Firmware Flash file and apropiate licence
110 mkdir -p "$BLUETOOTH_FIRMWARE_DIR"
110 mkdir -p "$BLUETOOTH_FIRMWARE_DIR"
111 install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
111 install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
112 install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
112 install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
113 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service"
113 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service"
114 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service"
114 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service"
115
115
116 # Remove temporary directory
116 # Remove temporary directory
117 rm -fr "${temp_dir}"
117 rm -fr "${temp_dir}"
118
118
119 # 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
119 # 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
120 if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then
120 if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then
121 SET_SERIAL="ttyAMA0"
121
122
122 # set overlay to swap ttyAMA0 and ttyS0
123 # set overlay to swap ttyAMA0 and ttyS0
123 echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt"
124 echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt"
124
125
125 # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken
126 # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken
126 if [ "$ENABLE_TURBO" = false ] ; then
127 if [ "$ENABLE_TURBO" = false ] ; then
127 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
128 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
128 fi
129 fi
130
131 # Activate services
132 chroot_exec systemctl enable pi-bluetooth.hciuart.service
133 #chroot_exec systemctl enable pi-bluetooth.bthelper@.service
134 else
135 chroot_exec systemctl enable pi-bluetooth.hciuart.service
136 #chroot_exec systemctl enable pi-bluetooth.bthelper@.service
129 fi
137 fi
130
138
131 else # if ENABLE_BLUETOOTH = false
139 else # if ENABLE_BLUETOOTH = false
132 # set overlay to disable bluetooth
140 # set overlay to disable bluetooth
133 echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt"
141 echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt"
134 fi # ENABLE_BLUETOOTH end
142 fi # ENABLE_BLUETOOTH end
135
143
136 else
144 else
137 # RPI1,1P,2 Use default ttyAMA0 (full UART) as serial interface
145 # RPI1,1P,2 Use default ttyAMA0 (full UART) as serial interface
138 SET_SERIAL="ttyAMA0"
146 SET_SERIAL="ttyAMA0"
139 fi
147 fi
140
148
141 # may need sudo systemctl disable hciuart
149 # may need sudo systemctl disable hciuart
142 if [ "$ENABLE_CONSOLE" = true ] ; then
150 if [ "$ENABLE_CONSOLE" = true ] ; then
143 echo "enable_uart=1" >> "${BOOT_DIR}/config.txt"
151 echo "enable_uart=1" >> "${BOOT_DIR}/config.txt"
144
145 # add string to cmdline
152 # add string to cmdline
146 CMDLINE="${CMDLINE} console=serial0,115200"
153 CMDLINE="${CMDLINE} console=serial0,115200"
147
154
148 # Enable serial console systemd style
155 # Enable serial console systemd style
149 chroot_exec systemctl start serial-getty@"$SET_SERIAL".service
150 chroot_exec systemctl enable serial-getty@"$SET_SERIAL".service
156 chroot_exec systemctl enable serial-getty@"$SET_SERIAL".service
151 else
157 else
152 echo "enable_uart=0" >> "${BOOT_DIR}/config.txt"
158 echo "enable_uart=0" >> "${BOOT_DIR}/config.txt"
153
159 # disable serial console systemd style
154 # Enable serial console systemd style
155 chroot_exec systemctl stop serial-getty@"$SET_SERIAL".service
156 chroot_exec systemctl disable serial-getty@"$SET_SERIAL".service
160 chroot_exec systemctl disable serial-getty@"$SET_SERIAL".service
157 fi
161 fi
158
162
159 # Remove IPv6 networking support
163 # Remove IPv6 networking support
160 if [ "$ENABLE_IPV6" = false ] ; then
164 if [ "$ENABLE_IPV6" = false ] ; then
161 CMDLINE="${CMDLINE} ipv6.disable=1"
165 CMDLINE="${CMDLINE} ipv6.disable=1"
162 fi
166 fi
163
167
164 # Automatically assign predictable network interface names
168 # Automatically assign predictable network interface names
165 if [ "$ENABLE_IFNAMES" = false ] ; then
169 if [ "$ENABLE_IFNAMES" = false ] ; then
166 CMDLINE="${CMDLINE} net.ifnames=0"
170 CMDLINE="${CMDLINE} net.ifnames=0"
167 else
171 else
168 CMDLINE="${CMDLINE} net.ifnames=1"
172 CMDLINE="${CMDLINE} net.ifnames=1"
169 fi
173 fi
170
174
171 # Install firmware boot cmdline
175 # Install firmware boot cmdline
172 echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt"
176 echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt"
173
177
174 # Install firmware config
178 # Install firmware config
175 install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt"
179 install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt"
176
180
177 # Setup minimal GPU memory allocation size: 16MB (no X)
181 # Setup minimal GPU memory allocation size: 16MB (no X)
178 if [ "$ENABLE_MINGPU" = true ] ; then
182 if [ "$ENABLE_MINGPU" = true ] ; then
179 echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt"
183 echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt"
180 fi
184 fi
181
185
182 # Setup boot with initramfs
186 # Setup boot with initramfs
183 if [ "$ENABLE_INITRAMFS" = true ] ; then
187 if [ "$ENABLE_INITRAMFS" = true ] ; then
184 echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt"
188 echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt"
185 fi
189 fi
186
190
187 # Create firmware configuration and cmdline symlinks
191 # Create firmware configuration and cmdline symlinks
188 ln -sf firmware/config.txt "${R}/boot/config.txt"
192 ln -sf firmware/config.txt "${R}/boot/config.txt"
189 ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt"
193 ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt"
190
194
191 # Install and setup kernel modules to load at boot
195 # Install and setup kernel modules to load at boot
192 mkdir -p "${LIB_DIR}/modules-load.d/"
196 mkdir -p "${LIB_DIR}/modules-load.d/"
193 install_readonly files/modules/rpi2.conf "${LIB_DIR}/modules-load.d/rpi2.conf"
197 install_readonly files/modules/rpi2.conf "${LIB_DIR}/modules-load.d/rpi2.conf"
194
198
195 # Load hardware random module at boot
199 # Load hardware random module at boot
196 if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then
200 if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then
197 sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${LIB_DIR}/modules-load.d/rpi2.conf"
201 sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${LIB_DIR}/modules-load.d/rpi2.conf"
198 fi
202 fi
199
203
200 # Load sound module at boot
204 # Load sound module at boot
201 if [ "$ENABLE_SOUND" = true ] ; then
205 if [ "$ENABLE_SOUND" = true ] ; then
202 sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
206 sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
203 else
207 else
204 echo "dtparam=audio=off" >> "${BOOT_DIR}/config.txt"
208 echo "dtparam=audio=off" >> "${BOOT_DIR}/config.txt"
205 fi
209 fi
206
210
207 # Enable I2C interface
211 # Enable I2C interface
208 if [ "$ENABLE_I2C" = true ] ; then
212 if [ "$ENABLE_I2C" = true ] ; then
209 echo "dtparam=i2c_arm=on" >> "${BOOT_DIR}/config.txt"
213 echo "dtparam=i2c_arm=on" >> "${BOOT_DIR}/config.txt"
210 sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${LIB_DIR}/modules-load.d/rpi2.conf"
214 sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${LIB_DIR}/modules-load.d/rpi2.conf"
211 sed -i "s/^# i2c-dev/i2c-dev/" "${LIB_DIR}/modules-load.d/rpi2.conf"
215 sed -i "s/^# i2c-dev/i2c-dev/" "${LIB_DIR}/modules-load.d/rpi2.conf"
212 fi
216 fi
213
217
214 # Enable SPI interface
218 # Enable SPI interface
215 if [ "$ENABLE_SPI" = true ] ; then
219 if [ "$ENABLE_SPI" = true ] ; then
216 echo "dtparam=spi=on" >> "${BOOT_DIR}/config.txt"
220 echo "dtparam=spi=on" >> "${BOOT_DIR}/config.txt"
217 echo "spi-bcm2708" >> "${LIB_DIR}/modules-load.d/rpi2.conf"
221 echo "spi-bcm2708" >> "${LIB_DIR}/modules-load.d/rpi2.conf"
218 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]; then
222 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]; then
219 sed -i "s/spi-bcm2708/spi-bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
223 sed -i "s/spi-bcm2708/spi-bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
220 fi
224 fi
221 fi
225 fi
222
226
223 # Disable RPi2/3 under-voltage warnings
227 # Disable RPi2/3 under-voltage warnings
224 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
228 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
225 echo "avoid_warnings=${DISABLE_UNDERVOLT_WARNINGS}" >> "${BOOT_DIR}/config.txt"
229 echo "avoid_warnings=${DISABLE_UNDERVOLT_WARNINGS}" >> "${BOOT_DIR}/config.txt"
226 fi
230 fi
227
231
228 # Install kernel modules blacklist
232 # Install kernel modules blacklist
229 mkdir -p "${ETC_DIR}/modprobe.d/"
233 mkdir -p "${ETC_DIR}/modprobe.d/"
230 install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf"
234 install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf"
231
235
232 # Install sysctl.d configuration files
236 # Install sysctl.d configuration files
233 install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf"
237 install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf"
@@ -1,77 +1,77
1 #
1 #
2 # Build and Setup fbturbo Xorg driver
2 # Build and Setup nexmon with monitor mode patch
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then
8 if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then
9
9
10 # Create temporary directory for nexmon sources
10 # Create temporary directory for nexmon sources
11 temp_dir=$(as_nobody mktemp -d)
11 temp_dir=$(as_nobody mktemp -d)
12
12
13 # Fetch nexmon sources
13 # Fetch nexmon sources
14 as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}"
14 as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}"
15
15
16 # Copy downloaded nexmon sources
16 # Copy downloaded nexmon sources
17 mv "${temp_dir}/nexmon" "${R}"/tmp/
17 mv "${temp_dir}/nexmon" "${R}"/tmp/
18
18
19 # Set permissions of the nexmon sources
19 # Set permissions of the nexmon sources
20 chown -R root:root "${R}"/tmp/nexmon
20 chown -R root:root "${R}"/tmp/nexmon
21
21
22 # Set script Root
22 # Set script Root
23 NEXMON_ROOT="${R}"/tmp/nexmon
23 NEXMON_ROOT="${R}"/tmp/nexmon
24
24
25 # Remove temporary directory for nexmon sources
25 # Remove temporary directory for nexmon sources
26 rm -fr "${temp_dir}"
26 rm -fr "${temp_dir}"
27
27
28 # Build nexmon firmware outside the build system, if we can.
28 # Build nexmon firmware outside the build system, if we can.
29 cd "${NEXMON_ROOT}"
29 cd "${NEXMON_ROOT}"
30
30
31 # Disable statistics
31 # Disable statistics
32 touch DISABLE_STATISTICS
32 touch DISABLE_STATISTICS
33
33
34 # Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh
34 # Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh
35 ARCH="${KERNEL_ARCH}"
35 ARCH="${KERNEL_ARCH}"
36 SUBARCH="${KERNEL_ARCH}"
36 SUBARCH="${KERNEL_ARCH}"
37 KERNEL="${KERNEL_IMAGE}"
37 KERNEL="${KERNEL_IMAGE}"
38 CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi-
38 CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi-
39 CCPLUGIN="${NEXMON_ROOT}"/buildtools/gcc-nexmon-plugin/nexmon.so
39 CCPLUGIN="${NEXMON_ROOT}"/buildtools/gcc-nexmon-plugin/nexmon.so
40 ZLIBFLATE="zlib-flate -compress"
40 ZLIBFLATE="zlib-flate -compress"
41 Q=@
41 Q=@
42 NEXMON_SETUP_ENV=1
42 NEXMON_SETUP_ENV=1
43
43
44 # Make nexmon
44 # Make nexmon
45 make
45 make
46
46
47 # Make ancient isl build
47 # Make ancient isl build
48 cd buildtools/isl-0.10
48 cd buildtools/isl-0.10
49 CC=$CCgcc
49 CC=$CCgcc
50 ./configure
50 ./configure
51 make
51 make
52
52
53 # build patches
53 # build patches
54 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then
54 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then
55 cd ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon
55 cd ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon
56 make clean
56 make clean
57
57
58 # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems.
58 # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems.
59 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-
59 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-
60
60
61 # copy RPi0W & RPi3 firmware
61 # copy RPi0W & RPi3 firmware
62 cp ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.nexmon.bin
62 cp ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.nexmon.bin
63 cp -f ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin
63 cp -f ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin
64 fi
64 fi
65
65
66 if [ "$RPI_MODEL" = 3P ] ; then
66 if [ "$RPI_MODEL" = 3P ] ; then
67 cd ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon
67 cd ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon
68 make clean
68 make clean
69
69
70 # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems.
70 # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems.
71 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-
71 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-
72
72
73 # RPi3B+ firmware
73 # RPi3B+ firmware
74 cp ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.nexmon.bin
74 cp ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.nexmon.bin
75 cp -f ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin
75 cp -f ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin
76 fi
76 fi
77 fi
77 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant