Skip to content

Fix ARMHF launch on SpruceOS for Miyoo Flip - #25

Merged
Producdevity merged 4 commits into
masterfrom
fix/spruce-armhf-runtime
Aug 29, 2026
Merged

Fix ARMHF launch on SpruceOS for Miyoo Flip#25
Producdevity merged 4 commits into
masterfrom
fix/spruce-armhf-runtime

Conversation

@Producdevity

@Producdevity Producdevity commented Aug 29, 2026

Copy link
Copy Markdown
Owner

CODBOZ ships ARMHF binaries, but SpruceOS on the Miyoo Flip is aarch64 and does not expose the interpreter path requested by those binaries. First-run setup therefore failed when it tried to start the APK extractor.

This uses the ARMHF compatibility runtime already mounted by SpruceOS for both the extractor and the game loader. Spruce's kmsdrm display is routed through the existing SDL window path. Systems with the standard ARMHF interpreter keep their normal launch path.

Testing

  • make shellcheck
  • make test-host
  • make test-host-sanitize
  • scripts/build-docker.sh
  • unzip -t build/codboz.zip
  • completed a fresh setup on a Miyoo Flip running SpruceOS
  • verified the main menu rendered and exiting returned to the Ports frontend
  • verified a normal frontend launch and clean exit on [MuOS or KNULLI]

Summary by cubic

Fixes ARMHF binary launch on SpruceOS for the Miyoo Flip. First-run setup previously failed on the aarch64 system because the ARMHF interpreter path wasn't exposed; now the extractor and game loader run through the ARMHF compatibility runtime SpruceOS already mounts, while systems with a native interpreter keep their normal launch path. Setup failure now logs the error and calls pm_finish instead of showing an error dialog.

What changed

  • Adds codboz_runtime.sh, which execs directly when a native interpreter exists, otherwise runs the target through the Spruce ARMHF runtime.
  • Routes the APK extractor and game launcher through the runtime helper, setting SDL_VIDEODRIVER=kmsdrm only on the Spruce path.
  • Packages codboz_runtime.sh in deploy and checks for it at launch.
  • Treats SDL_VIDEODRIVER=kmsdrm as a signal to use the SDL window surface in the EGL display fallback.
  • Expands launcher tests to cover runtime loading, fallback behavior, setup failure cleanup, and patching.

Written for commit 63fd5bb. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added automatic ARMHF runtime support for launching the game across compatible environments.
    • Improved setup and deployment to include and validate required runtime components.
  • Bug Fixes

    • Improved setup failure handling with clearer error reporting and proper cleanup.
    • Improved display detection when SDL’s KMSDRM driver is selected, supporting more graphics configurations.
  • Tests

    • Added coverage for runtime loading, fallback behavior, setup failures, deployment, and patching workflows.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 45 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 753949bd-105b-44f7-ad50-25407ab5f746

📥 Commits

Reviewing files that changed from the base of the PR and between a626eac and 63fd5bb.

📒 Files selected for processing (1)
  • tests/portmaster_launcher_test.sh

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 54b4ee3a-526d-43e1-801e-b73d688a7ed3

📥 Commits

Reviewing files that changed from the base of the PR and between b16f013 and a626eac.

📒 Files selected for processing (4)
  • packaging/ports/codboz/CODBOZ.sh
  • packaging/ports/codboz/codboz/codboz_runtime.sh
  • src/s3e_egl.c
  • tests/portmaster_launcher_test.sh

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The change adds an ARMHF runtime helper to Codboz setup, startup, deployment, and tests. It also updates EGL display ownership detection to recognize SDL_VIDEODRIVER and revises related messages.

Changes

Codboz ARMHF runtime

Layer / File(s) Summary
ARMHF runtime resolution
packaging/ports/codboz/codboz/codboz_runtime.sh
The helper validates arguments, selects the system or SpruceOS ARMHF loader, invokes the loader with its library path, and falls back to direct execution.
Launcher and setup integration
packaging/ports/codboz/CODBOZ.sh, packaging/ports/codboz/codboz/codboz_setup
The launcher requires the helper and uses it for game startup, APK extraction, and CDN lookup. Setup failure handling now calls pm_finish.
Runtime deployment
scripts/deploy.sh
Deployment validates, transfers, installs, and assigns permissions to codboz_runtime.sh.
Runtime and launcher validation
tests/portmaster_launcher_test.sh
Tests cover direct execution, loader fallback, missing defaults, patcher execution, and pm_finish recording.

SDL display ownership

Layer / File(s) Summary
SDL display ownership detection
src/s3e_egl.c
The ownership helper now recognizes SDL_VIDEODRIVER=kmsdrm. SDL-related error and log messages were updated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to a626e

On SpruceOS devices without a native ARMHF interpreter, Codboz now relies on the OS-mounted compatibility runtime for setup and gameplay; if that runtime is missing, misconfigured, or not trusted, launch can fail or use unintended local components. The PR is mergeable with explicit owner awareness to document and verify that platform guarantee.

Sequence Diagram(s)

sequenceDiagram
  participant Launcher
  participant codboz_runtime.sh
  participant ARMHFLoader
  participant Game
  Launcher->>codboz_runtime.sh: Start game with arguments
  codboz_runtime.sh->>ARMHFLoader: Select loader and pass library path
  ARMHFLoader->>Game: Start game
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing ARMHF launch on SpruceOS for the Miyoo Flip.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/spruce-armhf-runtime

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tests/portmaster_launcher_test.sh Outdated
Comment thread src/s3e_egl.c Outdated
Comment thread packaging/ports/codboz/CODBOZ.sh Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/s3e_egl.c
Comment thread tests/portmaster_launcher_test.sh Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/portmaster_launcher_test.sh">

<violation number="1" location="tests/portmaster_launcher_test.sh:68">
P3: The assertion `test_runtime_resolved="$(realpath "$test_runtime")"` uses a bare `realpath` under `set -e`, while `run_with_runtime` resolves the same directory with a `realpath || readlink -f || printf` fallback chain. On hosts without `realpath` the test aborts with command not found rather than matching the code's actual resolution. Derive the expected value from the same fallback chain (or export it from `run_with_runtime`) and redirect stderr so the test stays in sync with the script's path resolution.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread tests/portmaster_launcher_test.sh Outdated
@Producdevity
Producdevity merged commit 3b444d6 into master Aug 29, 2026
5 checks passed
@Producdevity
Producdevity deleted the fix/spruce-armhf-runtime branch August 29, 2026 11:31
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.

1 participant