Skip to content

Commit

Permalink
Add --mbr-file option handling to VM builder
Browse files Browse the repository at this point in the history
  • Loading branch information
aleasims committed Jan 15, 2025
1 parent ffdd52f commit 4a4a495
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/builders_v2/linux_vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ pub struct BuildOpts {
/// Create image from scratch (don't use base VM image).
pub from_scratch: bool,

/// MBR bootcode file.
pub mbr_file: Option<PathBuf>,

/// Mount root filesystem as read-write.
pub rw_root: bool,

Expand Down
7 changes: 3 additions & 4 deletions src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ pub struct BuildArgs {

/// Path to MBR file.
///
/// If none provided, following paths will be tried:
/// - /usr/share/syslinux/mbr.bin
/// - /usr/lib/syslinux/mbr/mbr.bin
/// - /usr/lib/syslinux/bios/mbr.bin
/// If none provided, a number of default locations will be tried.
#[arg(long, value_name = "FILE", value_hint = ValueHint::FilePath, verbatim_doc_comment)]
pub mbr_file: Option<PathBuf>,

Expand Down Expand Up @@ -361,6 +358,7 @@ impl TryFrom<&BuildArgs> for linux_vm::LinuxVMBuildContext {

let gen_base_img = opts.generate_base_image;
let from_scratch = opts.from_scratch;
let mbr_file = opts.mbr_file.clone();
let rw_root = opts.rw_root;

let opts = linux_vm::BuildOpts {
Expand All @@ -371,6 +369,7 @@ impl TryFrom<&BuildArgs> for linux_vm::LinuxVMBuildContext {
init_system_opts,
fs_source,
from_scratch,
mbr_file,
rw_root,
gen_base_img,
};
Expand Down

0 comments on commit 4a4a495

Please sign in to comment.