forked from mainsail-crew/MainsailOS
-
-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathstart_chroot_script
More file actions
35 lines (26 loc) · 955 Bytes
/
start_chroot_script
File metadata and controls
35 lines (26 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
#### enable SPI
#from https://www.reddit.com/r/BIGTREETECH/comments/xfom6n/comment/it32e6v/
# shellcheck enable=require-variable-braces
## Source error handling, leave this in place
set -Ee
# Set DEBIAN_FRONTEND to noninteractive
if [[ "${DEBIAN_FRONTEND}" != "noninteractive" ]]; then
export DEBIAN_FRONTEND=noninteractive
fi
## Source CustomPIOS common.sh
# shellcheck disable=SC1091
source /common.sh
install_cleanup_trap
echo_green "Enable SPI interface on SBC's ..."
# Step 1: Copy default config to backup file
if [[ -e "${SPI_CONFIG_TXT_FILE}" ]]
then
cp "${SPI_CONFIG_TXT_FILE}" "${SPI_CONFIG_BAK_FILE}"
fi
# Step 2: Enable SPI
echo "overlays=spi" >> "${SPI_CONFIG_TXT_FILE}"
echo "spidevparam_spidev_spi_bus=1" >> "${SPI_CONFIG_TXT_FILE}"
echo "param_spidev_spi_cs=1" >> "${SPI_CONFIG_TXT_FILE}"
echo "param_spidev_max_freq=1000000" >> "${SPI_CONFIG_TXT_FILE}"
echo_green "Enable SPI interface on SBC ... DONE!"