Skip to content

Commit 26352a5

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 562c1ce commit 26352a5

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

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
}
@@ -1516,17 +1521,17 @@ fn setup_composefs_bls_boot(
15161521
None => anyhow::bail!("Expected rootfs to have a UUID by now"),
15171522
};
15181523

1519-
let cmdline_refs = [
1520-
"console=ttyS0,115200",
1521-
&format!("root=UUID={rootfs_uuid}"),
1522-
"rw",
1523-
];
1524+
let root_uuid_karg = format!("root=UUID={rootfs_uuid}");
1525+
1526+
let mut cmdline_refs = vec!["console=ttyS0,115200", &root_uuid_karg, "rw"];
1527+
1528+
cmdline_refs.extend(root_setup.kargs.iter().map(String::as_str));
15241529

15251530
composefs_write_boot_simple(
15261531
&repo,
15271532
entry,
15281533
&id,
1529-
root_setup.physical_root_path.as_std_path(), // /run/mounts/bootc/boot
1534+
root_setup.physical_root_path.as_std_path(),
15301535
Some("boot"),
15311536
Some(&format!("{}", id.to_hex())),
15321537
&cmdline_refs,
@@ -1562,8 +1567,6 @@ fn setup_composefs_uki_boot(
15621567
)?;
15631568

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

0 commit comments

Comments
 (0)