Hi everyone,

I've just upgraded from Bering-uClibc 2.4.2 to 3.0-beta1 with no
problems. Many thanks to everyone involved in the development of this
new version.

For a while now I've been thinking of experimenting with the lm-sensors
packages for LEAF Bering-uClibc. I like to monitor the bandwidth and CPU
usage of my firewall (I use SNMP queries from a separate machine running
Cacti, which is based on RRDtool) and extending this monitoring to
include the additional data from lm-sensors seemed like a nice idea.

I've previously been put off because I didn't think the machine I used
as a firewall had any monitoring chips (it's an ancient 100MHz Pentium
1) and because I knew the sensors-detect script which takes most of the
hard work out of configuring lm-sensors was written in Perl, which
wasn't available for Bering-uClibc. However, I recently got a new(er)
machine and I spotted that there's a MicroPerl (uperl.lrp) package in
testing for Bering-uClibc 3.0, so I thought I'd give it a go. Here's a
summary of how I got on in case other people need some clues in order to
get started. This is far from being a comprehensive HOWTO document but
somebody might find it useful.

If you happen to know what monitoring chip(s) are installed on your
motherboard, or if you can temporarily run a bigger Linux distribution
on the firewall hardware and run sensors-detect using that it will make
life a lot easier, but I didn't / couldn't. Note that with all of the
packages required for this it's necessary to have a larger than normal
root disk - i.e. "syst_size" in leaf.cfg needs to be increased to
something like 12M.

With the two packages "libsens.lrp" and "sensors.lrp" installed but no
further configuration performed, running the command "sensors" gives an
error:
    # sensors
    Can't access procfs/sysfs file
    Unable to find i2c bus information;
    For 2.6 kernels, make sure you have mounted sysfs and libsensors
    was compiled with sysfs support!
    For older kernels, make sure you have done 'modprobe i2c-proc'!

Fair enough; we have an "older" kernel (2.4) so:
    # insmod i2c-proc
    insmod: i2c-proc.o: no module by that name found

That's because the additional kernel modules need copying
into /lib/modules. I'm going to skip the details of how I fixed this
since it's pretty common to have to load additional kernel modules for
Bering-uClibc and the process is documented elsewhere. Suffice to say
that the necessary files are in the Bering-uClibc_modules_2.4.33.tar.gz
archive, in directory 2.4.33/kernel/drivers/i2c and the busses/ and
chips/ sub-directories. Initially I didn't know which ones I wanted so I
just copied everything, removing the busses/ and chips/ directory levels
and putting all the files into /lib/modules.

    # insmod i2c-proc
    insmod: unresolved symbol i2c_check_functionality
    insmod: unresolved symbol i2c_smbus_xfer
    insmod: unresolved symbol i2c_check_addr
    insmod: unresolved symbol i2c_adapter_id

It turns out there's a module of core functions for the i2c bus which
contains these unresolved symbols:
    # insmod i2c-core
    # insmod i2c-proc
    # sensors
    No sensors found!

I have experience of installing and configuring lm-sensors on other
Linux platforms. Basically you run the sensors-detect utility, do what
it tells you to do, check and if necessary modify the configuration file
and then run the sensors command to report the data. The problem for
Bering-uClibc is that sensors-detect is a Perl script, so we need that
script and also a Perl interpreter.

I copied over revision "1.393 $ ($Date: 2005/08/30 18:51:18 $)" of the
sensors-detect script from another Linux machine (it's just a single
file) and installed the Bering-uClibc 3.0 uperl.lrp package. This
package is just a "bare" Perl interpreter with none of the add-on
modules that normally come with a Perl installation - and the script
needs a few of these. I managed to get away with copying just the
following Perl module files from my other Linux machine into
directory /usr/local/lib/perl5/5.9 on the firewall:
    Carp.pm
    Exporter.pm
    constant.pm
    strict.pm
    subs.pm
    use.pm
    warnings.pm
    warnings/register.pm

Then I started hacking out all the bits of code that I couldn't get
working by just copying a few files...
    Commented out "use Fcntl;" on line 32
    Commented out "use POSIX;" on line 33
    Replaced "O_RDWR" on line 1916 with "0" (zero)

That was enough to get the script running, and it detected the I2C bus
on my machine as an "Intel 82371AB PIIX4 ACPI" which needed the
"i2c-piix4" driver module. The script tries to bring in this module with
"modprobe", which isn't available under Bering-uClibc, so I quit out of
the script (^C) and tried to install the module manually:
    # insmod i2c-piix4
    insmod: unresolved symbol is_unsafe_smbus

This unresolved symbol comes from dmi_scan.o, so:
    # insmod dmi_scan
    # insmod i2c-piix4

Running the sensors-detect script again, it spots that the kernel module
for the I2C bus adapter is installed and gets further, but reports that
kernel module i2c-dev needs to be installed:
    # insmod i2c-dev

Running sensors-detect again it gets further still but stops when it
fails to find the "i2cdetect" program. I initially thought this would be
another Perl script but no, it's an executable compiled from C source
code.  Fortunately the comments in sensors-detect indicate that
i2cdetect basically just returns the output from
"cat /proc/bus/i2c" (for a 2.4 kernel) so a workaround is to replace the
two occurrences of "i2cdetect -l |" in sensors-detect with
"/proc/bus/i2c".

Running sensors-detect again it uses the output from /proc/bus/i2c to
report e.g. "Next adapter: SMBus PIIX4 adapter at fc00" but attempting
to scan this hits another Perl error: "ioctl is not implemented...". I
failed to work out how to fix this properly so just ended up commenting
out the two ioctl lines that were causing errors, at which point the
script went ahead and scanned the bus and returned a long list of
candidate sensor chips and their driver modules. In my case this was
quite a list (8 in all) but after trying each of the kernel modules in
turn one of them (lm92) did eventually work and the "sensors" command
returned information on the CPU temperature.

Finally knowing the kernel modules required for the bus (i2c-piix4) and
sensor chip (lm92) for my motherboard, I was able to remove all the
redundant modules from /lib/modules and place the few required entries
into /etc/modules. In my case these are:
    i2c-core
    i2c-dev
    i2c-proc
    dmi_scan
    i2c-piix4
    lm92

The "sensors" command is now consistently returning data like:
    lm92-i2c-0-4c
    Adapter: SMBus PIIX4 adapter at fc00
    CPU Temp: +67.9375 C (high = +255.9375 C,
        low = +5.9375 C, crit = +1.9375 C,
        hyst = +1.9375 C) ALARMS (HIGH)

I'm not at all convinced that the values reported here are correct so I
think some calibration is required (via "compute" statements
in /etc/sensors.conf) but at least the commands seem to be working. I
still need to do the calibration, and I still need to work out how to
return the data using SNMP, but it feels like I'm most of the way there.

davidMbrooke


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
------------------------------------------------------------------------
leaf-user mailing list: leaf-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-user
Support Request -- http://leaf-project.org/

Reply via email to