Skip to content

Commit 2906324

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 d2c358e commit 2906324

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
@@ -504,7 +504,7 @@ pub(crate) fn setup_composefs_bls_boot(
504504
.with_title(title)
505505
.with_sort_key(default_sort_key.into())
506506
.with_version(version)
507-
.with_cfg(BLSConfigType::NonEFI {
507+
.with_cfg(BLSConfigType::NonUKI {
508508
linux: entry_paths.abs_entries_path.join(&id_hex).join(VMLINUZ),
509509
initrd: vec![entry_paths.abs_entries_path.join(&id_hex).join(INITRD)],
510510
options: Some(cmdline_refs),
@@ -515,7 +515,7 @@ pub(crate) fn setup_composefs_bls_boot(
515515
let symlink_to = &symlink_to[0];
516516

517517
match bls_config.cfg_type {
518-
BLSConfigType::NonEFI {
518+
BLSConfigType::NonUKI {
519519
ref mut linux,
520520
ref mut initrd,
521521
..
@@ -810,8 +810,8 @@ fn write_systemd_uki_config(
810810
let mut bls_conf = BLSConfig::default();
811811
bls_conf
812812
.with_title(boot_label.boot_label)
813-
.with_cfg(BLSConfigType::EFI {
814-
efi: format!("/{SYSTEMD_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
813+
.with_cfg(BLSConfigType::UKI {
814+
uki: format!("/{SYSTEMD_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
815815
})
816816
.with_sort_key(default_sort_key.into())
817817
.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
@@ -65,20 +65,20 @@ fn delete_type1_entry(depl: &DeploymentEntry, boot_dir: &Dir, deleting_staged: b
6565
let bls_config = parse_bls_config(&cfg)?;
6666

6767
match &bls_config.cfg_type {
68-
BLSConfigType::EFI { efi } => {
69-
if !efi.as_str().contains(&depl.deployment.verity) {
68+
BLSConfigType::UKI { uki } => {
69+
if !uki.as_str().contains(&depl.deployment.verity) {
7070
continue;
7171
}
7272

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

7878
break;
7979
}
8080

81-
BLSConfigType::NonEFI { options, .. } => {
81+
BLSConfigType::NonUKI { options, .. } => {
8282
let options = options
8383
.as_ref()
8484
.ok_or(anyhow::anyhow!("options not found in BLS config file"))?;
@@ -87,7 +87,7 @@ fn delete_type1_entry(depl: &DeploymentEntry, boot_dir: &Dir, deleting_staged: b
8787
continue;
8888
}
8989

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

9393
if should_del_kernel {
@@ -116,8 +116,8 @@ fn delete_type1_entry(depl: &DeploymentEntry, boot_dir: &Dir, deleting_staged: b
116116

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

123123
// "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
@@ -377,13 +377,13 @@ pub(crate) async fn composefs_deployment_status_from(
377377
.ok_or(anyhow::anyhow!("First boot entry not found"))?;
378378

379379
match &bls_config.cfg_type {
380-
BLSConfigType::NonEFI { options, .. } => !options
380+
BLSConfigType::NonUKI { options, .. } => !options
381381
.as_ref()
382382
.ok_or(anyhow::anyhow!("options key not found in bls config"))?
383383
.contains(composefs_digest.as_ref()),
384384

385-
BLSConfigType::EFI { .. } => {
386-
anyhow::bail!("Found 'efi' field in Type1 boot entry")
385+
BLSConfigType::UKI { .. } => {
386+
anyhow::bail!("Found 'uki' field in Type1 boot entry")
387387
}
388388
BLSConfigType::Unknown => anyhow::bail!("Unknown BLS Config Type"),
389389
}
@@ -410,10 +410,10 @@ pub(crate) async fn composefs_deployment_status_from(
410410

411411
match &bls_config.cfg_type {
412412
// For UKI boot
413-
BLSConfigType::EFI { efi } => efi.as_str().contains(composefs_digest.as_ref()),
413+
BLSConfigType::UKI { uki } => uki.as_str().contains(composefs_digest.as_ref()),
414414

415415
// For boot entry Type1
416-
BLSConfigType::NonEFI { options, .. } => !options
416+
BLSConfigType::NonUKI { options, .. } => !options
417417
.as_ref()
418418
.ok_or(anyhow::anyhow!("options key not found in bls config"))?
419419
.contains(composefs_digest.as_ref()),
@@ -486,7 +486,7 @@ mod tests {
486486
let mut config1 = BLSConfig::default();
487487
config1.title = Some("Fedora 42.20250623.3.1 (CoreOS)".into());
488488
config1.sort_key = Some("1".into());
489-
config1.cfg_type = BLSConfigType::NonEFI {
489+
config1.cfg_type = BLSConfigType::NonUKI {
490490
linux: "/boot/7e11ac46e3e022053e7226a20104ac656bf72d1a84e3a398b7cce70e9df188b6/vmlinuz-5.14.10".into(),
491491
initrd: vec!["/boot/7e11ac46e3e022053e7226a20104ac656bf72d1a84e3a398b7cce70e9df188b6/initramfs-5.14.10.img".into()],
492492
options: Some("root=UUID=abc123 rw composefs=7e11ac46e3e022053e7226a20104ac656bf72d1a84e3a398b7cce70e9df188b6".into()),
@@ -495,7 +495,7 @@ mod tests {
495495
let mut config2 = BLSConfig::default();
496496
config2.title = Some("Fedora 41.20250214.2.0 (CoreOS)".into());
497497
config2.sort_key = Some("2".into());
498-
config2.cfg_type = BLSConfigType::NonEFI {
498+
config2.cfg_type = BLSConfigType::NonUKI {
499499
linux: "/boot/febdf62805de2ae7b6b597f2a9775d9c8a753ba1e5f09298fc8fbe0b0d13bf01/vmlinuz-5.14.10".into(),
500500
initrd: vec!["/boot/febdf62805de2ae7b6b597f2a9775d9c8a753ba1e5f09298fc8fbe0b0d13bf01/initramfs-5.14.10.img".into()],
501501
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)