Skip to main content

cargo_image_runner/bootloader/
grub.rs

1use super::{Bootloader, BootloaderFiles, ConfigFile};
2use crate::config::BootType;
3use crate::core::context::Context;
4use crate::core::error::Result;
5
6/// GRUB bootloader.
7///
8/// This is a basic GRUB support implementation. Full GRUB support will be
9/// implemented in Phase 2.
10pub struct GrubBootloader;
11
12impl GrubBootloader {
13    /// Create a new GRUB bootloader instance.
14    pub fn new() -> Self {
15        Self
16    }
17}
18
19impl Default for GrubBootloader {
20    fn default() -> Self {
21        Self::new()
22    }
23}
24
25impl Bootloader for GrubBootloader {
26    fn prepare(&self, _ctx: &Context) -> Result<BootloaderFiles> {
27        // TODO: Implement GRUB preparation in Phase 2
28        // This will involve:
29        // - Finding GRUB binaries
30        // - Creating GRUB image for BIOS
31        // - Preparing GRUB EFI for UEFI
32        Ok(BootloaderFiles::new())
33    }
34
35    fn config_files(&self, _ctx: &Context) -> Result<Vec<ConfigFile>> {
36        // TODO: Implement GRUB config in Phase 2
37        // This will process grub.cfg with template variables
38        Ok(Vec::new())
39    }
40
41    fn boot_type(&self) -> BootType {
42        // GRUB supports hybrid boot
43        BootType::Hybrid
44    }
45
46    fn name(&self) -> &str {
47        "GRUB"
48    }
49}