From: Francis Laniel <flaniel@linux.microsoft.com>
To: buildroot@buildroot.org
Cc: Francis Laniel <flaniel@linux.microsoft.com>,
Samuel Martin <s.martin49@gmail.com>
Subject: [Buildroot] [RFC PATCH v1 0/2] Enable BTF headers for Linux kernel
Date: Tue, 21 Dec 2021 15:54:27 +0100 [thread overview]
Message-ID: <20211221145428.43829-1-flaniel@linux.microsoft.com> (raw)
Hi.
First of all, I hope you are fine and the same for your relatives.
Extended Berkeley Packet Filter (eBPF) is a virtual machine inside the kernel
which permits executing safe code [1].
This code can, for example, be used to hook kernel events.
BPF Compile Once - Run Everywhere (BPF CO-RE) is thought as an evolution of
conventional BPF program [2].
BPF CO-RE relies on BPF Type Format (BTF) to be executed on different kernels.
This is done thanks to libbpf, the BPF loader, which resolves symbols contained
into the BPF binary against symbols offered by the kernel.
Kernel shares its BTF symbols through /sys/kernel/btf/vmlinux which is enabled
by CONFIG_DEBUG_INFO_BTF.
Nonetheless, CONFIG_DEBUG_INFO_BTF relies on pahole to convert DWARF symbols to
BTF [3].
Thus, this series enable BTF headers for Linux kernel by:
1. First, adding pahole as host package by compiling it from source taken from
its git repository.
2. Second, adding pahole as kernel dependencies if user selected
BR2_PACKAGE_HOST_PAHOLE.
I understand Buildroot and BPF can seem to be far from each other at first
glance.
But Buildroot, while mainly used to generate embedded Linux systems, is also
used to generate "qemu ready" image [4].
More particularly, minikube, a tool used to deploy Kubernetes locally, relies on
buildroot to generate its system image [5, 6].
I use minikube daily to test a tool we develop for Kubernetes and I wrote a
patch to enable CONFIG_DEBUG_INFO_BTF [7, 8].
Thus, I thought it could be a good idea to share this patch upstream as this
feature would be welcomed by the community [9].
Regarding the series itself, I tested it by compiling a system for
qemu_x86_defconfig and setting:
* BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF
* BR2_PACKAGE_HOST_PAHOLE
Then, I booted the system using qemu to check if /sys/kernel/btf/vmlinux exists,
which is the case:
# [ -f /sys/kernel/btf/vmlinux ] && echo yes
yes
If you have any remarks regarding this series, feel free to share as I would be
happy to handle them to increase this contribution quality.
Francis Laniel (2):
package/pahole: new host package
linux: Add host-pahole as linux dependencies if selected by user.
DEVELOPERS | 3 +++
linux/linux.mk | 6 ++++++
package/Config.in.host | 1 +
package/pahole/Config.in.host | 8 ++++++++
package/pahole/pahole.hash | 2 ++
package/pahole/pahole.mk | 20 ++++++++++++++++++++
6 files changed, 40 insertions(+)
create mode 100644 package/pahole/Config.in.host
create mode 100644 package/pahole/pahole.hash
create mode 100644 package/pahole/pahole.mk
Best regards and thank you in advance for your reviews.
---
[1] https://man7.org/linux/man-pages/man2/bpf.2.html
[2] https://nakryiko.com/posts/bpf-portability-and-co-re/
[3] https://elixir.bootlin.com/linux/v5.15.10/source/lib/Kconfig.debug#L315
[4] https://petermalmgren.com/qemu-buildroot/
[5] https://github.com/kubernetes/minikube
[6] https://github.com/kubernetes/minikube/blob/7dc8836303721c4486c007945beb5272cf28601c/deploy/iso/minikube-iso/configs/minikube_defconfig
[7] https://github.com/kinvolk/inspektor-gadget
[8] https://github.com/kinvolk/minikube/commit/44327414939f8acc08e095e789bc41f7dc73099e
[9] https://github.com/kubernetes/minikube/pull/12707#issuecomment-986990849
--
2.30.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next reply other threads:[~2021-12-21 15:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-21 14:54 Francis Laniel [this message]
2021-12-21 14:54 ` [Buildroot] [RFC PATCH v1 1/2] package/pahole: new host package Francis Laniel
2021-12-21 21:44 ` Arnout Vandecappelle
2021-12-22 17:32 ` Francis Laniel
2021-12-21 14:54 ` [Buildroot] [RFC PATCH v1 2/2] linux: Add host-pahole as linux dependencies if selected by user Francis Laniel
2021-12-21 21:58 ` Arnout Vandecappelle
2021-12-22 17:33 ` Francis Laniel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211221145428.43829-1-flaniel@linux.microsoft.com \
--to=flaniel@linux.microsoft.com \
--cc=buildroot@buildroot.org \
--cc=s.martin49@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox