10

There are some tools in side the kernel,

<kernel source root directory>/tools

perf is one of them.

In ubuntu I think the tools inside this folder is available as package linux-tools

How can I compile it form source and install it and run it?

limovala
  • 734
  • 3
  • 9
  • 22

3 Answers3

11

what's wrong with the following?

make -C <kernel source root directory>/tools/perf
umläute
  • 6,300
  • 1
  • 24
  • 48
  • 2
    `make 0=/path/to/build/dir -C /tools/perf` – limovala Oct 01 '13 at 04:48
  • That builds the tools and allows me to use those but how to build a similar package as official `linux-tools` deb? – Mikko Rantalainen Sep 11 '18 at 06:53
  • @MikkoRantalainen the build-instructions for all official deb packages are [available online](https://sources.debian.org/src/linux-tools/3.16.56-1/debian/) – umläute Sep 11 '18 at 11:10
  • 3
    @umläute I mean, is it possible to build `linux-tools` deb package from vanilla kernel sources without applying extra patches or copying `debian` directories around similar to using distribution supported `make-kpkg` command to build vanilla kernel sources? – Mikko Rantalainen Sep 13 '18 at 07:52
  • @MikkoRantalainen, I think it is possible. Check my answer [here](https://unix.stackexchange.com/a/741358/202924). – cojocar Mar 29 '23 at 19:20
  • @cojocar Your solution doesn't match the requirement "without applying extra patches" but I guess it's better than nothing. – Mikko Rantalainen Mar 30 '23 at 08:38
5

Nowdays: make -C tools/ perf_install prefix=/usr/

SPYFF
  • 51
  • 1
  • 1
1

I wanted to compile for a different architecture and this seems to work. I had hosttools from buildroot in the output/host/bin directory. Most people will have it there if using buildroot. I had to specify the LD and CC flag. So substitute with appropriate path and is the prefix for toolchain name.

make CC=<buildroot-dir>/output/host/bin/<arch>-gcc LD=<buildroot-dir>/output/host/bin/<arch>-ld -C tools/gpio/