Skip to content

Commit a0ff737

Browse files
authored
Merge pull request #1106 from cgwalters/depend-updated-bootupd
bootloader: Always pass full path to bootupd
2 parents b847101 + 769b0fb commit a0ff737

File tree

2 files changed

+11
-34
lines changed

2 files changed

+11
-34
lines changed

lib/src/bootloader.rs

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,12 @@
11
use anyhow::{anyhow, bail, Context, Result};
2-
use camino::{Utf8Path, Utf8PathBuf};
2+
use camino::Utf8Path;
33
use fn_error_context::context;
44

55
use crate::task::Task;
66
use bootc_blockdev::PartitionTable;
77

88
/// The name of the mountpoint for efi (as a subdirectory of /boot, or at the toplevel)
99
pub(crate) const EFI_DIR: &str = "efi";
10-
#[cfg(feature = "install-to-disk")]
11-
pub(crate) const ESP_GUID: &str = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B";
12-
#[cfg(feature = "install-to-disk")]
13-
pub(crate) const PREPBOOT_GUID: &str = "9E1A2D38-C612-4316-AA26-8B49521E5A8B";
14-
#[cfg(feature = "install-to-disk")]
15-
pub(crate) const PREPBOOT_LABEL: &str = "PowerPC-PReP-boot";
16-
#[cfg(target_arch = "powerpc64")]
17-
/// We make a best-effort to support MBR partitioning too.
18-
pub(crate) const PREPBOOT_MBR_TYPE: &str = "41";
19-
20-
/// Find the device to pass to bootupd. Only on powerpc64 right now
21-
/// we explicitly find one with a specific label.
22-
///
23-
/// This should get fixed once we execute on https://github.com/coreos/bootupd/issues/432
24-
fn get_bootupd_device(device: &PartitionTable) -> Result<Utf8PathBuf> {
25-
#[cfg(target_arch = "powerpc64")]
26-
{
27-
return device
28-
.partitions
29-
.iter()
30-
.find(|p| matches!(p.parttype.as_str(), PREPBOOT_GUID | PREPBOOT_MBR_TYPE))
31-
.ok_or_else(|| {
32-
anyhow::anyhow!("Failed to find PReP partition with GUID {PREPBOOT_GUID}")
33-
})
34-
.map(|dev| dev.node.as_str().into());
35-
}
36-
#[cfg(not(target_arch = "powerpc64"))]
37-
return Ok(device.path().into());
38-
}
3910

4011
#[context("Installing bootloader")]
4112
pub(crate) fn install_via_bootupd(
@@ -47,7 +18,7 @@ pub(crate) fn install_via_bootupd(
4718
// bootc defaults to only targeting the platform boot method.
4819
let bootupd_opts = (!configopts.generic_image).then_some(["--update-firmware", "--auto"]);
4920

50-
let devpath = get_bootupd_device(device)?;
21+
let devpath = device.path();
5122
let args = ["backend", "install", "--write-uuid"]
5223
.into_iter()
5324
.chain(verbose)

lib/src/install/baseline.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ pub(crate) const BOOTPN_SIZE_MB: u32 = 510;
3737
pub(crate) const EFIPN_SIZE_MB: u32 = 512;
3838
/// The GPT type for "linux"
3939
pub(crate) const LINUX_PARTTYPE: &str = "0FC63DAF-8483-4772-8E79-3D69D8477DE4";
40+
#[cfg(feature = "install-to-disk")]
41+
pub(crate) const PREPBOOT_GUID: &str = "9E1A2D38-C612-4316-AA26-8B49521E5A8B";
42+
#[cfg(feature = "install-to-disk")]
43+
pub(crate) const PREPBOOT_LABEL: &str = "PowerPC-PReP-boot";
44+
#[cfg(feature = "install-to-disk")]
45+
pub(crate) const ESP_GUID: &str = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B";
4046

4147
#[derive(clap::ValueEnum, Default, Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
4248
#[serde(rename_all = "kebab-case")]
@@ -257,8 +263,8 @@ pub(crate) fn install_create_rootfs(
257263
} else if cfg!(target_arch = "powerpc64") {
258264
// PowerPC-PReP-boot
259265
partno += 1;
260-
let label = crate::bootloader::PREPBOOT_LABEL;
261-
let uuid = crate::bootloader::PREPBOOT_GUID;
266+
let label = PREPBOOT_LABEL;
267+
let uuid = PREPBOOT_GUID;
262268
writeln!(
263269
&mut partitioning_buf,
264270
r#"size=4MiB, bootable, type={uuid}, name="{label}""#
@@ -270,7 +276,7 @@ pub(crate) fn install_create_rootfs(
270276
}
271277

272278
let esp_partno = if super::ARCH_USES_EFI {
273-
let esp_guid = crate::bootloader::ESP_GUID;
279+
let esp_guid = ESP_GUID;
274280
partno += 1;
275281
writeln!(
276282
&mut partitioning_buf,

0 commit comments

Comments
 (0)