95.13. lm-sensors-3.6.2
Hardware sensor readings — temperatures, fans and voltages from hwmon
| Version | 3.6.2, release 1 |
| Shelf | hardware — Device access, bus and sensor tools, power management, and Bluetooth |
| Phase | 41_system (System), 644 of 1047 in build order |
| Licence | GPL-2.0-or-later AND LGPL-2.1-or-later |
| Homepage | https://github.com/lm-sensors/lm-sensors |
| Build time | 0.1 SBU |
| Installed size | 319.7 KiB in 24 files |
| Recipe | ports/core/hardware/lm-sensors/kpkgbuild |
About
lm-sensors reads the kernel’s hardware monitoring (hwmon) devices: libsensors turns the raw temperatures, fan speeds and voltages under /sys/class/hwmon into labelled, scaled readings according to /etc/sensors3.conf, and sensors prints them. htop, libksysguard and mesa link the library.
KDOS installs the reader and not the detector. The drivers are loaded without it: most hwmon drivers are bound by udev at boot, and the three that declare no modalias (the Nuvoton and ITE Super-I/O chips and drivetemp) are loaded by fs/etc/modules-load.d/kdos-hwmon.conf.
There is no configure: every setting is a make variable, and the same set is passed to both make lines. A variable that differed between them would leave the library built for one layout and installed in another; ETCDIR, for one, is compiled into libsensors as where to find sensors3.conf.
Sources
lm-sensors-3.6.2.tar.gz(285.5 KiB)
sha256c6a0587e565778a40d88891928bf8943f27d353f382d5b745a997d635978a8f0
upstream: https://github.com/lm-sensors/lm-sensors/archive/refs/tags/V3-6-2.tar.gz
archive copy: sources-3/hardware--lm-sensors-3.6.2.tar.gz
Dependencies
Required by (5): htop, kinfocenter, ksystemstats, libksysguard, mesa.
Patches
build.sh applies these; kpkg applies nothing by itself.
iconv-probe.patch— Inprog/sensors/Module.mk, changesLIBICONV :=toLIBICONV ?=. The makefile works out whether to link-liconvby running/sbin/ldconfig -pand searching its output forlibiconv.so. With:=, make runs that command while it reads the makefile even whenLIBICONVis given on the command line; with?=the command line’s empty value stands and the probe never runs. musl keeps no loader cache, and the tree’sldconfigprints nothing, so the probe has nothing to read.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install lm-sensors'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/hardware/lm-sensors.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/hardware/lm-sensors
echo 'c6a0587e565778a40d88891928bf8943f27d353f382d5b745a997d635978a8f0 lm-sensors-3.6.2.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/lm-sensors
SRC=$SRC_ROOT/lm-sensors-3.6.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf lm-sensors-3.6.2.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/iconv-probe.patch"
make PREFIX=/usr LIBDIR=/usr/lib ETCDIR=/etc MANDIR=/usr/share/man PROG_EXTRA= BUILD_STATIC_LIB=0 LIBICONV= EXLDFLAGS="$LDFLAGS"
make PREFIX=/usr LIBDIR=/usr/lib ETCDIR=/etc MANDIR=/usr/share/man PROG_EXTRA= BUILD_STATIC_LIB=0 LIBICONV= EXLDFLAGS="$LDFLAGS" DESTDIR=$PKG install
rm -f "$PKG/usr/sbin/sensors-detect" \
"$PKG/usr/share/man/man8/sensors-detect.8" \
"$PKG/usr/share/zsh/site-functions/_sensors-detect"
The switches, and why each is set:
PREFIX=/usr,LIBDIR=/usr/lib,ETCDIR=/etc,MANDIR=/usr/share/man— Where everything is installed. The makefile’s own default prefix is/usr/local.PROG_EXTRA=— Build no extra programs, which is also the makefile’s default. The one upstream offers,sensord, logs readings through rrdtool.BUILD_STATIC_LIB=0— Build nolibsensors.a, which the makefile builds and installs by default.LIBICONV=— Linksensorsagainst no separate iconv library; musl’s C library has iconv built in.iconv-probe.patchmakes the makefile respect this without running its probe.EXLDFLAGS="$LDFLAGS"— Link with the tree’sLDFLAGS. The makefile’s own value is-Wl,-rpath,$(LIBDIR)followed byLDFLAGS, so the one difference is that the programs carry no run path;/usr/libis on the loader’s search path anyway.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/lm-sensors, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf lm-sensors-3.6.2-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/lm-sensors, and runs the triggers its paths call for.
Contents
Installed programs: fancontrol, isadump, isaset, pwmconfig, sensors, sensors-conf-convert.
Installed libraries: libsensors.so.
Installed directories: /etc/sensors.d, /usr/include/sensors, /usr/share/licenses/lm-sensors.
Short descriptions
fancontrol |
automated software based fan speed regulation |
isadump |
examine ISA registers |
isaset |
set ISA registers |
pwmconfig |
tests the PWM outputs of sensors and configures fancontrol |
sensors |
print sensors information |
sensors-conf-convert |
sensors configuration conversion |
Notes
build.sh removes sensors-detect, its manual page and its zsh completion from the package, because the makefile installs them unconditionally. sensors-detect finds sensor chips by probing I/O ports and SMBus addresses, which on KDOS is done instead by the kernel’s own driver binding described above.