Add no-emulation support in build-rootfs #15370
Merged
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.
Building rootfs currently requires emulation to run post-install, maintainers scripts. That mean qemu, debootstrap, binfmt all need to support the $newPlatform. Locally things work because docker/podman are typically supporting the new platform like loongarch64, but on Azure DevOps side, qemu is pretty old.
Once the rootfs environment is built, no part of the infra in runtime/diagnostics repos ever
chroot
into the rootfsdir. Instead, all we rely on is headers, libs and toolchains in place and --sysroot with host clang. The maintainers scripts can compile stuff post-install and create symlinks etc. Our use-cases are simple enough to avoid running maintainer scripts.On Alpine Linux, it's just a matter of
--no-scripts
passed toapk add
. debootstrap doesn't provide such option.This PR:
--skipemulation
arg to build rootfs to skip the post-install scripts. For debian-based distros, a python script is added which resolves, downloads and extracts the deb files and skips the maintainers scripts.Tested at dotnet/dotnet-buildtools-prereqs-docker#1306 with
--skipemulation
.