diff mbox series

[bug#69364] Three patches which collectively enable BTF debug info in BPF kernel

Message ID 87il2dfiyy.fsf@san-diego.mail-host-address-is-not-set
State New
Headers show
Series [bug#69364] Three patches which collectively enable BTF debug info in BPF kernel | expand

Commit Message

Brennan Vincent Feb. 25, 2024, 1:09 a.m. UTC
This configuration causes /sys/kernel/btf/vmlinux to exist, which is
necessary for some eBPF programs (e.g. those that rely on the "BPF
CO-RE" feature; see
https://docs.kernel.org/bpf/libbpf/libbpf_overview.html for details).

The initial two patches introduce userland packages that enable building
the kernel with this configuration, and the third one changes the kernel
config.
diff mbox series

Patch

From d8322b660c45b4f463106c14a4a4cf15820934cf Mon Sep 17 00:00:00 2001
Message-ID: <d8322b660c45b4f463106c14a4a4cf15820934cf.1708822862.git.brennan@umanwizard.com>
In-Reply-To: <f02af354b559d53009a96d00c0f58a72957678d9.1708822862.git.brennan@umanwizard.com>
References: <f02af354b559d53009a96d00c0f58a72957678d9.1708822862.git.brennan@umanwizard.com>
From: Brennan Vincent <brennan@umanwizard.com>
Date: Sat, 24 Feb 2024 10:07:51 -0500
Subject: [PATCH 3/3] gnu: Set CONFIG_DEBUG_INFO_BTF in bpf kernel.

* gnu/packages/linux.scm (linux-libre-with-bpf): Set CONFIG_DEBUG_INFO_BTF.

Change-Id: I9cc0da5394a63ede4a2549cbdcc13b75c8af3001
---
 gnu/packages/linux.scm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 8c665d436d..f894c6cfe3 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -117,6 +117,7 @@  (define-module (gnu packages linux)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cpp)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages datastructures)
   #:use-module (gnu packages dbm)
@@ -891,7 +892,11 @@  (define %bpf-extra-linux-options
     ;; optional, for kprobes
     ("CONFIG_BPF_EVENTS" . #t)
     ;; kheaders module
-    ("CONFIG_IKHEADERS" . #t)))
+    ("CONFIG_IKHEADERS" . #t)
+    ;; BTF debug info, requires `pahole' from `dwarves' package
+    ("CONFIG_DEBUG_INFO=y" . #t)
+    ("CONFIG_DEBUG_INFO_DWARF4" . #t)
+    ("CONFIG_DEBUG_INFO_BTF" . #t)))
 
 (define (config->string options)
   (string-join (map (match-lambda
@@ -1342,7 +1347,8 @@  (define-public linux-libre-with-bpf
     (package
       (inherit base-linux-libre)
       (inputs (modify-inputs (package-inputs base-linux-libre)
-                (prepend cpio)))
+                (prepend cpio
+                         (@ (gnu packages compression) zlib) python dwarves)))
       (synopsis "Linux-libre with BPF support")
       (description "This package provides GNU Linux-Libre with support
 for @acronym{BPF, the Berkeley Packet Filter}."))))
-- 
2.41.0