Skip to content

Fix broken arm64 builds#566

Open
srmungar wants to merge 14 commits into
mainfrom
fix-broken-arm64-builds
Open

Fix broken arm64 builds#566
srmungar wants to merge 14 commits into
mainfrom
fix-broken-arm64-builds

Conversation

@srmungar
Copy link
Copy Markdown
Contributor

Merge Checklist

All boxes should be checked before merging the PR

  • The changes in the PR have been built and tested
  • Documentation has been updated to reflect the changes (or no doc update needed)
  • Ready to merge

Description

Any Newly Introduced Dependencies

How Has This Been Tested?

Copilot AI review requested due to automatic review settings May 17, 2026 17:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-aarch64 binfmt 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
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