Skip to content

Commit f75689c

Browse files
install/composefs: Handle kargs for BLS
Also exit early if kargs are passed for `--boot=uki` Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent d15c988 commit f75689c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

crates/lib/src/install.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub(crate) struct InstallConfigOpts {
201201
///
202202
/// Example: --karg=nosmt --karg=console=ttyS0,114800n8
203203
#[clap(long)]
204-
karg: Option<Vec<String>>,
204+
pub(crate) karg: Option<Vec<String>>,
205205

206206
/// The path to an `authorized_keys` that will be injected into the `root` account.
207207
///
@@ -568,6 +568,11 @@ impl InstallToDiskOpts {
568568
}
569569
}
570570

571+
// Can't add kargs to UKI
572+
if self.composefs_opts.boot == BootType::Uki && self.config_opts.karg.is_some() {
573+
anyhow::bail!("Cannot pass kargs to UKI");
574+
}
575+
571576
Ok(())
572577
}
573578
}
@@ -1509,17 +1514,17 @@ fn setup_composefs_bls_boot(
15091514
None => anyhow::bail!("Expected rootfs to have a UUID by now"),
15101515
};
15111516

1512-
let cmdline_refs = [
1513-
"console=ttyS0,115200",
1514-
&format!("root=UUID={rootfs_uuid}"),
1515-
"rw",
1516-
];
1517+
let root_uuid_karg = format!("root=UUID={rootfs_uuid}");
1518+
1519+
let mut cmdline_refs = vec!["console=ttyS0,115200", &root_uuid_karg, "rw"];
1520+
1521+
cmdline_refs.extend(root_setup.kargs.iter().map(String::as_str));
15171522

15181523
composefs_write_boot_simple(
15191524
&repo,
15201525
entry,
15211526
&id,
1522-
root_setup.physical_root_path.as_std_path(), // /run/mounts/bootc/boot
1527+
root_setup.physical_root_path.as_std_path(),
15231528
Some("boot"),
15241529
Some(&format!("{}", id.to_hex())),
15251530
&cmdline_refs,
@@ -1555,8 +1560,6 @@ fn setup_composefs_uki_boot(
15551560
)?;
15561561

15571562
// Add the user grug cfg
1558-
// TODO: We don't need this for BLS. Have a flag for BLS vs UKI, or maybe we can figure it out
1559-
// via the boot entries above
15601563
let grub_user_config = format!(
15611564
r#"
15621565
menuentry "Fedora Bootc UKI" {{

0 commit comments

Comments
 (0)