feat: add distro-agnostic PRoot/Chroot support for 39-bit Android#5
Conversation
|
Thanks for the PR! This is a huge help. Could you rebase your branch on Also, I'd like to tweak the architecture a bit to keep the release archive clean. Instead of packaging a
This keeps the standalone footprint limited strictly to Let me know if you want me to drop in the C/Bash code snippets to handle the hex-conversion and runtime unpacking, happy to help! |
|
@estiaksoyeb I realized that what i was suggesting was a very specific thing, so I'm going to push those changes to this PR if that is okay with you. |
f3a1384 to
929c5bd
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a runtime mmap interposer and updates the bootstrap/build flow to improve Antigravity CLI compatibility in Ubuntu/Debian chroot or proot environments on Android 39-bit VA kernels.
Changes:
- Adds a
mmapinterposer shared library and embeds it into the launcher at build time. - Updates
agy_helper.cto detect Termux vs chroot, unpack/preload the interposer, and adjust loader/library/certificate paths. - Updates docs, README, gitignore, and PR validation workflow to account for generated transient artifacts.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Documents the new chroot/proot compatibility architecture and embedded interposer flow. |
lib/mmap_va39_fix.c |
Adds the runtime mmap interposer for clearing high VA hint addresses. |
lib/agy_helper.c |
Adds environment detection, interposer unpacking, preload injection, and chroot path handling. |
docs/UBUNTU_CHROOT_COMPAT.md |
Adds technical documentation for the compatibility layer. |
build.sh |
Builds the interposer, generates the embedded byte header, and compiles the launcher with it. |
.gitignore |
Ignores generated interposer build artifacts. |
.github/workflows/pr-check.yml |
Generates transient headers for lint/static-analysis jobs and updates strict compile checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks, appreciate it! I was planning to rebase anyway since the recent changes caused some conflicts on my side. But you did great work implementing the architecture changes directly in this PR. |
|
@estiaksoyeb CI has produced this artifact gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/wallentx/antigravity-cli-termux/actions/artifacts/7257053241/zip > artifact.zipOr curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-o artifact.zip \
"https://api.github.com/repos/wallentx/antigravity-cli-termux/actions/artifacts/7257053241/zip" |
|
I tried in my Arch proot, and got: But agy.va39 worked fine. I'm not sure if this is accidental or if I mixed up something. Will review later this evening |
Signed-off-by: wallentx <william.allentx@gmail.com>
Signed-off-by: wallentx <william.allentx@gmail.com>
|
Nice! This now works in my Arch proot distro too.
|
This PR addresses a critical "Out of Memory" crash (
MmapAligned() failed) encounteredwhen running the Antigravity CLI in non-Termux environments on Android, such as Ubuntu
chroots (Proot/Chroot).
The Problem:
The upstream binary uses TCMalloc, which assumes a 48-bit Virtual Address (VA) space.
Most ARM64 Android kernels are limited to a 39-bit VA space. While the current Python
binary patch helps, it is often insufficient for early-stage allocations in certain
environments, and the current C bootstrapper is hardcoded specifically for Termux-only
file paths.
The Solution:
I have implemented a robust Runtime Mmap Interposer and an Environment-Aware
Bootstrapper.
1. Dynamic Memory Redirection (
lib/mmap_va39_fix.c)mmapcalls at runtime.2^39) and clears it.preventing the TCMalloc abort.
2. Smart Bootstrapper (
lib/agy_helper.c)or a standard Linux chroot (Ubuntu/Debian).
(
/lib/ld-linux-aarch64.so.1) and SSL certificates(
/etc/ssl/certs/ca-certificates.crt) based on the detected environment.--preloadflag.3. CI/CD & Build Updates:
build.shnow compiles the compatibility library as a shared object.lib/directory into the standalonerelease.
Verification Results:
Tested on an ARM64 Android device (Kernel 5.4) across two environments:
LD_PRELOADmanual intervention.Files Changed:
lib/mmap_va39_fix.c(New)lib/agy_helper.c(Updated)build.sh(Updated).github/workflows/auto-sync-release.yml(Updated)UBUNTU_CHROOT_COMPAT.md(Technical Documentation)