From a12a49192fe5dd4a12a1ab5d2c19bf7b34cd7365 Mon Sep 17 00:00:00 2001 From: geens Date: Mon, 7 Jul 2025 21:15:45 +0200 Subject: [PATCH] Edd debug tweaks for terminal access --- image/conf/local.conf | 3 +++ xtask/src/collect.rs | 61 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/image/conf/local.conf b/image/conf/local.conf index 70a8bf5..a14bc3c 100644 --- a/image/conf/local.conf +++ b/image/conf/local.conf @@ -33,3 +33,6 @@ VIRTUAL-RUNTIME_initscripts = "" # Add GUI packages to image CORE_IMAGE_EXTRA_INSTALL += "gui-app weston liberation-fonts" + +# Needed to enable terminal on tty2 +EXTRA_IMAGE_FEATURES += "debug-tweaks" \ No newline at end of file diff --git a/xtask/src/collect.rs b/xtask/src/collect.rs index cd48bb4..d00fff1 100644 --- a/xtask/src/collect.rs +++ b/xtask/src/collect.rs @@ -6,6 +6,7 @@ pub async fn collect() { collect_dir_output("osc", "../collect_osc.txt").await; collect_dir_output("simulator", "../collect_simulator.txt").await; collect_dir_output("xtask", "../collect_xtask.txt").await; + collect_image_output("./collect_image.txt").await; } pub async fn collect_dir_output(dir: &str, output: &str) { @@ -22,3 +23,63 @@ pub async fn collect_dir_output(dir: &str, output: &str) { .await .expect("Failed to collect audio_engine sources"); } + +pub async fn collect_image_output(output: &str) { + use std::fs; + + let mut content = String::new(); + content.push_str("File Contents:\n"); + + // Collect specific files mentioned by user + let files_to_collect = vec![ + "image/conf/bblayers.conf", + "image/conf/local.conf", + "image/conf/templateconf.cfg", + "image/docker-compose.yml", + "image/Dockerfile", + "image/implementation_plan.md", + "image/run", + ]; + + for file_path in files_to_collect { + if let Ok(file_content) = fs::read_to_string(file_path) { + content.push_str(&format!("\n===== FILE: {} =====\n", file_path)); + content.push_str(&file_content); + } + } + + // Collect meta-fcb-looper files + if fs::read_dir("image/meta-layers/meta-fcb-looper").is_ok() { + collect_directory_recursive("image/meta-layers/meta-fcb-looper", &mut content); + } + + // Write to output file + if let Err(e) = fs::write(output, content) { + eprintln!("Failed to write output file: {}", e); + } else { + println!("Successfully collected image files to {}", output); + } +} + +fn collect_directory_recursive(dir_path: &str, content: &mut String) { + use std::fs; + + if let Ok(entries) = fs::read_dir(dir_path) { + for entry in entries.flatten() { + let path = entry.path(); + if path.is_file() { + let file_path = path.to_string_lossy(); + if file_path.ends_with(".bb") || file_path.ends_with(".bbappend") || + file_path.ends_with(".conf") || file_path.ends_with(".wks") || + file_path.ends_with(".service") { + if let Ok(file_content) = fs::read_to_string(&path) { + content.push_str(&format!("\n===== FILE: {} =====\n", file_path)); + content.push_str(&file_content); + } + } + } else if path.is_dir() { + collect_directory_recursive(&path.to_string_lossy(), content); + } + } + } +}