Add install fancontrol func in customize-image.sh template.

Include in template Helios4 fancontrol conf
This commit is contained in:
Gauthier Provost 2018-01-06 19:15:12 +08:00
parent 40db97da68
commit 3b9a66e1fc

View File

@ -20,6 +20,7 @@ Main() {
case $RELEASE in
jessie)
# your code here
# InstallFanControl # uncomment to install fancontrol
# InstallOpenMediaVault # uncomment to get an OMV 3 image
;;
xenial)
@ -27,6 +28,7 @@ Main() {
;;
stretch)
# your code here
# InstallFanControl # uncomment to install fancontrol
# InstallOpenMediaVault # uncomment to get an OMV 4 image
;;
esac
@ -203,5 +205,61 @@ InstallOpenMediaVault() {
chage -d 0 root
} # InstallOpenMediaVault
InstallFanControl() {
apt-get update
apt-get --yes install fancontrol
if [ "${BOARD}" = "helios4" ]; then
case ${RELEASE} in
jessie)
cat > /etc/fancontrol <<-EOF
# Helios4 GPIO Fan Control Configuration
# This is a temporary configuration while relying on gpio-fan driver.
# Only low or full speed is supported.
# Temp source : lm75 sensor
INTERVAL=10
DEVPATH=hwmon0=devices/platform/j10-pwm hwmon1=devices/platform/j17-pwm hwmon2=devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/0-004c
DEVNAME=hwmon0=gpio_fan hwmon1=gpio_fan hwmon2=lm75
FCTEMPS=hwmon0/pwm1=hwmon2/temp1_input hwmon1/pwm1=hwmon2/temp1_input
MINTEMP=hwmon0/pwm1=45 hwmon1/pwm1=45
MAXTEMP=hwmon0/pwm1=65 hwmon1/pwm1=65
MINSTART=hwmon0/pwm1=1 hwmon1/pwm1=1
MINSTOP=hwmon0/pwm1=0 hwmon1/pwm1=0
EOF
;;
stretch)
cat > /etc/fancontrol <<-EOF
# Helios4 PWM Fan Control Configuration
# Temp source : armada_thermal sensor
INTERVAL=10
DEVPATH=hwmon1=devices/virtual hwmon2=devices/platform/j10-pwm hwmon3=devices/platform/j17-pwm hwmon4=devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/0-004c
DEVNAME=hwmon1=armada_thermal hwmon2=pwmfan hwmon3=pwmfan hwmon4=lm75
FCTEMPS=hwmon2/pwm1=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input
MINTEMP=hwmon2/pwm1=55 hwmon3/pwm1=55
MAXTEMP=hwmon2/pwm1=95 hwmon3/pwm1=95
MINSTART=hwmon2/pwm1=100 hwmon3/pwm1=100
MINSTOP=hwmon2/pwm1=50 hwmon3/pwm1=50
EOF
# Patching fancontrol
patch -b /usr/sbin/fancontrol <<-'EOF'
@@ -157,9 +157,9 @@
function DevicePath()
{
- if [ -h "$1/device" ]
+ if [ -h "$1" ]
then
- readlink -f "$1/device" | sed -e 's/^\/sys\///'
+ readlink -f "$1" | sed -e 's/^\/sys\///;s/\/hwmon\/.*//'
fi
}
EOF
;;
esac
fi
} # InstallFanControl
Main "$@"