On Sun, Feb 28, 2021 at 12:37 PM <bg.salunk...@gmail.com> wrote: > > [Edited Message Follows] > > Hi, > > I'm looking into BTF and it's use case. Based on the document I understood to > run BPF programs across different kernel versions, it needs to build with > libbpf which depends on the BTF information. > Now to enable/to have BTF information on any Kernel, the kernel needs to be > re-build with "" flag. > > I can see the BTF support in Linux introduced from kernel version 5.1.0 > (https://www.kernel.org/doc/html/v5.1/bpf/btf.html?highlight=btf) > however I can still see the BTF information(/sys/kernel/btf/vmlinux) on my > 4.18.0-193.28.1.el8_2.x86_64 kernel. > > I'm little confused here how old kernel can generate BTF info if the was > support added recently. > > Can I get information about oldest linux kernel version that can support BTF?
/sys/kernel/btf/vmlinux appeared in 5.4 kernel (upstream version). If you see it on 4.18, that means someone backported the changes. But for BPF CO-RE (which I assume is what you are referring to) to work, kernel itself doesn't need to "support BTF", it just needs to have .BTF data built-in inside its vmlinux binary image, and that image needs to be in one of the supported locations (see [0]). Starting from 5.2 kernel CONFIG_DEBUG_INTO_BTF=y is supported with adds .BTF section as part of the kernel build process. But one could technically add .BTF by using pahole tool (part of dwarves package) even before that, as long as vmlinux image contains DWARF information. So in short, the easiest way is to get the latest kernel you can. But with enough persistence and effort you can get kernel BTF embedded for pretty much any kernel version. [0] https://github.com/libbpf/libbpf/blob/master/src/btf.c#L4589-L4598 > > > -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#1966): https://lists.iovisor.org/g/iovisor-dev/message/1966 Mute This Topic: https://lists.iovisor.org/mt/80980657/21656 Mute #bcc:https://lists.iovisor.org/g/iovisor-dev/mutehashtag/bcc Group Owner: iovisor-dev+ow...@lists.iovisor.org Unsubscribe: https://lists.iovisor.org/g/iovisor-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-