Skip to content

Commit 4c431f9

Browse files
committed
fix: load i2c-dev modules
This PR adds to mainsail-crew#196 with the required bits to enable i2c by default. Signed-off-by: ashthespy <ashthespy@users.noreply.github.com>
1 parent 9f09363 commit 4c431f9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/modules/piconfig/start_chroot_script

+11-2
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,22 @@ cp "${PICONFIG_CMDLINE_TXT_FILE}" "${PICONFIG_CMDLINE_BAK_FILE}"
4747
echo_green "Disable Serial Linux console ..."
4848
sed -i 's/console=serial0,115200 //' "${PICONFIG_CMDLINE_TXT_FILE}"
4949

50-
# Step 9: Disable bluetooth and related services
50+
# Step 9: Enable i2c modules
51+
# Also needs corresponding bits in config.txt (see #196)
52+
echo_green "Enabling i2c-dev"
53+
sed /etc/modprobe.d/raspi-blacklist.conf -i -e "s/^\(blacklist[[:space:]]*i2c[-_]bcm2708\)/#\1/"
54+
sed /etc/modules -i -e "s/^#[[:space:]]*\(i2c[-_]dev\)/\1/"
55+
if ! grep -q "^i2c[-_]dev" /etc/modules; then
56+
printf "i2c-dev\n" >> /etc/modules
57+
fi
58+
59+
# Step 10: Disable bluetooth and related services
5160
echo_green "Disabling Bluetooth related services..."
5261
systemctl_if_exists disable hciuart.service
5362
systemctl_if_exists disable bluetooth.service
5463
systemctl_if_exists disable bluealsa.service
5564

56-
# Step 10: Increase swapfile size
65+
# Step 11: Increase swapfile size
5766
if [[ -f "${PICONFIG_SWAP_CONF_FILE}" ]]; then
5867
echo_green "Increasing swap file size to ${PICONFIG_SWAP_SIZE} Mb. Limit to ${PICONFIG_SWAP_MAX} Mb"
5968
sed -i 's/^CONF_SWAPSIZE.*/'CONF_SWAPSIZE="${PICONFIG_SWAP_SIZE}"'/' "${PICONFIG_SWAP_CONF_FILE}"

0 commit comments

Comments
 (0)