Fix broken arm64 builds#566
Open
srmungar wants to merge 14 commits into
Open
Conversation
…the ARM64 image as well
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to restore broken ARM64 (AArch64) cross-builds by ensuring the host can execute foreign-architecture binaries (via qemu-user-static/binfmt) and by adding CI workflows that build AArch64 templates on every PR.
Changes:
- Extend host dependency handling to include qemu-user-static/binfmt and attempt to enable the
qemu-aarch64binfmt handler for cross-arch execution. - Update the shell command allowlist to include
update-binfmts. - Add multiple GitHub Actions workflows to cross-build AArch64 images (with optional QEMU boot smoke tests), plus an additional cross-build helper script.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/cross-build_azl3_arm_raw.sh | Adds a standalone cross-build + optional QEMU boot-test script for AZL3 AArch64 raw images. |
| internal/utils/shell/shell.go | Adds update-binfmts to the allowlist and changes sudo/chroot command string construction. |
| internal/provider/azl/azl.go | Installs qemu/binfmt dependencies and enables qemu-aarch64 binfmt on x86_64 hosts. |
| .github/workflows/cross-build-ubuntu24-aarch64-server-cloud.yml | Cross-build Ubuntu 24 server-cloud AArch64 template and optionally boot-test it in QEMU. |
| .github/workflows/cross-build-ubuntu24-aarch64-minimal-uki.yml | Cross-build Ubuntu 24 minimal UKI AArch64 template and optionally boot-test it in QEMU. |
| .github/workflows/cross-build-ubuntu24-aarch64-minimal-raw.yml | Cross-build Ubuntu 24 minimal raw AArch64 template and optionally boot-test it in QEMU. |
| .github/workflows/cross-build-ubuntu24-aarch64-edge-raw.yml | Cross-build Ubuntu 24 edge raw AArch64 template and optionally boot-test it in QEMU. |
| .github/workflows/cross-build-elxr12-aarch64-minimal-raw.yml | Cross-build ELXR12 minimal raw AArch64 template and optionally boot-test it in QEMU. |
| .github/workflows/cross-build-debian13-aarch64-minimal-raw.yml | Cross-build Debian 13 minimal raw AArch64 template and optionally boot-test it in QEMU. |
| .github/workflows/cross-build-azl3-arm-raw.yml | Cross-build AZL3 AArch64 raw template and optionally boot-test it in QEMU. |
| } else { | ||
| fullCmdStr = envValStr + "chroot " + chrootPath + " " + fullPathCmdStr | ||
| } | ||
| fullCmdStr = "sudo " + envValStr + "chroot " + chrootPath + " " + fullPathCmdStr |
Comment on lines
+487
to
+490
| fullCmdStr = "sudo " + envValStr + fullPathCmdStr | ||
| // log.Debugf("Exec: [sudo " + fullPathCmdStr + "]") | ||
| // Avoid logging full command string to prevent leaking sensitive data. | ||
| log.Debugf("Exec with sudo: [command executed]") |
Comment on lines
+266
to
+270
| if _, err := shell.ExecCmd("mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc 2>/dev/null || true", true, shell.HostPath, nil); err != nil { | ||
| log.Debugf("binfmt_misc mount attempt: %v", err) | ||
| } | ||
| if _, err := shell.ExecCmd("update-binfmts --enable qemu-aarch64", true, shell.HostPath, nil); err != nil { | ||
| return fmt.Errorf("failed to enable qemu-aarch64 binfmt handler: %w", err) |
Comment on lines
+1
to
+7
| #!/bin/bash | ||
| set -e | ||
|
|
||
| # Parse command line arguments | ||
| RUN_QEMU_TESTS=false | ||
| WORKING_DIR="$(pwd)" | ||
|
|
Comment on lines
+104
to
+107
| ORIGINAL_DIR=$(pwd) | ||
| # Find compressed raw image path using pattern, handle permission issues | ||
| FOUND_PATH=$(sudo -S find . -type f -name "*${IMAGE_PATTERN}*.raw.gz" 2>/dev/null | head -n 1) | ||
| if [ -n "$FOUND_PATH" ]; then |
Comment on lines
+160
to
+161
| sudo chmod -R 755 workspace/ || true | ||
| find workspace/*/imagebuild/*/ -name "*.raw*" -exec chmod 777 {} \; || true |
| - name: Set file permissions for artifacts | ||
| run: | | ||
| sudo chmod -R 755 workspace/ || true | ||
| find workspace/*/imagebuild/*/ -name "*.raw*" -exec chmod 777 {} \; || true |
Comment on lines
+160
to
+161
| sudo chmod -R 755 workspace/ || true | ||
| find workspace/*/imagebuild/*/ -name "*.raw*" -exec chmod 777 {} \; || true |
| - name: Set file permissions for artifacts | ||
| run: | | ||
| sudo chmod -R 755 workspace/ || true | ||
| find workspace/*/imagebuild/*/ -name "*.raw*" -exec chmod 777 {} \; || true |
Comment on lines
+160
to
+161
| sudo chmod -R 755 workspace/ || true | ||
| find workspace/*/imagebuild/*/ -name "*.raw*" -exec chmod 777 {} \; || true |
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.
Merge Checklist
All boxes should be checked before merging the PR
Description
Any Newly Introduced Dependencies
How Has This Been Tested?