Jump to content

How-to start fans during early boot


ShadowDance

Recommended Posts

If you want the fans of your Helios64 to start spinning earlier, look no further. This will allow the fans to spin at a constant speed from the earliest stage of initrd until fancontrol is started by the system. My use-case is for full disk encryption and recovery in initramfs, sometimes I can have the machine powered on for quite a while before fancontrol starts. Or, if the boot process encounters an error the fans may never start, this prevents that.

 

Step 1: Tell initramfs to include the pwm-fan module

echo pwm-fan | sudo tee -a /etc/initramfs-tools/modules

 

Step 2: Create a new file at /etc/initramfs-tools/scripts/init-top/fan with the following contents:

#!/bin/sh

PREREQ=""
prereqs() {
        echo "$PREREQ"
}

case $1 in
prereqs)
        prereqs
        exit 0
        ;;
esac

. /scripts/functions

modprobe pwm-fan

for pwm in /sys/devices/platform/p*-fan/hwmon/hwmon*/pwm1; do
        echo 150 >$pwm
done

exit 0

Feel free to change the value 150 anywhere between 1-255, it decides how fast the fans will spin.

 

Step 3: Enable the fan script for inclusion in initramfs and update the initramfs image:

sudo chmod +x /etc/initramfs-tools/scripts/init-top/fan
sudo update-initramfs -u -k all

 

Step 4: Reboot and ejoy the cool breeze.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines