Skip to content

Commit a30addf

Browse files
author
John B. Wyatt IV
committed
Enable building libcpupower bindings for ELN/Rawhide
JIRA: https://issues.redhat.com/browse/RHEL-83442 Upstream Status: https://gitlab.com/cki-project/kernel-ark.git commit ed717f656cc0640b8fc22d18dd52df6cfe622273 Author: John B. Wyatt IV <jwyatt@redhat.com> Date: Wed May 21 16:58:24 2025 -0400 Enable building libcpupower bindings for ELN/Rawhide Python bindings for libcpupower were introduced in Linux 6.12 that are needed for tools like Tuna to manage c-states (the power states of a cpu). 6.17-rc1 introduced changes to make it possible for distributions like Fedora Rawhide and ELN to build the bindings were merged in. The MR associated with this issue will allow the bindings to build. With consultation on the Fedora side kernel-tools-lib-devel was requested to be the package to add the two files that are needed by the bindings. SWIG is used to generate the bindings. Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com> Signed-off-by: John B. Wyatt IV <sageofredondo@gmail.com> Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
1 parent 008ae62 commit a30addf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

redhat/kernel.spec.template

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,11 @@ BuildRequires: libbpf-devel
772772
BuildRequires: bpftool
773773
BuildRequires: clang
774774

775+
%ifarch %{cpupowerarchs}
776+
# For libcpupower bindings
777+
BuildRequires: swig
778+
%endif
779+
775780
%ifnarch s390x
776781
BuildRequires: pciutils-devel
777782
%endif
@@ -3118,6 +3123,8 @@ chmod +x tools/perf/check-headers.sh
31183123
%ifarch %{cpupowerarchs}
31193124
# link against in-tree libcpupower for idle state support
31203125
%global rtla_make %{tools_make} LDFLAGS="%{__global_ldflags} -L../../power/cpupower" INCLUDES="-I../../power/cpupower/lib"
3126+
# Build libcpupower Python bindings
3127+
%global libcpupower_python_bindings_make %{tools_make} LDFLAGS="-L%{buildroot}%{_libdir} -lcpupower"
31213128
%else
31223129
%global rtla_make %{tools_make}
31233130
%endif
@@ -3504,6 +3511,12 @@ mv cpupower.lang ../
35043511
popd
35053512
%endif
35063513
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
3514+
%{log_msg "Build libcpupower Python bindings"}
3515+
pushd tools/power/cpupower/bindings/python
3516+
%{libcpupower_python_bindings_make}
3517+
%{log_msg "Install libcpupower Python bindings"}
3518+
%{make} INSTALL_DIR=$RPM_BUILD_ROOT%{python3_sitearch} install
3519+
popd
35073520
%endif
35083521
%ifarch x86_64
35093522
mkdir -p %{buildroot}%{_mandir}/man8
@@ -4138,6 +4151,9 @@ fi\
41384151
%{_includedir}/cpufreq.h
41394152
%{_includedir}/cpuidle.h
41404153
%{_includedir}/powercap.h
4154+
# libcpupower Python bindings
4155+
%{python3_sitearch}/_raw_pylibcpupower.so
4156+
%{python3_sitearch}/raw_pylibcpupower.py
41414157
%endif
41424158
%if %{with_ynl}
41434159
%{_libdir}/libynl*

0 commit comments

Comments
 (0)