Search code examples
linuxlinux-kernelkernelperfdebug-information

how to install debuginfo packages from vmlinux


I am building my own kernel with following options set.

CONFIG_FRAME_POINTER=y
CONFIG_DEBUG_INFO=y

So I assume that the generated vmlinux file will have all the required debuginfo.

I installed that kernel in a machine and put the vmlinux file under /boot/. However, when I tried to do a perf annotate it does not show the source code along side the assembly code. It only shows the assembly code and c function names not the entire source code(I have tried toggling "s" during annotate).

Here are my perf commands.

#perf record -g -a -e cycles:k sleep 5
#perf report -f -g -s symbol
#perf annotate -f -s <kernel function name> > annotate_<kernel_function>.txt

What am I missing here ? Do I need to install debuginfo packages separately ?

Regards, Atish


Solution

  • The binrpm-pkg target to build kernel rpm does not generate debuginfo because it disabled generation of debuginfo packages, you can try do this, open scripts/package/mkspec in your kernel source tree, and search for a line echo "%define debug_package %{nil}", comment or remove this line, and try to build again.

    The reason is that this line explicitly tell rpmbuild that skip debuginfo packages.

    See the link:

    https://github.com/torvalds/linux/blob/9256d5a308c95a50c6e85d682492ae1f86a70f9b/scripts/package/mkspec#L45