I am running LTS 6.6.35 linux kernel on qemu-aarch64, with buildroot as rootfs. The toolchain used is arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-linux-gnu
.
Firstly, I did not understand why this toolchain comes with 4.20.x headers. I chose 6.6.x headers under Toolchain > External toolchain kernel headers series, but buildroot found headers to be 4.20.x. Why toolchai, despite being latest, is getting shipped with such old headers?
In buildroot rootfs, I want linux kernel headers corresponding to my kernel 6.6.35 because when I run certain programs (e.g. bpftrace or bcc tools), they complaint about missing headers.
# ./bitehist.py
In file included from <built-in>:2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from include/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:5:
include/linux/compiler_types.h:167:10: fatal error: 'asm/compiler.h' file not found
#include <asm/compiler.h>
^~~~~~~~~~~~~~~~
1 error generated.
Traceback (most recent call last):
File "//./bitehist.py", line 21, in <module>
b = BPF(text="""
^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/bcc/__init__.py", line 479, in __init__
Exception: Failed to compile BPF module <text>
and this is how bpftrace is complaining.
# bpftrace -e 'tracepoint:raw_syscalls:sys_enter { @[comm] = count(); }'
fatal error: '/lib/modules/6.6.35-ga78e9d5d3e33-dirty/build/include/linux/kconfig.h' file not found
#
I was able to do install some headers using make headers_install
but it seems it still doesn’t copy all the required headers. Installing via a package manager is not an option. What should I do? What is the right approach?