Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
davibe committed Sep 14, 2024
1 parent 59ae192 commit 1d6718b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions aya/src/bpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,21 @@ fn compute_kconfig_definition(features: &Features) -> HashMap<String, Vec<u8>> {

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;
}
}
}
Expand Down

0 comments on commit 1d6718b

Please sign in to comment.