2016-10-14 00:17:00 +08:00
|
|
|
# Contribution from Arch: https://projects.archlinux.org/svntogit/community.git/tree/trunk?h=packages/linux-tools
|
2016-03-30 03:28:32 +08:00
|
|
|
|
|
|
|
pkgbase=linux-tools
|
2018-08-04 22:47:44 +08:00
|
|
|
pkgname=(
|
|
|
|
'cgroup_event_listener'
|
|
|
|
'cpupower'
|
|
|
|
'hyperv'
|
|
|
|
'libtraceevent'
|
|
|
|
'linux-tools-meta'
|
|
|
|
'perf'
|
|
|
|
'tmon'
|
|
|
|
'turbostat'
|
|
|
|
'usbip'
|
|
|
|
'x86_energy_perf_policy'
|
|
|
|
)
|
2018-12-01 21:05:51 +08:00
|
|
|
pkgver=4.19.6
|
|
|
|
pkgrel=1
|
2016-03-30 03:28:32 +08:00
|
|
|
license=('GPL2')
|
2016-06-29 18:34:14 +08:00
|
|
|
arch=('x86_64')
|
2016-03-30 03:28:32 +08:00
|
|
|
url='http://www.kernel.org'
|
|
|
|
options=('!strip')
|
2018-12-01 21:05:51 +08:00
|
|
|
makedepends=('git' "linux=4.19.6")
|
2016-03-30 03:28:32 +08:00
|
|
|
# split packages need all package dependencies set manually in makedepends
|
|
|
|
# kernel source deps
|
|
|
|
makedepends+=('asciidoc' 'xmlto')
|
|
|
|
# perf deps
|
|
|
|
makedepends+=('perl' 'python2' 'libnewt' 'elfutils' 'libunwind' 'numactl' 'audit')
|
|
|
|
# cpupower deps
|
|
|
|
makedepends+=('pciutils')
|
|
|
|
# usbip deps
|
|
|
|
makedepends+=('glib2' 'sysfsutils' 'udev')
|
|
|
|
# tmon deps
|
|
|
|
makedepends+=('ncurses')
|
|
|
|
groups=("$pkgbase")
|
|
|
|
source=("http://www.kernel.org/pub/linux/kernel/v4.x/linux-${pkgver}.tar.xz"
|
|
|
|
'cpupower.default'
|
|
|
|
'cpupower.systemd'
|
|
|
|
'cpupower.service'
|
2017-03-30 20:19:14 +08:00
|
|
|
'usbipd.service')
|
2018-12-01 21:05:51 +08:00
|
|
|
sha256sums=('644e61beb66211c0c5c13f91d96de1725055e6eea4cda7bb37ce9929ba8f09c3'
|
2017-08-01 18:14:09 +08:00
|
|
|
'4fa509949d6863d001075fa3e8671eff2599c046d20c98bb4a70778595cd1c3f'
|
|
|
|
'fbf6e0ce6eb0ef15703fe212958de6ca46e62188900b5e9f9272ed3cc9cfd54e'
|
|
|
|
'a89284d0ecb556ca53a66d1c2087b5fd6d0a901ab2769cd3aebb93f4478905dc'
|
|
|
|
'2e187734d8aec58a3046d79883510d779aa93fb3ab20bd3132c1a607ebe5498f')
|
2016-03-30 03:28:32 +08:00
|
|
|
|
|
|
|
prepare() {
|
|
|
|
cd linux-${pkgver}
|
|
|
|
# apply patch from the source array (should be a pacman feature)
|
|
|
|
local filename
|
|
|
|
for filename in "${source[@]}"; do
|
|
|
|
if [[ "$filename" =~ \.patch$ ]]; then
|
|
|
|
msg2 "Applying patch $filename"
|
|
|
|
patch -p1 -N -i "$srcdir/$filename"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
msg2 'libtraceevent'
|
|
|
|
pushd linux-${pkgver}/tools/lib/traceevent
|
|
|
|
make
|
|
|
|
popd
|
|
|
|
|
|
|
|
msg2 'perf'
|
|
|
|
pushd linux-${pkgver}/tools/perf
|
2016-10-25 04:21:49 +08:00
|
|
|
make -f Makefile.perf \
|
|
|
|
prefix=/usr \
|
|
|
|
lib=lib/perf \
|
|
|
|
perfexecdir=lib/perf \
|
|
|
|
NO_SDT=1 \
|
2016-03-30 03:28:32 +08:00
|
|
|
PYTHON=python2 \
|
|
|
|
PYTHON_CONFIG=python2-config \
|
|
|
|
PERF_VERSION=$pkgver-$pkgrel \
|
|
|
|
all man
|
|
|
|
popd
|
|
|
|
|
|
|
|
msg2 'cpupower'
|
|
|
|
pushd linux-${pkgver}/tools/power/cpupower
|
|
|
|
make VERSION=$pkgver-$pkgrel
|
|
|
|
popd
|
|
|
|
|
|
|
|
msg2 'x86_energy_perf_policy'
|
|
|
|
pushd linux-${pkgver}/tools/power/x86/x86_energy_perf_policy
|
|
|
|
make
|
|
|
|
popd
|
|
|
|
|
|
|
|
msg2 'usbip'
|
|
|
|
pushd linux-${pkgver}/tools/usb/usbip
|
|
|
|
./autogen.sh
|
|
|
|
./configure --prefix=/usr --sbindir=/usr/bin
|
|
|
|
make
|
|
|
|
popd
|
|
|
|
|
|
|
|
msg2 'tmon'
|
|
|
|
pushd linux-${pkgver}/tools/thermal/tmon
|
|
|
|
make
|
|
|
|
popd
|
|
|
|
|
|
|
|
msg2 'cgroup_event_listener'
|
|
|
|
pushd linux-${pkgver}/tools/cgroup
|
|
|
|
make
|
|
|
|
popd
|
|
|
|
|
|
|
|
msg2 'turbostat'
|
|
|
|
pushd linux-${pkgver}/tools/power/x86/turbostat
|
|
|
|
make
|
|
|
|
popd
|
2018-08-04 22:47:44 +08:00
|
|
|
|
|
|
|
msg2 'hv'
|
2018-08-14 00:15:32 +08:00
|
|
|
pushd linux-${pkgver}/tools/hv
|
2018-08-04 22:47:44 +08:00
|
|
|
CFLAGS+=' -DKVP_SCRIPTS_PATH=/usr/lib/hyperv/kvp_scripts/' make
|
|
|
|
popd
|
2016-03-30 03:28:32 +08:00
|
|
|
}
|
|
|
|
|
2018-08-04 22:47:44 +08:00
|
|
|
|
2016-03-30 03:28:32 +08:00
|
|
|
package_linux-tools-meta() {
|
|
|
|
pkgdesc='Linux kernel tools meta package'
|
|
|
|
groups=()
|
|
|
|
depends=(
|
|
|
|
'cgroup_event_listener'
|
|
|
|
'cpupower'
|
2018-08-04 22:47:44 +08:00
|
|
|
'hyperv'
|
2016-03-30 03:28:32 +08:00
|
|
|
'libtraceevent'
|
|
|
|
'perf'
|
|
|
|
'tmon'
|
|
|
|
'turbostat'
|
|
|
|
'usbip'
|
|
|
|
'x86_energy_perf_policy'
|
|
|
|
)
|
|
|
|
conflicts=(
|
|
|
|
'acpidump'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
package_libtraceevent() {
|
|
|
|
pkgdesc='Linux kernel trace event library'
|
|
|
|
depends=('glibc')
|
|
|
|
|
2018-08-14 03:00:39 +08:00
|
|
|
cd linux-${pkgver}/tools/lib/traceevent
|
2016-03-30 03:28:32 +08:00
|
|
|
install -dm 755 "$pkgdir/usr/lib"
|
|
|
|
install -m 644 libtraceevent.so "$pkgdir/usr/lib"
|
|
|
|
}
|
|
|
|
|
|
|
|
package_perf() {
|
|
|
|
pkgdesc='Linux kernel performance auditing tool'
|
2018-08-04 22:47:44 +08:00
|
|
|
depends=('perl' 'python2' 'slang' 'elfutils' 'libunwind' 'binutils'
|
2016-03-30 03:28:32 +08:00
|
|
|
'numactl' 'audit')
|
|
|
|
optdepends=('gtk2: support GTK2 browser for perf report')
|
|
|
|
|
2018-08-14 03:00:39 +08:00
|
|
|
cd linux-${pkgver}/tools/perf
|
2016-10-25 04:21:49 +08:00
|
|
|
make -f Makefile.perf \
|
|
|
|
prefix=/usr \
|
|
|
|
lib=lib/perf \
|
|
|
|
perfexecdir=lib/perf \
|
|
|
|
NO_SDT=1 \
|
2016-03-30 03:28:32 +08:00
|
|
|
PYTHON=python2 \
|
|
|
|
PYTHON_CONFIG=python2-config \
|
|
|
|
PERF_VERSION=$pkgver-$pkgrel \
|
2016-10-25 04:21:49 +08:00
|
|
|
DESTDIR="$pkgdir" \
|
2016-03-30 03:28:32 +08:00
|
|
|
install install-man
|
|
|
|
cd "$pkgdir"
|
2018-08-04 22:47:44 +08:00
|
|
|
# add linker search path
|
|
|
|
mkdir "$pkgdir/etc/ld.so.conf.d"
|
|
|
|
echo '/usr/lib/perf' > "$pkgdir/etc/ld.so.conf.d/$pkgname.conf"
|
2016-10-25 04:21:49 +08:00
|
|
|
# move completion in new directory
|
|
|
|
install -Dm644 etc/bash_completion.d/perf usr/share/bash-completion/completions/perf
|
2018-08-04 22:47:44 +08:00
|
|
|
rm -r etc/bash_completion.d
|
2016-10-25 04:21:49 +08:00
|
|
|
# no exec on usr/share
|
|
|
|
find usr/share -type f -exec chmod a-x {} \;
|
2016-03-30 03:28:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
package_cpupower() {
|
|
|
|
pkgdesc='Linux kernel tool to examine and tune power saving related features of your processor'
|
|
|
|
backup=('etc/default/cpupower')
|
|
|
|
depends=('bash' 'pciutils')
|
|
|
|
install=cpupower.install
|
|
|
|
|
2018-08-14 03:00:39 +08:00
|
|
|
pushd linux-${pkgver}/tools/power/cpupower
|
2016-03-30 03:28:32 +08:00
|
|
|
make \
|
|
|
|
DESTDIR="$pkgdir" \
|
|
|
|
sbindir='/usr/bin' \
|
2018-02-12 07:28:51 +08:00
|
|
|
libdir='/usr/lib' \
|
2016-03-30 03:28:32 +08:00
|
|
|
mandir='/usr/share/man' \
|
|
|
|
docdir='/usr/share/doc/cpupower' \
|
|
|
|
install install-man
|
|
|
|
popd
|
|
|
|
# install startup scripts
|
|
|
|
install -Dm 644 $pkgname.default "$pkgdir/etc/default/$pkgname"
|
|
|
|
install -Dm 644 $pkgname.service "$pkgdir/usr/lib/systemd/system/$pkgname.service"
|
|
|
|
install -Dm 755 $pkgname.systemd "$pkgdir/usr/lib/systemd/scripts/$pkgname"
|
|
|
|
}
|
|
|
|
|
|
|
|
package_x86_energy_perf_policy() {
|
|
|
|
pkgdesc='Read or write MSR_IA32_ENERGY_PERF_BIAS'
|
|
|
|
depends=('glibc')
|
|
|
|
|
2018-08-14 03:00:39 +08:00
|
|
|
cd linux-${pkgver}/tools/power/x86/x86_energy_perf_policy
|
2016-03-30 03:28:32 +08:00
|
|
|
install -Dm 755 x86_energy_perf_policy "$pkgdir/usr/bin/x86_energy_perf_policy"
|
|
|
|
install -Dm 644 x86_energy_perf_policy.8 "$pkgdir/usr/share/man/man8/x86_energy_perf_policy.8"
|
|
|
|
}
|
|
|
|
|
|
|
|
package_usbip() {
|
|
|
|
pkgdesc='An USB device sharing system over IP network'
|
2018-08-04 22:47:44 +08:00
|
|
|
depends=('glib2' 'sysfsutils' 'libsystemd')
|
2016-03-30 03:28:32 +08:00
|
|
|
|
2018-08-14 03:00:39 +08:00
|
|
|
pushd linux-${pkgver}/tools/usb/usbip
|
2016-03-30 03:28:32 +08:00
|
|
|
make install DESTDIR="$pkgdir"
|
|
|
|
popd
|
|
|
|
# module loading
|
|
|
|
install -Dm 644 /dev/null "$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
|
|
|
|
printf 'usbip-core\nusbip-host\n' > "$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
|
|
|
|
# systemd
|
|
|
|
install -Dm 644 usbipd.service "$pkgdir/usr/lib/systemd/system/usbipd.service"
|
|
|
|
}
|
|
|
|
|
|
|
|
package_tmon() {
|
|
|
|
pkgdesc='Monitoring and Testing Tool for Linux kernel thermal subsystem'
|
|
|
|
depends=('glibc' 'ncurses')
|
|
|
|
|
2018-08-14 03:00:39 +08:00
|
|
|
cd linux-${pkgver}/tools/thermal/tmon
|
2016-03-30 03:28:32 +08:00
|
|
|
make install INSTALL_ROOT="$pkgdir"
|
|
|
|
}
|
|
|
|
|
|
|
|
package_cgroup_event_listener() {
|
|
|
|
pkgdesc='Simple listener of cgroup events'
|
|
|
|
depends=('glibc')
|
|
|
|
|
2018-08-14 03:00:39 +08:00
|
|
|
cd linux-${pkgver}/tools/cgroup
|
2016-03-30 03:28:32 +08:00
|
|
|
install -Dm755 cgroup_event_listener "$pkgdir/usr/bin/cgroup_event_listener"
|
|
|
|
}
|
|
|
|
|
|
|
|
package_turbostat() {
|
|
|
|
pkgdesc='Report processor frequency and idle statistics'
|
|
|
|
depends=('glibc')
|
|
|
|
|
2018-08-14 03:00:39 +08:00
|
|
|
cd linux-${pkgver}/tools/power/x86/turbostat
|
2016-03-30 03:28:32 +08:00
|
|
|
make install DESTDIR="$pkgdir"
|
|
|
|
}
|
2018-08-04 22:47:44 +08:00
|
|
|
|
|
|
|
package_hyperv() {
|
|
|
|
pkgdesc='Hyper-V tools'
|
|
|
|
depends=('glibc')
|
|
|
|
|
2018-08-14 03:00:39 +08:00
|
|
|
cd linux-${pkgver}/tools/hv
|
2018-08-04 22:47:44 +08:00
|
|
|
for _p in hv_fcopy_daemon hv_kvp_daemon hv_vss_daemon; do
|
|
|
|
install -Dm755 "$_p" "$pkgdir/usr/bin/$_p"
|
|
|
|
done
|
|
|
|
install -dm755 "$pkgdir/usr/lib/hyperv/kvp_scripts"
|
|
|
|
}
|