-
Stripping perf out from kernel source
You may have heard about perf, a tool made by Linux kernel developers to help debugging, benchmarking and profiling.
The problem is you have to download the whole kernel source in order to compile perf. If you are not used to follow kernel developping, most likely you will not have its source. But it’s still possible to compile perf.
As I’m helping to maintain perf package in Archlinux, I made the following script to strip perf from a given kernel version:
#!/bin/bash function usage() { cat - <<EOF USAGE: make-perf-util.sh git-tag-version EOF } function die() { echo -e "ERROR\n\tSee usage\n" usage exit 1 } VERSION=$1 BASENAME=perf-util NAME=$BASENAME-$VERSION PKGNAME=$NAME.tar.bz2 if [ $# -ne 1 ]; then die fi git checkout $VERSION || die [ -a $NAME ] && rm -rf $NAME cd tools/perf && make clean cd - rsync -Ra tools lib include/linux arch/x86/include/asm include/asm-generic \ --link-dest=. $NAME tar -cjf $PKGNAME $NAME rm -rf $NAME echo "created $PKGNAME"
This script works fine with latest 2.6.33 kernel. Regularly I’m uploading to this site the stripped version of perf. The latest one, you find here.

