add: nct6687d (#11162) (#11188)

This commit is contained in:
Raboneko
2026-04-11 22:07:55 -05:00
committed by GitHub
parent a321acd0fa
commit 1e334a3d65
11 changed files with 270 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
project pkg {
arches = ["x86_64"]
rpm {
spec = "nct6687d-kmod.spec"
}
labels {
mock = 1
updbranch = 1
}
}
@@ -0,0 +1,69 @@
# The reason why this package is a separate from the main one despite using the same sources
# is because akmods use the srpm to build the kmod package, and if the kmod package is included
# in the main package, akmods will reinstall the userspace package every time the kernel is updated.
%if 0%{?fedora}
%global buildforkernels akmod
%global debug_package %{nil}
%endif
%global commit cedda8bff09a4083e07414fb80fdc3901e7ab544
%global commitdate 20260411
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global modulename nct6687d
Name: %{modulename}-kmod
Version: 1.0^%{commitdate}git.%{shortcommit}
Release: 1%{?dist}
Summary: Linux kernel driver for the NCT6687D hardware monitoring chip
License: GPL-2.0-or-later
URL: https://github.com/Fred78290/%{modulename}
Source0: %{url}/archive/%{commit}.tar.gz#/%{modulename}-%{shortcommit}.tar.gz
BuildArch: x86_64
BuildRequires: gcc
BuildRequires: make
BuildRequires: kmodtool
BuildRequires: elfutils-libelf-devel
Requires: akmods
Requires: %{modulename} = %{?epoch:%{epoch}:}%{version}
Requires: %{modulename}-akmod-modules = %{?epoch:%{epoch}:}%{version}
Requires: kernel-devel
Conflicts: dkms-%{modulename}
%{expand:%(kmodtool --target %{_target_cpu} --repo terra.fyralabs.com --kmodname %{modulename} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%description
Linux kernel driver for the NCT6687D hardware monitoring chip.
This kernel module permit to recognize the chipset Nuvoton NCT6687-R in lm-sensors package. This sensor is present on some B550 motherboard such as MSI or ASUS.
The implementation is minimalist and was done by reverse coding of Windows 10 source code from LibreHardwareMonitor
%prep
# error out if there was something wrong with kmodtool
%{?kmodtool_check}
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo terra.fyralabs.com --kmodname %{modulename} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
%setup -q -c -n %{modulename}-%{commit}
for kernel_version in %{?kernel_versions} ; do
cp -a %{modulename}-%{commit} _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions}; do
make V=0 %{?_smp_mflags} -C "${kernel_version##*___}" M=${PWD}/_kmod_build_${kernel_version%%___*}
done
%install
for kernel_version in %{?kernel_versions}; do
mkdir -p %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
install -D -m 755 _kmod_build_${kernel_version%%___*}/*.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/
chmod a+x %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/*.ko
done
%{?akmod_install}
%changelog
* Sat Apr 11 2026 Luan Oliveira <luanv.oliveira@outlook.com> - 1.0^20260411git.cedda8b-1
- Initial package
+9
View File
@@ -0,0 +1,9 @@
let c = sh("cat anda/system/nct6687d/kmod-common/nct6687d.spec | grep '%global commit ' | sed -E 's/.+commit //'", #{"stdout": "piped"}).ctx.stdout;
c.pop();
rpm.global("commit", c);
if rpm.changed() {
rpm.release();
let d = sh("cat anda/system/nct6687d/kmod-common/nct6687d.spec | grep '%global commitdate' | sed -E 's/.+commitdate //'", #{"stdout": "piped"}).ctx.stdout;
d.pop();
rpm.global("commitdate", d);
}
+10
View File
@@ -0,0 +1,10 @@
project pkg {
arches = ["x86_64"]
rpm {
spec = "dkms-nct6687d.spec"
}
labels {
updbranch = 1
mock = 1
}
}
@@ -0,0 +1,61 @@
%global commit cedda8bff09a4083e07414fb80fdc3901e7ab544
%global debug_package %{nil}
%global modulename nct6687d
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commitdate 20260411
Name: dkms-%{modulename}
Version: 1.0^%{commitdate}git.%{shortcommit}
Release: 1%{?dist}
Summary: Linux kernel driver for the NCT6687D hardware monitoring chip
License: GPL-2.0-or-later
URL: https://github.com/Fred78290/%{modulename}
Source0: %{url}/archive/%{commit}.tar.gz#/%{name}-%{shortcommit}.tar.gz
Patch0: dkms-version.patch
BuildRequires: sed
BuildRequires: systemd-rpm-macros
Requires: %{modulename} = %{?epoch:%{epoch}:}%{version}
Requires: dkms
Conflicts: akmod-%{modulename}
Provides: %{name}-kmod-common = %{?epoch:%{epoch}:}%{version}
BuildArch: x86_64
Provides: %{modulename}-kmod
%description
Linux kernel driver for the NCT6687D hardware monitoring chip.
This kernel module permit to recognize the chipset Nuvoton NCT6687-R in lm-sensors package. This sensor is present on some B550 motherboard such as MSI or ASUS.
The implementation is minimalist and was done by reverse coding of Windows 10 source code from LibreHardwareMonitor
%package akmod-modules
Summary: Modules for Akmods
Requires: akmod-%{name}
BuildArch: noarch
%description akmod-modules
Akmods modules for the akmod-%{name} package.
%prep
%autosetup -p1 -n %{modulename}-%{commit}
sed -i -e 's/__VERSION_STRING/%{version}/g' dkms.conf
%install
mkdir -p %{buildroot}%{_usrsrc}/%{modulename}-%{version}
cp -fr ./ %{buildroot}%{_usrsrc}/%{modulename}-%{version}/
%post
dkms add -m %{modulename} -v %{version} -q --rpm_safe_upgrade || :
# Rebuild and make available for the currently running kernel:
dkms build -m %{modulename} -v %{version} -q || :
dkms install -m %{modulename} -v %{version} -q --force || :
%preun
dkms remove -m %{modulename} -v %{version} -q --all --rpm_safe_upgrade || :
%files
%{_usrsrc}/%{modulename}-%{version}
%changelog
* Sat Apr 11 2026 Luan Oliveira <luanv.oliveira@outlook.com> - 1.0^20260411git.cedda8b-1
- Initial package
@@ -0,0 +1,11 @@
diff --git a/dkms.conf b/dkms.conf
index d8fc2b1..d315428 100644
--- a/dkms.conf
+++ b/dkms.conf
@@ -1,5 +1,5 @@
PACKAGE_NAME="nct6687d"
-PACKAGE_VERSION="1"
+PACKAGE_VERSION="__VERSION_STRING"
MAKE[0]="make kver=${kernelver} dkms/build"
BUILT_MODULE_NAME[0]="nct6687"
DEST_MODULE_LOCATION[0]="/kernel/drivers/hwmon/"
+9
View File
@@ -0,0 +1,9 @@
let c = sh("cat anda/system/nct6687d/kmod-common/nct6687d.spec | grep '%global commit ' | sed -E 's/.+commit //'", #{"stdout": "piped"}).ctx.stdout;
c.pop();
rpm.global("commit", c);
if rpm.changed() {
rpm.release();
let d = sh("cat anda/system/nct6687d/kmod-common/nct6687d.spec | grep '%global commitdate' | sed -E 's/.+commitdate //'", #{"stdout": "piped"}).ctx.stdout;
d.pop();
rpm.global("commitdate", d);
}
@@ -0,0 +1,9 @@
project pkg {
arches = ["x86_64"]
rpm {
spec = "nct6687d.spec"
}
labels {
nightly = 1
}
}
@@ -0,0 +1,22 @@
<component type="driver">
<id>com.github.nct6687d</id>
<name>NCT6687D Kernel module</name>
<pkgname>nct6687d</pkgname>
<summary>Linux kernel driver for the NCT6687D hardware monitoring chip.</summary>
<description>
<p>
This kernel module permit to recognize the chipset Nuvoton NCT6687-R in lm-sensors package. This sensor is present on some B550 motherboard such as MSI or ASUS.
The implementation is minimalist and was done by reverse coding of Windows 10 source code from <a href="https://github.com/LibreHardwareMonitor/LibreHardwareMonitor">LibreHardwareMonitor</a>.
</p>
</description>
<url type="homepage">https://github.com/Fred78290/nct6687d</url>
<metadata_license>CC0-1.0</metadata_license>
<!-- gplv2 -->
<project_license>GPL-2.0-or-later</project_license>
<developer id="com.github.Fred78290">
<name>Fred78290</name>
</developer>
</component>
@@ -0,0 +1,55 @@
%global commit cedda8bff09a4083e07414fb80fdc3901e7ab544
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commitdate 20260411
Name: nct6687d
Version: 1.0^%{commitdate}git.%{shortcommit}
Release: 1%{?dist}
Summary: Linux kernel driver for the NCT6687D hardware monitoring chip
License: GPL-2.0-or-later
URL: https://github.com/Fred78290/%{name}
Source0: %{url}/archive/%{commit}.tar.gz#/%{name}-%{shortcommit}.tar.gz
Source1: com.github.nct6687d.metainfo.xml
BuildRequires: systemd-rpm-macros
Requires: %{name}-kmod = %{?epoch:%{epoch}:}%{version}
Provides: %{name}-kmod-common = %{?epoch:%{epoch}:}%{version}
BuildArch: noarch
%description
Linux kernel driver for the NCT6687D hardware monitoring chip.
This kernel module permit to recognize the chipset Nuvoton NCT6687-R in lm-sensors package. This sensor is present on some B550 motherboard such as MSI or ASUS.
The implementation is minimalist and was done by reverse coding of Windows 10 source code from LibreHardwareMonitor
%package akmod-modules
Summary: Modules for Akmods
Requires: %{name}-kmod = %{?epoch:%{epoch}:}%{version}
BuildArch: noarch
%description akmod-modules
Akmods modules for the akmod-%{name} package.
%prep
%autosetup -p1 -n %{name}-%{commit}
echo %{name} > %{name}.conf
echo "blacklist nct6683" > nct6683_blacklist.conf
%install
install -Dm644 %{SOURCE1} %{buildroot}%{_datadir}/metainfo/com.github.nct6687d.metainfo.xml
# Akmods modules
install -Dm 0644 %{name}.conf -t %{buildroot}%{_modulesloaddir}
install -Dm 0644 nct6683_blacklist.conf -t %{buildroot}%{_modprobedir}
%files
%license LICENSE
%doc README.md images/* TESTING_RESULTS.md
%{_modprobedir}/nct6683_blacklist.conf
%{_datadir}/metainfo/com.github.nct6687d.metainfo.xml
%files akmod-modules
%{_modulesloaddir}/%{name}.conf
%changelog
* Sat Apr 11 2026 Luan Oliveira <luanv.oliveira@outlook.com> - 1.0^20260411git.cedda8b-1
- Initial package
@@ -0,0 +1,5 @@
rpm.global("commit", gh_commit("Fred78290/nct6687d"));
if rpm.changed() {
rpm.release();
rpm.global("commitdate", date());
}