Skip to content

Commit 4010283

Browse files
composefs/uki: Install all UKIs in EFI/Linux/bootc
We were making a distinction based on the bootloader and installing UKIs in EFI/Linux for Grub and EFI/Linux/bootc for sd-boot. IMO it's better if we use the same directory for both bootloaders Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent 4418627 commit 4010283

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

crates/lib/src/bootc_composefs/boot.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const VMLINUZ: &str = "vmlinuz";
7474
/// directory specified by the BLS spec. We do this because we want systemd-boot to only look at
7575
/// our config files and not show the actual UKIs in the bootloader menu
7676
/// This is relative to the ESP
77-
pub(crate) const SYSTEMD_UKI_DIR: &str = "EFI/Linux/bootc";
77+
pub(crate) const BOOTC_UKI_DIR: &str = "EFI/Linux/bootc";
7878

7979
pub(crate) const GLOBAL_UKI_ADDON_DIR: &str = "loader/addons";
8080

@@ -601,7 +601,6 @@ fn write_pe_to_esp(
601601
uki_id: &Sha512HashValue,
602602
is_insecure_from_opts: bool,
603603
mounted_efi: impl AsRef<Path>,
604-
bootloader: &Bootloader,
605604
) -> Result<Option<UKILabels>> {
606605
let efi_bin = read_file(file, &repo).context("Reading .efi binary")?;
607606

@@ -649,11 +648,7 @@ fn write_pe_to_esp(
649648
// Directory to write the PortableExecutable to
650649
let pe_install_dir = mounted_efi.as_ref().join(match pe_type {
651650
PEType::UkiAddon if INSTALL_ADDONS_AS_GLOBAL => GLOBAL_UKI_ADDON_DIR,
652-
653-
PEType::Uki | PEType::UkiAddon => match bootloader {
654-
Bootloader::Grub => EFI_LINUX,
655-
Bootloader::Systemd => SYSTEMD_UKI_DIR,
656-
},
651+
PEType::Uki | PEType::UkiAddon => BOOTC_UKI_DIR,
657652
});
658653

659654
create_dir_all(&pe_install_dir)
@@ -808,7 +803,7 @@ fn write_systemd_uki_config(
808803
bls_conf
809804
.with_title(boot_label.boot_label)
810805
.with_cfg(BLSConfigType::UKI {
811-
uki: format!("/{SYSTEMD_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
806+
uki: format!("/{BOOTC_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
812807
})
813808
.with_sort_key(default_sort_key.into())
814809
.with_version(boot_label.version.unwrap_or(default_sort_key.into()));
@@ -949,7 +944,6 @@ pub(crate) fn setup_composefs_uki_boot(
949944
&id,
950945
is_insecure_from_opts,
951946
esp_mount.dir.path(),
952-
&bootloader,
953947
)?;
954948

955949
if let Some(label) = ret {

crates/lib/src/bootc_composefs/delete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
bootc_composefs::{
1010
boot::{
1111
find_vmlinuz_initrd_duplicates, get_efi_uuid_source, get_esp_partition,
12-
get_sysroot_parent_dev, mount_esp, BootType, SYSTEMD_UKI_DIR,
12+
get_sysroot_parent_dev, mount_esp, BootType, BOOTC_UKI_DIR,
1313
},
1414
gc::composefs_gc,
1515
repo::open_composefs_repo,
@@ -156,7 +156,7 @@ fn delete_kernel_initrd(bls_config: &BLSConfigType, boot_dir: &Dir) -> Result<()
156156
#[fn_error_context::context("Deleting UKI and UKI addons {uki_id}")]
157157
fn delete_uki(uki_id: &str, esp_mnt: &Dir) -> Result<()> {
158158
// TODO: We don't delete global addons here
159-
let ukis = esp_mnt.open_dir(SYSTEMD_UKI_DIR)?;
159+
let ukis = esp_mnt.open_dir(BOOTC_UKI_DIR)?;
160160

161161
for entry in ukis.entries_utf8()? {
162162
let entry = entry?;

crates/lib/src/parsers/grub_menuconfig.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ use nom::{
1515
Err, IResult, Parser,
1616
};
1717

18+
use crate::bootc_composefs::boot::BOOTC_UKI_DIR;
19+
1820
/// Body content of a GRUB menuentry containing parsed commands.
1921
#[derive(Debug, PartialEq, Eq)]
2022
pub(crate) struct MenuentryBody<'a> {
@@ -95,7 +97,7 @@ impl<'a> MenuEntry<'a> {
9597
title: format!("{boot_label}: ({uki_id})"),
9698
body: MenuentryBody {
9799
insmod: vec!["fat", "chain"],
98-
chainloader: format!("/EFI/Linux/{uki_id}.efi"),
100+
chainloader: format!("/{BOOTC_UKI_DIR}/{uki_id}.efi"),
99101
search: "--no-floppy --set=root --fs-uuid \"${EFI_PART_UUID}\"",
100102
version: 0,
101103
extra: vec![],

0 commit comments

Comments
 (0)