Skip to content

Commit b010983

Browse files
Johan-Liebert1jeckersb
authored andcommitted
install-to-disk: Add DPS uuid for all supported architectures
Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent 0e4769c commit b010983

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

crates/lib/src/bootc_composefs/boot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use crate::{
4444
BOOT_LOADER_ENTRIES, COMPOSEFS_CMDLINE, ORIGIN_KEY_BOOT, ORIGIN_KEY_BOOT_DIGEST,
4545
STAGED_BOOT_LOADER_ENTRIES, STATE_DIR_ABS, USER_CFG, USER_CFG_STAGED,
4646
},
47-
install::{DPS_UUID, ESP_GUID, RW_KARG},
47+
install::{dps_uuid::DPS_UUID, ESP_GUID, RW_KARG},
4848
spec::{Bootloader, Host},
4949
};
5050

crates/lib/src/install.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,26 @@ pub(crate) const EFIVARFS: &str = "/sys/firmware/efi/efivars";
8989
pub(crate) const ARCH_USES_EFI: bool = cfg!(any(target_arch = "x86_64", target_arch = "aarch64"));
9090
#[cfg(any(feature = "composefs-backend", feature = "install-to-disk"))]
9191
pub(crate) const ESP_GUID: &str = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B";
92+
9293
#[cfg(any(feature = "composefs-backend", feature = "install-to-disk"))]
93-
// TODO (Johan-Liebert1): We'd want this for all archs
94-
pub(crate) const DPS_UUID: &str = "4f68bce3-e8cd-4db1-96e7-fbcaf984b709";
94+
// Architecture-specific DPS UUIDs for install-to-disk flow
95+
// See: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/#defined-partition-type-uuids
96+
pub(crate) mod dps_uuid {
97+
#[cfg(target_arch = "x86_64")]
98+
pub(crate) const DPS_UUID: &str = "4f68bce3-e8cd-4db1-96e7-fbcaf984b709";
99+
100+
#[cfg(target_arch = "aarch64")]
101+
pub(crate) const DPS_UUID: &str = "b921b045-1df0-41c3-af44-4c6f280d3fae";
102+
103+
#[cfg(target_arch = "s390x")]
104+
pub(crate) const DPS_UUID: &str = "5eead9a9-fe09-4a1e-a1d7-520d00531306";
105+
106+
#[cfg(all(target_arch = "powerpc64", target_endian = "big"))]
107+
pub(crate) const DPS_UUID: &str = "912ade1d-c142-4c63-8823-4435540c14a2";
108+
109+
#[cfg(all(target_arch = "powerpc64", target_endian = "little"))]
110+
pub(crate) const DPS_UUID: &str = "c31c45e6-3f39-412e-80fb-4809c4980599";
111+
}
95112

96113
const DEFAULT_REPO_CONFIG: &[(&str, &str)] = &[
97114
// Default to avoiding grub2-mkconfig etc.

crates/lib/src/install/baseline.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,12 @@ fn mkfs<'a>(
104104
label: &str,
105105
wipe: bool,
106106
opts: impl IntoIterator<Item = &'a str>,
107-
dps_uuid: Option<uuid::Uuid>,
108107
) -> Result<uuid::Uuid> {
109108
let devinfo = bootc_blockdev::list_dev(dev.into())?;
110109
let size = ostree_ext::glib::format_size(devinfo.size);
111-
let u = if let Some(u) = dps_uuid {
112-
u
113-
} else {
114-
uuid::Uuid::new_v4()
115-
};
110+
111+
let u = uuid::uuid!(crate::install::dps_uuid::DPS_UUID);
112+
116113
let mut t = Task::new(
117114
&format!("Creating {label} filesystem ({fs}) on device {dev} (size={size})"),
118115
format!("mkfs.{fs}"),
@@ -386,7 +383,6 @@ pub(crate) fn install_create_rootfs(
386383
"boot",
387384
opts.wipe,
388385
[],
389-
None,
390386
)
391387
.context("Initializing /boot")?,
392388
)
@@ -407,8 +403,6 @@ pub(crate) fn install_create_rootfs(
407403
"root",
408404
opts.wipe,
409405
mkfs_options.iter().copied(),
410-
// TODO: Add cli option for this
411-
Some(uuid::uuid!(crate::install::DPS_UUID)),
412406
)?;
413407
let rootarg = format!("root=UUID={root_uuid}");
414408
let bootsrc = boot_uuid.as_ref().map(|uuid| format!("UUID={uuid}"));

0 commit comments

Comments
 (0)