Skip to content

Commit 800568a

Browse files
bls-config: Rename 'efi' key to 'uki'
Key 'uki' is more appropriate for us as the PE Binary that the key points to is a UKI Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent 535f1e7 commit 800568a

File tree

5 files changed

+43
-43
lines changed

5 files changed

+43
-43
lines changed

crates/lib/src/bootc_composefs/boot.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ pub(crate) fn setup_composefs_bls_boot(
526526
.with_title(title)
527527
.with_sort_key(default_sort_key.into())
528528
.with_version(version)
529-
.with_cfg(BLSConfigType::NonEFI {
529+
.with_cfg(BLSConfigType::NonUKI {
530530
linux: entry_paths.abs_entries_path.join(&id_hex).join(VMLINUZ),
531531
initrd: vec![entry_paths.abs_entries_path.join(&id_hex).join(INITRD)],
532532
options: Some(cmdline_refs),
@@ -564,7 +564,7 @@ pub(crate) fn setup_composefs_bls_boot(
564564
})?;
565565

566566
match bls_config.cfg_type {
567-
BLSConfigType::NonEFI {
567+
BLSConfigType::NonUKI {
568568
ref mut linux,
569569
ref mut initrd,
570570
..
@@ -857,8 +857,8 @@ fn write_systemd_uki_config(
857857
let mut bls_conf = BLSConfig::default();
858858
bls_conf
859859
.with_title(boot_label.boot_label)
860-
.with_cfg(BLSConfigType::EFI {
861-
efi: format!("/{SYSTEMD_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
860+
.with_cfg(BLSConfigType::UKI {
861+
uki: format!("/{SYSTEMD_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
862862
})
863863
.with_sort_key(default_sort_key.into())
864864
.with_version(boot_label.version.unwrap_or(default_sort_key.into()));

crates/lib/src/bootc_composefs/delete.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ fn delete_type1_entry(depl: &DeploymentEntry, boot_dir: &Dir, deleting_staged: b
6262
let bls_config = parse_bls_config(&cfg)?;
6363

6464
match &bls_config.cfg_type {
65-
BLSConfigType::EFI { efi } => {
66-
if !efi.as_str().contains(&depl.deployment.verity) {
65+
BLSConfigType::UKI { uki } => {
66+
if !uki.as_str().contains(&depl.deployment.verity) {
6767
continue;
6868
}
6969

7070
// Boot dir in case of EFI will be the ESP
71-
tracing::debug!("Deleting EFI .conf file: {}", file_name);
71+
tracing::debug!("Deleting UKI .conf file: {}", file_name);
7272
entry.remove_file().context("Removing .conf file")?;
7373
delete_uki(&depl.deployment.verity, boot_dir)?;
7474

7575
break;
7676
}
7777

78-
BLSConfigType::NonEFI { options, .. } => {
78+
BLSConfigType::NonUKI { options, .. } => {
7979
let options = options
8080
.as_ref()
8181
.ok_or(anyhow::anyhow!("options not found in BLS config file"))?;
@@ -84,7 +84,7 @@ fn delete_type1_entry(depl: &DeploymentEntry, boot_dir: &Dir, deleting_staged: b
8484
continue;
8585
}
8686

87-
tracing::debug!("Deleting non-EFI .conf file: {}", file_name);
87+
tracing::debug!("Deleting non-UKI .conf file: {}", file_name);
8888
entry.remove_file().context("Removing .conf file")?;
8989

9090
if should_del_kernel {
@@ -113,8 +113,8 @@ fn delete_type1_entry(depl: &DeploymentEntry, boot_dir: &Dir, deleting_staged: b
113113

114114
#[fn_error_context::context("Deleting kernel and initrd")]
115115
fn delete_kernel_initrd(bls_config: &BLSConfigType, boot_dir: &Dir) -> Result<()> {
116-
let BLSConfigType::NonEFI { linux, initrd, .. } = bls_config else {
117-
anyhow::bail!("Found EFI config")
116+
let BLSConfigType::NonUKI { linux, initrd, .. } = bls_config else {
117+
anyhow::bail!("Found UKI config")
118118
};
119119

120120
// "linux" and "initrd" are relative to the boot_dir in our config files

crates/lib/src/bootc_composefs/state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ pub(crate) fn get_booted_bls(boot_dir: &Dir) -> Result<BLSConfig> {
4444

4545
for entry in sorted_entries {
4646
match &entry.cfg_type {
47-
BLSConfigType::EFI { efi } => {
47+
BLSConfigType::UKI { uki } => {
4848
let composefs_param_value = booted.value().ok_or_else(|| {
4949
anyhow::anyhow!("Failed to get composefs kernel cmdline value")
5050
})?;
5151

52-
if efi.as_str().contains(composefs_param_value) {
52+
if uki.as_str().contains(composefs_param_value) {
5353
return Ok(entry);
5454
}
5555
}
5656

57-
BLSConfigType::NonEFI { options, .. } => {
57+
BLSConfigType::NonUKI { options, .. } => {
5858
let Some(opts) = options else {
5959
anyhow::bail!("options not found in bls config")
6060
};

crates/lib/src/bootc_composefs/status.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,13 @@ pub(crate) async fn composefs_deployment_status_from(
361361
.ok_or(anyhow::anyhow!("First boot entry not found"))?;
362362

363363
match &bls_config.cfg_type {
364-
BLSConfigType::NonEFI { options, .. } => !options
364+
BLSConfigType::NonUKI { options, .. } => !options
365365
.as_ref()
366366
.ok_or(anyhow::anyhow!("options key not found in bls config"))?
367367
.contains(composefs_digest.as_ref()),
368368

369-
BLSConfigType::EFI { .. } => {
370-
anyhow::bail!("Found 'efi' field in Type1 boot entry")
369+
BLSConfigType::UKI { .. } => {
370+
anyhow::bail!("Found 'uki' field in Type1 boot entry")
371371
}
372372
BLSConfigType::Unknown => anyhow::bail!("Unknown BLS Config Type"),
373373
}
@@ -394,10 +394,10 @@ pub(crate) async fn composefs_deployment_status_from(
394394

395395
match &bls_config.cfg_type {
396396
// For UKI boot
397-
BLSConfigType::EFI { efi } => efi.as_str().contains(composefs_digest.as_ref()),
397+
BLSConfigType::UKI { uki } => uki.as_str().contains(composefs_digest.as_ref()),
398398

399399
// For boot entry Type1
400-
BLSConfigType::NonEFI { options, .. } => !options
400+
BLSConfigType::NonUKI { options, .. } => !options
401401
.as_ref()
402402
.ok_or(anyhow::anyhow!("options key not found in bls config"))?
403403
.contains(composefs_digest.as_ref()),
@@ -470,7 +470,7 @@ mod tests {
470470
let mut config1 = BLSConfig::default();
471471
config1.title = Some("Fedora 42.20250623.3.1 (CoreOS)".into());
472472
config1.sort_key = Some("1".into());
473-
config1.cfg_type = BLSConfigType::NonEFI {
473+
config1.cfg_type = BLSConfigType::NonUKI {
474474
linux: "/boot/7e11ac46e3e022053e7226a20104ac656bf72d1a84e3a398b7cce70e9df188b6/vmlinuz-5.14.10".into(),
475475
initrd: vec!["/boot/7e11ac46e3e022053e7226a20104ac656bf72d1a84e3a398b7cce70e9df188b6/initramfs-5.14.10.img".into()],
476476
options: Some("root=UUID=abc123 rw composefs=7e11ac46e3e022053e7226a20104ac656bf72d1a84e3a398b7cce70e9df188b6".into()),
@@ -479,7 +479,7 @@ mod tests {
479479
let mut config2 = BLSConfig::default();
480480
config2.title = Some("Fedora 41.20250214.2.0 (CoreOS)".into());
481481
config2.sort_key = Some("2".into());
482-
config2.cfg_type = BLSConfigType::NonEFI {
482+
config2.cfg_type = BLSConfigType::NonUKI {
483483
linux: "/boot/febdf62805de2ae7b6b597f2a9775d9c8a753ba1e5f09298fc8fbe0b0d13bf01/vmlinuz-5.14.10".into(),
484484
initrd: vec!["/boot/febdf62805de2ae7b6b597f2a9775d9c8a753ba1e5f09298fc8fbe0b0d13bf01/initramfs-5.14.10.img".into()],
485485
options: Some("root=UUID=abc123 rw composefs=febdf62805de2ae7b6b597f2a9775d9c8a753ba1e5f09298fc8fbe0b0d13bf01".into())

crates/lib/src/parsers/bls_config.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ use crate::composefs_consts::COMPOSEFS_CMDLINE;
1717

1818
#[derive(Debug, PartialEq, Eq, Default)]
1919
pub enum BLSConfigType {
20-
EFI {
21-
/// The path to the EFI binary, usually a UKI
22-
efi: Utf8PathBuf,
20+
UKI {
21+
/// The path to the UKI
22+
uki: Utf8PathBuf,
2323
},
24-
NonEFI {
24+
NonUKI {
2525
/// The path to the linux kernel to boot.
2626
linux: Utf8PathBuf,
2727
/// The paths to the initrd images.
@@ -102,11 +102,11 @@ impl Display for BLSConfig {
102102
writeln!(f, "version {}", self.version)?;
103103

104104
match &self.cfg_type {
105-
BLSConfigType::EFI { efi } => {
106-
writeln!(f, "efi {}", efi)?;
105+
BLSConfigType::UKI { uki } => {
106+
writeln!(f, "uki {}", uki)?;
107107
}
108108

109-
BLSConfigType::NonEFI {
109+
BLSConfigType::NonUKI {
110110
linux,
111111
initrd,
112112
options,
@@ -173,16 +173,16 @@ impl BLSConfig {
173173

174174
pub(crate) fn get_verity(&self) -> Result<String> {
175175
match &self.cfg_type {
176-
BLSConfigType::EFI { efi } => Ok(efi
176+
BLSConfigType::UKI { uki } => Ok(uki
177177
.components()
178178
.last()
179-
.ok_or(anyhow::anyhow!("Empty efi field"))?
179+
.ok_or(anyhow::anyhow!("Empty uki field"))?
180180
.to_string()
181181
.strip_suffix(EFI_EXT)
182-
.ok_or(anyhow::anyhow!("efi doesn't end with .efi"))?
182+
.ok_or_else(|| anyhow::anyhow!("uki doesn't end with .efi"))?
183183
.to_string()),
184184

185-
BLSConfigType::NonEFI { options, .. } => {
185+
BLSConfigType::NonUKI { options, .. } => {
186186
let options = options.as_ref().ok_or(anyhow::anyhow!("No options"))?;
187187

188188
let cmdline = Cmdline::from(&options);
@@ -209,7 +209,7 @@ pub(crate) fn parse_bls_config(input: &str) -> Result<BLSConfig> {
209209
let mut title = None;
210210
let mut version = None;
211211
let mut linux = None;
212-
let mut efi = None;
212+
let mut uki = None;
213213
let mut initrd = Vec::new();
214214
let mut options = None;
215215
let mut machine_id = None;
@@ -232,7 +232,7 @@ pub(crate) fn parse_bls_config(input: &str) -> Result<BLSConfig> {
232232
"options" => options = Some(CmdlineOwned::from(value)),
233233
"machine-id" => machine_id = Some(value),
234234
"sort-key" => sort_key = Some(value),
235-
"efi" => efi = Some(Utf8PathBuf::from(value)),
235+
"uki" => uki = Some(Utf8PathBuf::from(value)),
236236
_ => {
237237
extra.insert(key.to_string(), value);
238238
}
@@ -242,19 +242,19 @@ pub(crate) fn parse_bls_config(input: &str) -> Result<BLSConfig> {
242242

243243
let version = version.ok_or_else(|| anyhow!("Missing 'version' value"))?;
244244

245-
let cfg_type = match (linux, efi) {
246-
(None, Some(efi)) => BLSConfigType::EFI { efi },
245+
let cfg_type = match (linux, uki) {
246+
(None, Some(uki)) => BLSConfigType::UKI { uki },
247247

248-
(Some(linux), None) => BLSConfigType::NonEFI {
248+
(Some(linux), None) => BLSConfigType::NonUKI {
249249
linux,
250250
initrd,
251251
options,
252252
},
253253

254254
// The spec makes no mention of whether both can be present or not
255255
// Fow now, for us, we won't have both at the same time
256-
(Some(_), Some(_)) => anyhow::bail!("'linux' and 'efi' values present"),
257-
(None, None) => anyhow::bail!("Missing 'linux' or 'efi' value"),
256+
(Some(_), Some(_)) => anyhow::bail!("'linux' and 'uki' values present"),
257+
(None, None) => anyhow::bail!("Missing 'linux' or 'uki' value"),
258258
};
259259

260260
Ok(BLSConfig {
@@ -285,13 +285,13 @@ mod tests {
285285

286286
let config = parse_bls_config(input)?;
287287

288-
let BLSConfigType::NonEFI {
288+
let BLSConfigType::NonUKI {
289289
linux,
290290
initrd,
291291
options,
292292
} = config.cfg_type
293293
else {
294-
panic!("Expected non EFI variant");
294+
panic!("Expected non UKI variant");
295295
};
296296

297297
assert_eq!(
@@ -321,8 +321,8 @@ mod tests {
321321

322322
let config = parse_bls_config(input)?;
323323

324-
let BLSConfigType::NonEFI { initrd, .. } = config.cfg_type else {
325-
panic!("Expected non EFI variant");
324+
let BLSConfigType::NonUKI { initrd, .. } = config.cfg_type else {
325+
panic!("Expected non UKI variant");
326326
};
327327

328328
assert_eq!(

0 commit comments

Comments
 (0)