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

azlinux/mariner: Use provided platform for outputs #327

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Jul 18, 2024

Before this change, the mariner/azl targets were ignoring the client provided platform for the produced aritifacts.

With this change the platform is set on images so it will rely on binfmt_misc to execute those images correctly.
This also includes some optimizations:

  1. If there is a build dependency on golang it will mount the native golang toolchain over the platform-specific one and adds the proper envs to produce the correct binaries for the target platform
  2. go modules fetched with the generator will use the native go
  3. The rpm build root is generated using the native platform since there is no platform specific code included there
  4. Native dnf is used to install packages into the rootfs with the target arch (this required a change to dnf as tdnf appears to be bugged in this case).

This does not add support for cross compilation (run x86 code to generate, e.g., arm64 code) outside of the specific optimizations listed above.

@cpuguy83 cpuguy83 force-pushed the use_correct_platforms branch 4 times, most recently from 92f97df to 1dcd0fd Compare July 18, 2024 23:50
@cpuguy83 cpuguy83 force-pushed the use_correct_platforms branch from 1dcd0fd to f1ce1c0 Compare July 25, 2024 23:42
@cpuguy83 cpuguy83 force-pushed the use_correct_platforms branch 2 times, most recently from e103c78 to 2f39409 Compare August 29, 2024 00:37
@cpuguy83 cpuguy83 marked this pull request as ready for review August 29, 2024 01:14
@cpuguy83 cpuguy83 requested a review from a team as a code owner August 29, 2024 01:14
@cpuguy83 cpuguy83 added this to the v0.9.0 milestone Aug 30, 2024
@cpuguy83 cpuguy83 force-pushed the use_correct_platforms branch 2 times, most recently from 3a73d76 to 387ca5c Compare August 30, 2024 00:58
Before this change, the mariner/azl targets were ignoring the client
provided platform for the produced aritifacts.

With this change the platform is set on images so it will rely on
binfmt_misc to execute those images correctly.
There's probably some optimizations that can be made here to run certain
tasks on the native platform, some thoughts:

- Use native (host-arch) golang to download go modules
- Use native (host-arch) tdnf to download/install non-native packages
  onto the target build environment.

This does *not* add support for cross compilation (run x86 code to
generate, e.g., arm64 code).

Signed-off-by: Brian Goff <[email protected]>
When building for a non-native platform (typically under qemu), use the
native platform for most operations that do not need platform specific
things, such as applying patches, tarring up sources, and fetching
go module deps.

Signed-off-by: Brian Goff <[email protected]>
This is an optimization to allow using the native go compiler to cross
compile to the desired target.
This is transparent to the user.

Signed-off-by: Brian Goff <[email protected]>
When cross compiling, use dnf from the native platform to install
packages into the target arch rootfs.
This helps speed up package install a bit since dnf won't need to run
under emulation.

Signed-off-by: Brian Goff <[email protected]>
This offers a tremendous speedup for local development.

Signed-off-by: Brian Goff <[email protected]>
@cpuguy83 cpuguy83 force-pushed the use_correct_platforms branch from 387ca5c to c254fab Compare September 4, 2024 20:09
@cpuguy83 cpuguy83 marked this pull request as draft September 13, 2024 17:24
@cpuguy83 cpuguy83 modified the milestones: v0.9.0, vNext Sep 30, 2024
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