Install packages:
flex bison libslang2-dev
Maybe:
libelf-dev libdw-dev libunwind-dev binutils-dev libiberty-dev
Download rpi-source for help with finding out what commit the current kernel has been built from.
https://github.com/notro/rpi-source/blob/master/rpi-source
./rpi-source -s -v --skip-gcc --skip-update *** Using: /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz Latest changes: raspberrypi-firmware (1.20151118-1) jessie; urgency=medium *** Latest firmware revision: 2a329e0c7d8ea19c085bac5633aa4fccee0f21be Latest change made by Serge Schneider <serge@raspberrypi.org> Wed, 18 Nov 2015 15:59:24 +0000 download: https://raw.githubusercontent.com/raspberrypi/firmware/2a329e0c7d8ea19c085bac5633aa4fccee0f21be/extra/git_hash *** Linux source commit: bc1669c846b629cface0aaa367afb2b9c6226faf *** Download kernel source wget -O /home/sunkan/linux-bc1669c846b629cface0aaa367afb2b9c6226faf.tar.gz https://github.com/raspberrypi/linux/archive/bc1669c846b629cface0aaa367afb2b9c6226faf.tar.gz
Then download and unpack the kernel
Load module for /proc/config.gz - modprobe configs
Then in kernel src
cat /proc/config.gz > .config make oldconfig cd tools/perf make #make DESTDIR=/tmp/inst install
perf record -e cpu-clock