Skip to content

Commit 86f5cea

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 299e2b1 commit 86f5cea

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

crates/lib/src/bootc_composefs/boot.rs

Lines changed: 4 additions & 11 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) enum BootSetupType<'a> {
7979
/// For initial setup, i.e. install to-disk
@@ -629,7 +629,6 @@ fn write_pe_to_esp(
629629
uki_id: &Sha512HashValue,
630630
is_insecure_from_opts: bool,
631631
mounted_efi: impl AsRef<Path>,
632-
bootloader: &Bootloader,
633632
) -> Result<Option<UKILabels>> {
634633
let efi_bin = read_file(file, &repo).context("Reading .efi binary")?;
635634

@@ -674,13 +673,8 @@ fn write_pe_to_esp(
674673
});
675674
}
676675

677-
// Write the UKI to ESP
678-
let efi_linux_path = mounted_efi.as_ref().join(match bootloader {
679-
Bootloader::Grub => EFI_LINUX,
680-
Bootloader::Systemd => SYSTEMD_UKI_DIR,
681-
});
682-
683-
create_dir_all(&efi_linux_path).context("Creating EFI/Linux")?;
676+
let efi_linux_path = mounted_efi.as_ref().join(BOOTC_UKI_DIR);
677+
create_dir_all(&efi_linux_path).context("Creating bootc UKI directory")?;
684678

685679
let final_pe_path = match file_path.parent() {
686680
Some(parent) => {
@@ -829,7 +823,7 @@ fn write_systemd_uki_config(
829823
bls_conf
830824
.with_title(boot_label.boot_label)
831825
.with_cfg(BLSConfigType::UKI {
832-
uki: format!("/{SYSTEMD_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
826+
uki: format!("/{BOOTC_UKI_DIR}/{}{}", id.to_hex(), EFI_EXT).into(),
833827
})
834828
.with_sort_key(default_sort_key.into())
835829
.with_version(boot_label.version.unwrap_or(default_sort_key.into()));
@@ -969,7 +963,6 @@ pub(crate) fn setup_composefs_uki_boot(
969963
&id,
970964
is_insecure_from_opts,
971965
esp_mount.dir.path(),
972-
&bootloader,
973966
)?;
974967

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