Skip to content
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

bib: add cross arch building #179

Merged
merged 1 commit into from
Feb 7, 2024
Merged

Conversation

mvo5
Copy link
Collaborator

@mvo5 mvo5 commented Feb 7, 2024

This commit adds experimental cross arch building.

I.e. you bootc-image-builder on a mac and target an amd64 machine.

The usage would be:

sudo podman run ... \
  --type qcow2 \
  --target-arch amd64 \
     quay.io/centos-bootc/fedora-bootc:eln

and this is predicated on the idea that the target container is available for both host and target architecture. When that is the case the container for the host architecture is used as a buildroot, the container for the target architecture is the target tree. Note that some stages chroot into the target tree so qemu-user is essential for this to work so that target achitecture code can be run transparently (because only very small amounts of code need to run emulated this is pretty fast still).

It will need qemu-user{,-static} installed on the host. Sadly we cannot just install qemu-user into the container because the binfmt_misc system is global and not namespaced. So while adding the binfmt_misc handler from inside the container would work with enough privs it would alter the global machine state and we should not do it.

[This is https://github.com//pull/139 without the testing which runs out of diskspace because we need to pull the arm64 container and create an arm64 disk image which is too much for the already tight disk space situation
I will keep working on #139 to see what I can do about cleaning up diskspace but to unblock the podman team we can consider merging this?]

This commit adds experimental cross arch building.

I.e. you `bootc-image-builder` on a mac and target an `amd64` machine.

The usage would be:
```
sudo podman run ... \
  --type qcow2 \
  --target-arch amd64 \
     quay.io/centos-bootc/fedora-bootc:eln
```
and this is predicated on the idea that the target container is
available for both host and target architecture. When that is the case
the container for the host architecture is used as a buildroot, the
container for the target architecture is the target tree. Note that some
stages chroot into the target tree so `qemu-user` is essential for this
to work so that target achitecture code can be run transparently (because
only very small amounts of code need to run emulated this is pretty fast
still).

It will need qemu-user{,-static} installed on the host. Sadly we
cannot just install qemu-user into the container because the binfmt_misc
system is global and not namespaced. So while adding the binfmt_misc
handler from inside the container would work with enough privs it
would alter the global machine state and we should not do it.
Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Good. Ship it!

@achilleas-k achilleas-k added this pull request to the merge queue Feb 7, 2024
Merged via the queue into osbuild:main with commit 7c74cc5 Feb 7, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants