1use std::cell::RefCell;
2
3pub struct LinuxBootLoader {
9 pub(crate) kernel_path: String,
10 pub(crate) initrd_path: RefCell<Option<String>>,
11 pub(crate) command_line: RefCell<Option<String>>,
12}
13
14impl LinuxBootLoader {
15 pub fn new(kernel_path: &str, initrd_path: &str, command_line: &str) -> Self {
16 let bl = Self::new_with_kernel(kernel_path);
17 bl.set_initrd(initrd_path);
18 bl.set_command_line(command_line);
19 bl
20 }
21
22 pub fn new_with_kernel(kernel_path: &str) -> Self {
23 LinuxBootLoader {
24 kernel_path: kernel_path.to_string(),
25 initrd_path: RefCell::new(None),
26 command_line: RefCell::new(None),
27 }
28 }
29
30 pub fn set_initrd(&self, initrd_path: &str) {
31 *self.initrd_path.borrow_mut() = Some(initrd_path.to_string());
32 }
33
34 pub fn set_command_line(&self, command_line: &str) {
37 *self.command_line.borrow_mut() = Some(command_line.to_string());
38 }
39}