diff --git a/image/make-prep.sh b/image/make-prep.sh index fa4e5274a..063a77445 100755 --- a/image/make-prep.sh +++ b/image/make-prep.sh @@ -15,6 +15,7 @@ SCRIPT_NAME=$(basename $0) SCRIPT_DIR=$(dirname $0) VERBOSE=0 ENABLE_CONSOLE=1 +ENABLE_I2C=1 ENABLE_WIFI=0 WIFI_SSID= WIFI_PASSWORD= @@ -39,6 +40,7 @@ where OPTION can be one of: --ssid SSID Specify the SSID for Wifi access --password PWD Specify the password for wifi access --wifi-country CC Specify the WiFi country code to use (default: GB) + --no-i2c Disable I2C bus --hostname NAME Specify the hostname --dd DEV Issue a dd command to copy the image to an sdcard --summary Print summary of changed files @@ -82,6 +84,35 @@ END fi } +########################################################################### +# +# Enables the I2C bus +# +enable_i2c_bus() { + CONFIG="${BOOT_MOUNTPOINT}/config.txt" + local pattern="dtparam=i2c_arm=on" + if grep -q "$pattern" ${CONFIG} ; then + sudo sed -i "s/.*$pattern/$pattern/g" "${CONFIG}" + else + echo "Enabling I2C bus" + sudo sh -c "cat >> '${CONFIG}'" <> '${CONF}'" <