[ACT][PATCH] UBUNTU: SAUCE: ubuntu_bpf: properly compile BPF tests with kernels >= 5.15

Andrea Righi andrea.righi at canonical.com
Tue Oct 26 15:32:24 UTC 2021


BugLink: https://bugs.launchpad.net/bugs/1948831

ubuntu_bpf fails to build with the following error:

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

Make sure to copy a valid .config and run `make modules_prepare` to
setup the kernel source directory so that the BPF tests can be built
correctly.

Signed-off-by: Andrea Righi <andrea.righi at canonical.com>
---
 ubuntu_bpf/ubuntu_bpf.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ubuntu_bpf/ubuntu_bpf.py b/ubuntu_bpf/ubuntu_bpf.py
index e4543a94..cbe2a7a1 100644
--- a/ubuntu_bpf/ubuntu_bpf.py
+++ b/ubuntu_bpf/ubuntu_bpf.py
@@ -88,6 +88,11 @@ class ubuntu_bpf(test.test):
                 os.environ["LLVM_OBJCOPY"] = "llvm-objcopy-9"
                 os.environ["LLVM_READELF"] = "llvm-readelf-9"
 
+        if self.kv.startswith('5.15.0'):
+            from shutil import copyfile
+            copyfile('/boot/config-' + self.kv, 'linux/.config')
+            utils.make('-C linux modules_prepare')
+
         utils.make('-C linux/tools/testing/selftests TARGETS=bpf SKIP_TARGETS= clean all')
 
     def run_once(self, test_name):
-- 
2.32.0




More information about the kernel-team mailing list