Enabling temperature sensor in CentOS on ALIX.2D2
Now let’s make use of this temperature sensor on ALIX board. First we need lm_sensors package, so let’s install it:
# yum install lm_sensors
Now if you’ll run sensors-detect it won’t detect anything. We need the module called scx200_acb:
# grep -i scx200_acb /boot/config-`uname -r`
# CONFIG_SCx200_ACB is not set
Ok, it exists in kernel sources, but just not compiled in CentOS/RHEL kernel. Let’s compile it ourselves. It can be done on ALIX ifself (but will be slow and take time and space) or on any other CentOS machine.
Install devepment packages:
# yum install rpm-build
(will also install patch elfutils elfutils-libs)
# yum install gnupg redhat-rpm-config gcc
(will also install cpp glibc-devel glibc-headers kernel-headers libgomp libusb)
# yum install kernel-devel
Now we are ready to install kernel sources:
# rpm -ivh http://mirror.centos.org/centos/5/updates/SRPMS/kernel-`uname -r`.src.rpm
Prepare kernel tree:
# rpmbuild -bp –target i686 /usr/src/redhat/SPECS/kernel-2.6.spec
And then:
# cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i686/drivers/i2c/busses
# make CONFIG_SCx200_ACB=m -C /lib/modules/`uname -r`/build M=`pwd` modules
It will also compile few other modules, but we need only scx200_acb.ko:
# cp scx200_acb.ko /lib/modules/`uname -r`/extra/
# depmod -A
And now:
# modprobe scx200_acb
# sensor-detect
# echo MODULE_1=scx200_acb >> /etc/sysconfig/lm_sensors
# /etc/init.d/lm_sensors start
Now run it:
# sensors
lm86-i2c-0-4c
Adapter: CS5536 ACB0
M/B Temp: +43 C (low = +0 C, high = +70 C)
CPU Temp: +49.5 C (low = +0.0 C, high = +70.0 C)
M/B Crit: +85 C (hyst = +75 C)
CPU Crit: +85 C (hyst = +75 C)
Voila! It works.
(Don’t mind the temperature, summers are hot here, about 30 C in the room).
And when you’ll update the kernel you won’t need to recompile the module again, it will be linked via weak-updates directory.