Enable aarch64 cross-compilation for uConsole CM5 builds #15

Open
opened 2026-04-29 23:30:35 +00:00 by Hermes · 0 comments
Collaborator

Summary

To build and deploy NixOS configurations for the uConsole CM5 (ARM64/aarch64) from the x86_64 Hermes container, we need QEMU user-mode emulation with binfmt_misc support.

Problem

The Hermes Agent container runs on x86_64, but the uConsole CM5 uses an ARM64 processor. Cross-compilation requires:

  1. QEMU user-mode static binaries
  2. binfmt_misc kernel support
  3. Proper registration of ARM64 binary format handlers

Required Changes

Dockerfile (compose repo)

The following PRs add the necessary packages to the Hermes Agent image:

PR Packages URL
#10 qemu-user-static, binfmt-support, qemu-user-binfmt gortium/compose#10

Full dependency chain:

  • PR #7: curl, poppler-utils, imagemagick (base tools)
  • PR #8: chromium, xvfb, fonts (browser automation)
  • PR #9: texlive (LaTeX typesetting)
  • PR #10: qemu-user-static, binfmt-support, qemu-user-binfmt (cross-compilation)
  • PR #11: emacs-nox (editor)

All PRs are in: https://code.lazyworkhorse.net/gortium/compose/pulls/

Docker Compose Configuration

After merging the Dockerfile PRs, the compose stack needs to be rebuilt:

cd /opt/data/infra
sudo nixos-rebuild switch --flake .#lazyworkhorse

Verification

After deployment, verify cross-compilation works:

# Check QEMU binaries are available
docker exec hermes which qemu-aarch64-static

# Check binfmt_misc registration
docker exec hermes cat /proc/sys/fs/binfmt_misc/qemu-aarch64

# Test running ARM64 binary
docker exec hermes qemu-aarch64-static --version

Deployment Order

  1. Merge compose PRs (in order):

    • #7: Base tools
    • #8: Browser
    • #9: LaTeX
    • #10: QEMU (critical for this issue)
    • #11: Emacs
  2. Rebuild Hermes container:

    sudo nixos-rebuild switch --flake .#lazyworkhorse
    
  3. Verify cross-compilation:

    nix build .#nixosConfigurations.uConsole.config.system.build.toplevel
    

uConsole Configuration

  • PR #9: uConsole CM5 host configuration - #9

Compose Dockerfile PRs

Notes

  • QEMU cross-compilation will be slower than native builds
  • Alternative: Set up remote aarch64 builder for production deployments
  • For initial testing, QEMU emulation should be sufficient
## Summary To build and deploy NixOS configurations for the uConsole CM5 (ARM64/aarch64) from the x86_64 Hermes container, we need QEMU user-mode emulation with binfmt_misc support. ## Problem The Hermes Agent container runs on x86_64, but the uConsole CM5 uses an ARM64 processor. Cross-compilation requires: 1. QEMU user-mode static binaries 2. binfmt_misc kernel support 3. Proper registration of ARM64 binary format handlers ## Required Changes ### Dockerfile (compose repo) The following PRs add the necessary packages to the Hermes Agent image: | PR | Packages | URL | |----|----------|-----| | #10 | qemu-user-static, binfmt-support, qemu-user-binfmt | https://code.lazyworkhorse.net/gortium/compose/pulls/10 | **Full dependency chain:** - PR #7: curl, poppler-utils, imagemagick (base tools) - PR #8: chromium, xvfb, fonts (browser automation) - PR #9: texlive (LaTeX typesetting) - PR #10: qemu-user-static, binfmt-support, qemu-user-binfmt (cross-compilation) - PR #11: emacs-nox (editor) All PRs are in: https://code.lazyworkhorse.net/gortium/compose/pulls/ ### Docker Compose Configuration After merging the Dockerfile PRs, the compose stack needs to be rebuilt: ```bash cd /opt/data/infra sudo nixos-rebuild switch --flake .#lazyworkhorse ``` ### Verification After deployment, verify cross-compilation works: ```bash # Check QEMU binaries are available docker exec hermes which qemu-aarch64-static # Check binfmt_misc registration docker exec hermes cat /proc/sys/fs/binfmt_misc/qemu-aarch64 # Test running ARM64 binary docker exec hermes qemu-aarch64-static --version ``` ## Deployment Order 1. **Merge compose PRs** (in order): - [ ] #7: Base tools - [ ] #8: Browser - [ ] #9: LaTeX - [ ] #10: QEMU (critical for this issue) - [ ] #11: Emacs 2. **Rebuild Hermes container**: ```bash sudo nixos-rebuild switch --flake .#lazyworkhorse ``` 3. **Verify cross-compilation**: ```bash nix build .#nixosConfigurations.uConsole.config.system.build.toplevel ``` ## Related ### uConsole Configuration - PR #9: uConsole CM5 host configuration - https://code.lazyworkhorse.net/gortium/infra/pulls/9 ### Compose Dockerfile PRs - PR #7: https://code.lazyworkhorse.net/gortium/compose/pulls/7 - PR #8: https://code.lazyworkhorse.net/gortium/compose/pulls/8 - PR #9: https://code.lazyworkhorse.net/gortium/compose/pulls/9 - PR #10: https://code.lazyworkhorse.net/gortium/compose/pulls/10 (QEMU - key for this issue) - PR #11: https://code.lazyworkhorse.net/gortium/compose/pulls/11 ## Notes - QEMU cross-compilation will be slower than native builds - Alternative: Set up remote aarch64 builder for production deployments - For initial testing, QEMU emulation should be sufficient
gortium self-assigned this 2026-04-29 23:43:49 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gortium/infra#15
No description provided.