Skip to content

Commit 526b230

Browse files
committed
cfs: Hard error on external kargs with UKIs
I thought about this with the cloud-init disablement for now with bcvk. It already works to just not enable `cloud-init.target` which we were already doing. Signed-off-by: Colin Walters <[email protected]>
1 parent 7daf9d3 commit 526b230

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

crates/lib/src/bootc_composefs/boot.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -856,11 +856,7 @@ pub(crate) fn setup_composefs_uki_boot(
856856
) -> Result<()> {
857857
let (root_path, esp_device, bootloader, is_insecure_from_opts, uki_addons) = match setup_type {
858858
BootSetupType::Setup((root_setup, state, ..)) => {
859-
if let Some(v) = &state.config_opts.karg {
860-
if v.len() > 0 {
861-
tracing::warn!("kargs passed for UKI will be ignored");
862-
}
863-
}
859+
state.require_no_kargs_for_uki()?;
864860

865861
let esp_part = esp_in(&root_setup.device_info)?;
866862

crates/lib/src/install.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,20 @@ impl State {
523523
Ok(())
524524
}
525525

526+
/// Return an error if kernel arguments are provided, intended to be used for UKI paths
527+
pub(crate) fn require_no_kargs_for_uki(&self) -> Result<()> {
528+
if self
529+
.config_opts
530+
.karg
531+
.as_ref()
532+
.map(|v| !v.is_empty())
533+
.unwrap_or_default()
534+
{
535+
anyhow::bail!("Cannot use externally specified kernel arguments with UKI");
536+
}
537+
Ok(())
538+
}
539+
526540
fn stateroot(&self) -> &str {
527541
self.config_opts
528542
.stateroot

crates/xtask/src/xtask.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,6 @@ fn check_dependencies(sh: &Shell) -> Result<()> {
531531
}
532532

533533
const COMMON_INST_ARGS: &[&str] = &[
534-
// We don't use cloud-init with bcvk right now, but it needs to be there for
535-
// testing-farm+tmt
536-
"--karg=ds=iid-datasource-none",
537534
// TODO: Pass down the Secure Boot keys for tests if present
538535
"--firmware=uefi-insecure",
539536
"--label=bootc.test=1",

0 commit comments

Comments
 (0)