Repository navigation
Conversation
bootc install assumes the image's architecture is the host's at four sites: the sfdisk layout (BIOS boot partition, root partition type), the EFI decision, the systemd-boot copy (bootctl installs only host-arch binaries), and composefs image-index resolution. --target-arch defaults to the host, so existing installs are unchanged. When it names another architecture: - the partition layout, root type check and EFI use follow the target; - bootctl runs with --all-architectures --install-source=image (systemd >= 252) so the target's systemd-boot comes from the image; - the composefs pull asks for the target's manifest through composefs-oci's PullOptions::platform. Cross installs are limited to the sfdisk layout, the composefs backend without unified storage, and systemd-boot; anything else is refused. The platform selection is not yet in released composefs-rs or ocidir, so Cargo.toml patches both to branches that add it. Generated-by: AI
There was a problem hiding this comment.
🟡 Changes recommended
Critical cross-architecture image-selection and bootloader errors can produce invalid installations, while late compatibility checks can wipe disk signatures before rejecting unsupported options.
7 open issues
Allow the new Git sources in cargo-deny policy · New Dispatch bootloader installation by target architecture · New Honor target architecture in proxy-backed OCI pulls · New Reject cross-architecture installs for OSTree backends · New Reject unsupported options before wiping the disk · New Use target platform for preliminary image metadata lookup · New Use target architecture when computing install kernel arguments · New
What changed in this PR
Adds --target-arch to support building disk images for another architecture without emulation, focusing on composefs installs with systemd-boot while preserving host-native defaults.
Changes:
- Makes partition layout and EFI decisions follow the selected target architecture.
- Passes target-platform information to composefs pulls and enables cross-architecture systemd-boot installation.
- Documents the option and pins unreleased dependency branches providing platform-selection APIs.
| File | Description |
|---|---|
docs/src/man/bootc-install-to-filesystem.8.md |
Documents the target option and supported scope. |
docs/src/man/bootc-install-to-existing-root.8.md |
Documents the target option and supported scope. |
docs/src/man/bootc-install-to-disk.8.md |
Documents cross-architecture disk installation. |
crates/lib/src/install/target_arch.rs |
Adds architecture mappings, layout helpers, and unit tests. |
crates/lib/src/install/baseline.rs |
Uses target-specific partition types and layout checks. |
crates/lib/src/install.rs |
Adds target configuration with host defaults. |
crates/lib/src/bootloader.rs |
Adds cross-architecture bootctl flags and version validation. |
crates/lib/src/bootc_composefs/repo.rs |
Passes target-platform information to direct pulls. |
crates/lib/src/bootc_composefs/boot.rs |
Restricts cross-architecture bootloader selection. |
Cargo.toml |
Adds temporary dependency branch overrides. |
Cargo.lock |
Pins the overridden dependencies to Git revisions. |
Review effort: Balanced
Comment on lines
+139
to
+140
| [patch.crates-io] | ||
| composefs = { git = "https://github.com/mattmoor/composefs-rs", branch = "pull-platform" } |
| // paths name or run the host's. | ||
| let target_arch = state.config_opts.target_arch(); | ||
| ensure!( | ||
| target_arch.is_host() || (bootloader == Bootloader::Systemd && target_arch.uses_efi()), |
| PullOptions { | ||
| img_proxy_config: Some(config), | ||
| progress: Some(reporter), | ||
| platform, |
Comment on lines
+405
to
+407
| #[clap(long)] | ||
| #[serde(default)] | ||
| pub(crate) target_arch: Option<TargetArch>, |
Comment on lines
+1059
to
+1063
| anyhow::ensure!( | ||
| target_arch.is_host() || (state.aboot_disk_layout.is_none() && !use_systemd_repart), | ||
| "Installing for {target_arch} from {} is not supported with systemd-repart partitioning", | ||
| super::TargetArch::host() | ||
| ); |
| "Installing for {} does not support unified storage", | ||
| state.config_opts.target_arch() | ||
| ); | ||
| Some(state.config_opts.target_arch().oci_platform()?) |
Comment on lines
+412
to
+413
| pub(crate) fn target_arch(&self) -> TargetArch { | ||
| self.target_arch.unwrap_or_else(TargetArch::host) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Draft to show the objective; not ready for review. It depends on unreleased changes to composefs-rs and ocidir, consumed here through
[patch.crates-io]git branches.Objective
Build a bootc disk image for one architecture on a host of another, for example an aarch64 cloud image from an x86_64 builder, without emulating the target. Nothing in
bootc install to-diskneeds to run target code; it only makes decisions that today follow the host instead of the image.Where the host architecture is assumed
install/baseline.rs): the BIOS boot / PReP partition and the root partition type come fromcfg!(target_arch)anddps::this_arch_root().ARCH_USES_EFI).bootctl installcopies only host-arch EFI binaries, so a foreign-arch install gets no bootloader.open_image_this_platform).Change
--target-archon the install config options, defaulting to the host, so existing behaviour is unchanged. When it names another architecture:bootctl installgets--all-architectures --install-source=image(systemd ≥ 252), so the target's systemd-boot comes from the image;PullOptions::platform.Cross installs are refused outside what was exercised: systemd-repart/aboot layouts, unified storage, and bootloaders other than systemd-boot.
Dependencies (branches only; no PRs yet)
OciRead::open_image_for_platform;open_image_this_platformwraps it with the host platform. https://github.com/mattmoor/ocidir-rs/tree/platform-selectioncomposefs-ociPullOptions::platform, threaded through the skopeo and OCI-layout import paths;Nonekeeps today's behaviour. https://github.com/mattmoor/composefs-rs/tree/pull-platformTesting
On an x86_64 host, with this branch and the same dependency changes:
No manifest found for platform linux/amd64. bootc 1.17.4 had already written a BIOS boot partition and an x86-64 root partition type for it.install to-disk --composefs-backend --target-arch aarch64: the GPT is ESP +Linux root (ARM-64)with no BIOS boot partition, and the ESP holdsEFI/systemd/systemd-bootaa64.efiandEFI/BOOT/BOOTAA64.EFI, both PE32+ ARM64.qemu-system-aarch64(TCG, edk2 UEFI) through systemd-boot and the arm64 kernel toReached target Multi-User Systemand a login prompt on ttyAMA0.--target-arch x86_64for the arm64 image is refused. A native amd64 install produces the same layout (BIOS boot, x86-64 root,BOOTX64.EFI) as upstream main.install,baseline,bootloaderand the newtarget_archmodule, and for the ocidir and composefs-oci tests touching the changed paths.Not covered: registry pulls of multi-arch indexes via the skopeo proxy (only the oci-archive path was exercised), ostree-backend installs, and the integration suites.
Generated-by: AI