- proot (Termux's, external/proot) and its loader built with the NDK for each ABI by native-proot/build.sh (talloc fetched and checked by SHA-256, built as one file), run by Gradle before each build and packaged as libproot.so and libproot-loader.so: extracted on install, in the native library directory, the one place Android 10 on lets an app run its own programs - LinuxSystem: Alpine's minimal root file system for the phone's ABI, found in Alpine's release list, downloaded with its SHA-256 checked, unpacked (Tar: ustar, pax and GNU names, links and modes, nothing written outside it, removed without following links), set up (the phone's name servers, a prompt) and run as root with proot: the device's /dev, /proc and /sys, made-up /proc files for those Android hides, hard links as proot's link2symlink, and the phone's shared storage at /sdcard when the app has "all files access" - Settings, Linux: install (it goes on while the user moves about the app), size, open a shell, remove; the storage permission; the terminal's menu offers "New Linux shell (Alpine)", installing first when it isn't there - Hang-up sent again shortly after the first, for a job the shell was forking as it went (found by the tests) - Tests on the host: proot built by the same script, Alpine downloaded: a root shell, the storage both ways, the window's size, hard links, apk installing a package and running it, removal leaving the storage; the tar reader against GNU and pax tars and ones made to escape; the app installing it from Settings and opening its shell. CI installs gawk and mksh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
1.3 KiB
proot for the local terminal's Linux
build.sh builds Termux's proot
(external/proot, a submodule pinned to a commit) and its loader, with
talloc 2.4.2 (downloaded from samba.org and
checked against its SHA-256), for each Android ABI with the NDK, or for the
host (the unit tests). Gradle runs it (:app:buildProot) before each build.
The outputs are programs named libproot.so and libproot-loader.so, so
that Android installs them in the app's native library directory: from
Android 10 on, an app can run its own programs only from there (not from
its data directory). proot runs the Linux system's programs through the
loader, which maps them into memory rather than executing them.
Needs: a C compiler (the NDK's for Android), make, GNU awk (gawk) and curl.
talloc-shim/replace.h stands in for the part of Samba's lib/replace that
talloc.c uses, so that talloc builds as one file without Samba's waf.
The build copies proot's source tree and adds #include <string.h> to
extension/ashmem_memfd/ashmem_memfd.c, which needs it and doesn't include
it (an error with clang). The submodule itself is left as it is.
Licences: proot is GPL-2.0-or-later, talloc LGPL-3.0-or-later; their sources are the submodule and the pinned tarball named above.