%if 0%{?fedora} %global buildforkernels akmod %global debug_package %{nil} %endif %global prjname acer-wmi-battery %global gitabbrev 4e605fb %global gitdate 20230612 %global rel %{gitdate}git%{gitabbrev} Name: %{prjname}-kmod Summary: Kernel module (kmod) for %{prjname} Version: 0.1.0 Release: 3%{?rel:.%{rel}}%{?dist} License: GPLv2+ URL: https://github.com/frederik-h/acer-wmi-battery Source0: %{url}/archive/v%{version}/%{prjname}-%{version}%{?rel:-%{rel}}.tar.gz BuildRequires: gcc BuildRequires: elfutils-libelf-devel BuildRequires: kmodtool # kmodtool does its magic here %{expand:%(kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{prjname} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) } %description This module is an experimental Linux kernel driver for the battery health control WMI interface of Acer laptops. It can be used to control two battery-related features of Acer laptops that Acer provides through the Acer Care Center on Windows: a health mode that limits the battery charge to 80% with the goal of preserving your battery's capacity and a battery calibration mode which puts your battery through a controlled charge-discharge cycle to provide more accurate battery capacity estimates. %package -n %{prjname}-kmodsrc Summary: module sources for %{name} %description -n %{prjname}-kmodsrc Source tree. %prep # error out if there was something wrong with kmodtool %{?kmodtool_check} # print kmodtool output for debugging purposes: kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{prjname} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null %setup -q -c for kernel_version in %{?kernel_versions} ; do cp -a %{prjname} _kmod_build_${kernel_version%%___*} done %build for kernel_version in %{?kernel_versions} ; do make V=1 %{?_smp_mflags} -C ${kernel_version##*___} M=${PWD}/_kmod_build_${kernel_version%%___*} modules done %install install -m 755 -d $RPM_BUILD_ROOT%{_datadir}/%{prjname} install -m 644 %{SOURCE0} $RPM_BUILD_ROOT%{_datadir}/%{prjname} for kernel_version in %{?kernel_versions}; do mkdir -p %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/ install -D -m 755 _kmod_build_${kernel_version%%___*}/%{prjname}.ko %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/ chmod a+x %{buildroot}%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/*.ko done %{?akmod_install} %files -n %{prjname}-kmodsrc %{_datadir}/%{prjname} %changelog * Tue Oct 15 2024 Andrea Santilli - 0.1.0-3.20230612git4e605fb - Update to commit 4e605fb2c78412e0c431a06e9f8ee17c9e0e0095 - Drop update_state() patch. - Update version to 0.1.0. - Add kmodsrc subpackage. * Mon Mar 13 2023 Andrea Santilli - 0-2.20220818git176af5f - Update the sysfs status on health mode change. * Thu Jan 05 2023 Andrea Santilli - 0-1.20220818git176af5f - Initial akmod RPM release.