From 1d6718bae39f004cf55f1570f809297938732b67 Mon Sep 17 00:00:00 2001 From: Davide Bertola Date: Sat, 14 Sep 2024 21:50:29 +0200 Subject: [PATCH] .. --- aya/src/bpf.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index bb979a397..0039a4fcb 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -175,14 +175,21 @@ fn compute_kconfig_definition(features: &Features) -> HashMap> { if raw_config_opt.is_none() { if let Ok(release) = sys::kernel_release() { - let config_path = PathBuf::from("/boot").join(format!("config-{}", release)); - - if config_path.exists() { + let candidates = &[ + PathBuf::from("/boot").join(format!("config-{}", release)), + PathBuf::from("/lib/modules/").join(format!("{}/build/.config", release)), + ]; + + for config_path in candidates.iter() { + if !config_path.exists() { + continue; + } if let Ok(mut file) = File::open(config_path) { let mut output = String::new(); if file.read_to_string(&mut output).is_ok() { raw_config_opt = Some(output); } + break; } } }