Create the kernel-tools package. WHEE

This commit is contained in:
Josh Boyer 2011-08-17 21:18:53 -04:00
parent 1d18ad9c11
commit 8addb5fc3a
3 changed files with 119 additions and 15 deletions

3
cpupower.config Normal file
View File

@ -0,0 +1,3 @@
# See 'cpupower help' and cpupower(1) for more info
CPUPOWER_START_OPTS="frequency-set -g performance"
CPUPOWER_STOP_OPTS="frequency-set -g ondemand"

13
cpupower.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Configure CPU power related settings
After=syslog.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/sysconfig/cpupower
ExecStart=/usr/bin/cpupower $CPUPOWER_START_OPTS
ExecStop=/usr/bin/cpupower $CPUPOWER_STOP_OPTS
[Install]
WantedBy=multi-user.target

View File

@ -443,6 +443,9 @@ Summary: The Linux kernel
%define with_pae_debug %{with_debug} %define with_pae_debug %{with_debug}
%endif %endif
# Architectures we build tools/cpupower on
%define cpupowerarchs %{ix86} x86_64 ppc ppc64
# #
# Three sets of minimum package version requirements in the form of Conflicts: # Three sets of minimum package version requirements in the form of Conflicts:
# to versions below the minimum # to versions below the minimum
@ -532,7 +535,7 @@ BuildRequires: xmlto, asciidoc
BuildRequires: sparse >= 0.4.1 BuildRequires: sparse >= 0.4.1
%endif %endif
%if %{with_tools} %if %{with_tools}
BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) pciutils-devel
%endif %endif
BuildConflicts: rhbuildsys(DiskFree) < 500Mb BuildConflicts: rhbuildsys(DiskFree) < 500Mb
@ -587,6 +590,10 @@ Source111: config-arm-tegra
# added for those wanting to do custom rebuilds with altered config opts. # added for those wanting to do custom rebuilds with altered config opts.
Source1000: config-local Source1000: config-local
# Sources for kernel-tools
Source2000: cpupower.service
Source2001: cpupower.config
# Here should be only the patches up to the upstream canonical Linus tree. # Here should be only the patches up to the upstream canonical Linus tree.
# For a stable release kernel # For a stable release kernel
@ -796,10 +803,19 @@ Summary: Assortment of tools for the Linux kernel
Group: Development/System Group: Development/System
License: GPLv2 License: GPLv2
Obsoletes: perf Obsoletes: perf
Provides: perf
%description -n kernel-tools %description -n kernel-tools
This package contains the tools/ directory from the kernel source This package contains the tools/ directory from the kernel source
- the perf tool and the supporting documentation. - the perf tool and the supporting documentation.
%package -n kernel-tools-devel
Summary: Assortment of tools for the Linux kernel
Group: Development/System
License: GPLv2
%description -n kernel-tools-devel
This package contains the development files for the tools/ directory from
the kernel source.
%package -n kernel-tools-debuginfo %package -n kernel-tools-debuginfo
Summary: Debug information for package kernel-tools Summary: Debug information for package kernel-tools
Group: Development/Debug Group: Development/Debug
@ -812,7 +828,7 @@ This package provides debug information for package kernel-tools.
# symlinks because of the trailing nonmatching alternation and # symlinks because of the trailing nonmatching alternation and
# the leading .*, because of find-debuginfo.sh's buggy handling # the leading .*, because of find-debuginfo.sh's buggy handling
# of matching the pattern against the symlinks file. # of matching the pattern against the symlinks file.
%{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|XXX' -o perf-debuginfo.list} %{expand:%%global debuginfo_args %{?debuginfo_args} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|.*%%{_bindir}/centrino-decode(\.debug)?|.*%%{_bindir}/powernow-k8-decode(\.debug)?|.*%%{_bindir}/cpupower(\.debug)?|.*%%{_libdir}/libcpupower.*|XXX' -o kernel-tools-debuginfo.list}
%endif %endif
@ -1656,11 +1672,30 @@ BuildKernel %make_target %kernel_image
BuildKernel %make_target %kernel_image smp BuildKernel %make_target %kernel_image smp
%endif %endif
%global perf_make \
make %{?_smp_mflags} -C tools/perf -s V=1 HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix}
%if %{with_tools} %if %{with_tools}
%{perf_make} all # perf
%{perf_make} man || %{doc_build_fail} make %{?_smp_mflags} -C tools/perf -s V=1 HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} all
make %{?_smp_mflags} -C tools/perf -s V=1 prefix=%{_prefix} man || %{doc_build_fail}
%ifarch %{cpupowerarchs}
# cpupower
# make sure version-gen.sh is executable.
chmod +x tools/power/cpupower/utils/version-gen.sh
make %{?_smp_mflags} -C tools/power/cpupower CPUFRQ_BENCH=false
# this is fairly unnecessary at the moment. The x86_64 dir just contains
# symlinks to the i386 dir in the tarball, but patch hates that. We'll just
# build the i386 dir in all cases for now.
#ifarch {ix86}
cd tools/power/cpupower/debug/i386
make %{?_smp_mflags} centrino-decode powernow-k8-decode
cd -
#endif
#ifarch x86_64
# cd tools/power/cpupower/debug/x86_64
# make {?_smp_mflags}
# cd -
#endif
%endif
%endif %endif
%if %{with_doc} %if %{with_doc}
@ -1716,13 +1751,9 @@ xargs -0 --no-run-if-empty %{__install} -m 444 -t $man9dir $m
ls $man9dir | grep -q '' || > $man9dir/BROKEN ls $man9dir | grep -q '' || > $man9dir/BROKEN
%endif # with_doc %endif # with_doc
%if %{with_tools} # We have to do the headers install before the tools install because the
# perf tool binary and supporting scripts/binaries # kernel headers_install will remove any header files in /usr/include that
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install # it doesn't install itself.
# perf man pages (note: implicit rpm magic compresses them later)
%{perf_make} DESTDIR=$RPM_BUILD_ROOT install-man || %{doc_build_fail}
%endif
%if %{with_headers} %if %{with_headers}
# Install kernel headers # Install kernel headers
@ -1748,6 +1779,37 @@ rm -f $RPM_BUILD_ROOT/usr/include/asm*/io.h
rm -f $RPM_BUILD_ROOT/usr/include/asm*/irq.h rm -f $RPM_BUILD_ROOT/usr/include/asm*/irq.h
%endif %endif
%if %{with_tools}
# perf tool binary and supporting scripts/binaries
make -C tools/perf -s V=1 DESTDIR=$RPM_BUILD_ROOT HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install
# perf man pages (note: implicit rpm magic compresses them later)
make -C tools/perf -s V=1 DESTDIR=$RPM_BUILD_ROOT HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install-man || %{doc_build_fail}
%ifarch %{cpupowerarchs}
make -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFRQ_BENCH=false install
rm -f %{buildroot}%{_libdir}/*.{a,la}
%find_lang cpupower
mv cpupower.lang ../
#ifarch #{ix86}
cd tools/power/cpupower/debug/i386
install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
cd -
#endif
#ifarch x86_64
# cd tools/power/cpupower/debug/x86_64
# install -m755 powernow-k8-decode {buildroot}{_bindir}/powernow-k8-decode
# cd -
#endif
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service
install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
%endif
%endif
%if %{with_firmware} %if %{with_firmware}
%{build_firmware} %{build_firmware}
%endif %endif
@ -1768,6 +1830,12 @@ rm -rf $RPM_BUILD_ROOT
### scripts ### scripts
### ###
%post -n kernel-tools
/sbin/ldconfig
%postun -n kernel-tools
/sbin/ldconfig
# #
# This macro defines a %%post script for a kernel*-devel package. # This macro defines a %%post script for a kernel*-devel package.
# %%kernel_devel_post [<subpackage>] # %%kernel_devel_post [<subpackage>]
@ -1787,6 +1855,7 @@ then\
fi\ fi\
%{nil} %{nil}
# This macro defines a %%posttrans script for a kernel package. # This macro defines a %%posttrans script for a kernel package.
# %%kernel_variant_posttrans [<subpackage>] # %%kernel_variant_posttrans [<subpackage>]
# More text can follow to go at the end of this variant's %%post. # More text can follow to go at the end of this variant's %%post.
@ -1886,17 +1955,33 @@ fi
%endif %endif
%if %{with_tools} %if %{with_tools}
%files -n kernel-tools %files -n kernel-tools -f cpupower.lang
%defattr(-,root,root) %defattr(-,root,root)
%{_bindir}/perf %{_bindir}/perf
%dir %{_libexecdir}/perf-core %dir %{_libexecdir}/perf-core
%{_libexecdir}/perf-core/* %{_libexecdir}/perf-core/*
%{_mandir}/man[1-8]/* %{_mandir}/man[1-8]/*
%ifarch %{cpupowerarchs}
%{_bindir}/cpupower
%{_bindir}/centrino-decode
%{_bindir}/powernow-k8-decode
%{_libdir}/libcpupower.so.0
%{_libdir}/libcpupower.so.0.0.0
%{_unitdir}/cpupower.service
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
%endif
%if %{with_debuginfo} %if %{with_debuginfo}
%files -f perf-debuginfo.list -n kernel-tools-debuginfo %files -f kernel-tools-debuginfo.list -n kernel-tools-debuginfo
%defattr(-,root,root) %defattr(-,root,root)
%endif %endif
%ifarch %{cpupowerarchs}
%files -n kernel-tools-devel
%{_libdir}/libcpupower.so
%{_includedir}/cpufreq.h
%endif
%endif %endif
# This is %%{image_install_path} on an arch where that includes ELF files, # This is %%{image_install_path} on an arch where that includes ELF files,
@ -1972,6 +2057,9 @@ fi
# ||----w | # ||----w |
# || || # || ||
%changelog %changelog
* Wed Aug 17 2011 Josh Boyer <jwboyer@redhat.com>
- Create the kernel-tools subpackages based on a start by davej
* Tue Aug 16 2011 Dave Jones <davej@redhat.com> * Tue Aug 16 2011 Dave Jones <davej@redhat.com>
- Prepare for packaging more of tools/ by renaming 'perf' subpackage - Prepare for packaging more of tools/ by renaming 'perf' subpackage
to kernel-tools to kernel-tools