diff mbox series

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

Message ID 20211026153224.56258-1-andrea.righi@canonical.com
State New
Headers show
Series [ACT] UBUNTU: SAUCE: ubuntu_bpf: properly compile BPF tests with kernels >= 5.15 | expand

Commit Message

Andrea Righi Oct. 26, 2021, 3:32 p.m. UTC
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@canonical.com>
---
 ubuntu_bpf/ubuntu_bpf.py | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

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):