Skip to content

Commit a7dc7ed

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 <pragyanpoudyal41999@gmail.com>
1 parent 2906324 commit a7dc7ed

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
@@ -73,7 +73,7 @@ const VMLINUZ: &str = "vmlinuz";
7373
/// directory specified by the BLS spec. We do this because we want systemd-boot to only look at
7474
/// our config files and not show the actual UKIs in the bootloader menu
7575
/// This is relative to the ESP
76-
pub(crate) const SYSTEMD_UKI_DIR: &str = "EFI/Linux/bootc";
76+
pub(crate) const BOOTC_UKI_DIR: &str = "EFI/Linux/bootc";
7777

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

@@ -604,7 +604,6 @@ fn write_pe_to_esp(
604604
uki_id: &Sha512HashValue,
605605
is_insecure_from_opts: bool,
606606
mounted_efi: impl AsRef<Path>,
607-
bootloader: &Bootloader,
608607
) -> Result<Option<UKILabels>> {
609608
let efi_bin = read_file(file, &repo).context("Reading .efi binary")?;
610609

@@ -652,11 +651,7 @@ fn write_pe_to_esp(
652651
// Directory to write the PortableExecutable to
653652
let pe_install_dir = mounted_efi.as_ref().join(match pe_type {
654653
PEType::UkiAddon if INSTALL_ADDONS_AS_GLOBAL => GLOBAL_UKI_ADDON_DIR,
655-
656-
PEType::Uki | PEType::UkiAddon => match bootloader {
657-
Bootloader::Grub => EFI_LINUX,
658-
Bootloader::Systemd => SYSTEMD_UKI_DIR,
659-
},
654+
PEType::Uki | PEType::UkiAddon => BOOTC_UKI_DIR,
660655
});
661656

662657
create_dir_all(&pe_install_dir)
@@ -811,7 +806,7 @@ fn write_systemd_uki_config(
811806
bls_conf
812807
.with_title(boot_label.boot_label)
813808
.with_cfg(BLSConfigType::UKI {
814-
uki: format!("/{SYSTEMD_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
809+
uki: format!("/{BOOTC_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
815810
})
816811
.with_sort_key(default_sort_key.into())
817812
.with_version(boot_label.version.unwrap_or(default_sort_key.into()));
@@ -952,7 +947,6 @@ pub(crate) fn setup_composefs_uki_boot(
952947
&id,
953948
is_insecure_from_opts,
954949
esp_mount.dir.path(),
955-
&bootloader,
956950
)?;
957951

958952
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)