-
Notifications
You must be signed in to change notification settings - Fork 201
GrubCC binary integration #2223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
55f54c8
6b0e715
751c2bb
70d1006
7d4781a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,6 +96,7 @@ use crate::bootc_composefs::status::ComposefsCmdline; | |
| use crate::bootc_kargs::compute_new_kargs; | ||
| use crate::composefs_consts::{TYPE1_BOOT_DIR_PREFIX, TYPE1_ENT_PATH, TYPE1_ENT_PATH_STAGED}; | ||
| use crate::parsers::bls_config::{BLSConfig, BLSConfigType}; | ||
| use crate::spec::BootloaderKind; | ||
| use crate::task::Task; | ||
| use crate::{bootc_composefs::repo::open_composefs_repo, store::Storage}; | ||
| use crate::{bootc_composefs::status::get_sorted_grub_uki_boot_entries, install::PostFetchState}; | ||
|
|
@@ -582,8 +583,8 @@ pub(crate) fn setup_composefs_bls_boot( | |
|
|
||
| compute_new_kargs(mounted_erofs, current_root, &mut cmdline_refs)?; | ||
|
|
||
| let (entry_paths, _tmpdir_guard) = match bootloader { | ||
| Bootloader::Grub => { | ||
| let (entry_paths, _tmpdir_guard) = match bootloader.kind()? { | ||
| BootloaderKind::GRUBClassic => { | ||
| let root = Dir::open_ambient_dir(&root_path, ambient_authority()) | ||
| .context("Opening root path")?; | ||
|
|
||
|
|
@@ -607,7 +608,7 @@ pub(crate) fn setup_composefs_bls_boot( | |
| ) | ||
| } | ||
|
|
||
| Bootloader::Systemd => { | ||
| BootloaderKind::BLSCompatible => { | ||
| let efi_mount = mount_esp(&esp_device).context("Mounting ESP")?; | ||
|
|
||
| let mounted_efi = Utf8PathBuf::from(efi_mount.dir.path().as_str()?); | ||
|
|
@@ -622,8 +623,6 @@ pub(crate) fn setup_composefs_bls_boot( | |
| Some(efi_mount), | ||
| ) | ||
| } | ||
|
|
||
| Bootloader::None => unreachable!("Checked at install time"), | ||
| }; | ||
|
|
||
| let (bls_config, boot_digest, os_id) = match &entry { | ||
|
|
@@ -1164,14 +1163,14 @@ pub(crate) fn setup_composefs_uki_boot( | |
|
|
||
| let boot_digest = uki_info.boot_digest.clone(); | ||
|
|
||
| match bootloader { | ||
| Bootloader::Grub => { | ||
| match bootloader.kind()? { | ||
| BootloaderKind::GRUBClassic => { | ||
| write_grub_uki_menuentry(root_path, &setup_type, uki_info.boot_label, id, &esp_device)? | ||
| } | ||
|
|
||
| Bootloader::Systemd => write_systemd_uki_config(&esp_mount.fd, &setup_type, uki_info, id)?, | ||
|
|
||
| Bootloader::None => unreachable!("Checked at install time"), | ||
| BootloaderKind::BLSCompatible => { | ||
| write_systemd_uki_config(&esp_mount.fd, &setup_type, uki_info, id)? | ||
| } | ||
| }; | ||
|
|
||
| Ok(boot_digest) | ||
|
|
@@ -1369,13 +1368,48 @@ pub(crate) async fn setup_composefs_boot( | |
| &root_setup.device_info.require_single_root()?, | ||
| boot_uuid, | ||
| )?; | ||
| } else if postfetch.detected_bootloader == Bootloader::Grub { | ||
| } else if matches!( | ||
| postfetch.detected_bootloader, | ||
| Bootloader::Grub | Bootloader::GrubCC | ||
| ) { | ||
| crate::bootloader::install_via_bootupd( | ||
| &root_setup.device_info, | ||
| &root_setup.physical_root_path, | ||
| &state.config_opts, | ||
| None, | ||
| )?; | ||
|
|
||
| // FIXME: Remove this hack once we have support in bootupd | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but it'd be clearer if this was in the conditional above right? Wouldn't bootupd bail in this scenario as is now?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, bootupd will fail if it's only grub-cc, but another hack is that we don't remove grub from the Dockerfile currently. We keep it alongside the grub-cc binary. So bootupd installs grub, shim etc and afterwards we replace the grubx64.efi with grub-cc.efi. It's not clean |
||
| if matches!(postfetch.detected_bootloader, Bootloader::GrubCC) { | ||
| root_setup | ||
| .physical_root | ||
| .remove_dir_all("boot/grub2") | ||
| .context("removing grub2")?; | ||
|
Johan-Liebert1 marked this conversation as resolved.
|
||
|
|
||
| let (os_id, ..) = parse_os_release(mounted_root.dir())? | ||
| .ok_or_else(|| anyhow::anyhow!("Failed to parse os-release"))?; | ||
|
|
||
| let dir = format!("EFI/{os_id}"); | ||
|
|
||
| // Files are in EFI/<os-name>/ | ||
| let efis_dir = mounted_root | ||
| .open_esp_dir() | ||
| .context("opening esp")? | ||
| .open_dir(&dir) | ||
| .with_context(|| format!("Opening {dir}"))?; | ||
|
|
||
| efis_dir | ||
| .remove_file_optional("bootuuid.cfg") | ||
| .context("Removing bootuuid.cfg")?; | ||
| efis_dir | ||
| .remove_file_optional("grub.cfg") | ||
| .context("Removing grub.cfg")?; | ||
|
|
||
| mounted_root | ||
| .dir() | ||
| .copy("usr/lib/grub-cc/grubx64-cc.efi", &efis_dir, "grubx64.efi") | ||
| .context("Copying grub-cc binary")?; | ||
| } | ||
| } else { | ||
| crate::bootloader::install_systemd_boot( | ||
| &mounted_root, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.