theme: override: footer: style: template center: "Enable Linux Power with Android" right: "{current_slide} / {total_slides}"
Andriod
Android is a kind of Linux with google magic
- termux - an Android terminal emulator and Linux environment app
- scrcpy - "screen copy" mirrors Android devices
- scrcpy desktop
- waydriod - android container
https://gs.statcounter.com/os-market-share
Android parts
- Android 啟動過程 - init 進程 https://hackmd.io/pJpAeKAeRea0VIW3oI-mXw?view
- https://hackmd.io/@AlienHackMd/BkvyAzNf9
- The Generic Kernel Image (GKI) project
- kernel module interface (KMI)
- bionic libc (native part) - ndk
- BSD license / Small size / Speed
- android runtime (java part) - sdk
- adb (android debug bridge) shell
termux
- termux-emulator
- with function key keyboard
- as desktop via scrcpy
- Linux environment
- as personal edge server
- with multi-sensors / phone functions
- termux-api
- androud call termux
- termux-tasker
- near 24/7 online
- with multi-sensors / phone functions
- powerful device
- gpu https://blog.csdn.net/Billhe_zju/article/details/122706171
- docker / podman container (not real ready)
- run in qemu
- podman machine (not yet)
- native docker/podman/lxc (need root)
- (-) as kubeedge node
- as personal edge server
- install from github or f-driod (*)
Termux Google Play
https://wiki.termux.com/wiki/Termux_Google_Play https://github.com/termux/termux-app/issues/1072
- If Termux application was built with target SDK level "29" (Android 10) or higher, it will be eligible for SELinux restriction of execve() system call on data files.
- That makes impossible to run package executables such as "apt", "bash" and others located in the application's writable directory such as $PREFIX.
termux application (main parts)
- single user
- native (bionic libc)
- terminal-emulator
- terminal-shared
- shell
- socket
- am (Activity Manager)
- notification
- limited kernel function (w/o root)
- termux file system layout
- https://github.com/termux/termux-packages/wiki/Termux-file-system-layout
Termux Addons
https://wiki.termux.com/wiki/Addons
- Termux:API
- Access Android and Chrome hardware features.
- Termux:Boot
- Run script(s) when your device boots.
- Termux:Float
- Run Termux in a floating window.
- Termux:Styling
- Have color schemes and powerline-ready fonts customize the appearance of the Termux terminal.
- Termux:Tasker
- An easy way to call Termux executables from Tasker and compatible apps.
- Termux:Widget
- Start small scriptlets from the home screen.
termux fs layout
- Root directory | /data/data/com.termux/files/usr ${TERMUX_PREFIX} | |
${TERMUX_PREFIX}/bin | Executables used by shell. Combines /bin, /sbin, /usr/bin, /usr/sbin. | * |
${TERMUX_PREFIX}/etc | Configuration files. | |
${TERMUX_PREFIX}/include | headers | |
${TERMUX_PREFIX}/lib | Shared objects (libraries) | |
${TERMUX_PREFIX}/libexec | Executables which should not be run by user directly. | |
${TERMUX_PREFIX}/opt | Installation root for sideloaded packages. | |
${TERMUX_PREFIX}/share | Non-executable runtime data and documentation. | |
${TERMUX_PREFIX}/tmp | Temporary files. Combines /tmp and /var/tmp. Can be freely modified by user. | |
${TERMUX_PREFIX}/var | such as caches and databases. Can be modified by user, but with additional care. | |
${TERMUX_PREFIX}/var/run | Lock, PID, sockets and other temporary files created by daemons. Replaces /run. | |
- Home directory | /data/data/com.termux/files/home ${HOME} |
termux packages
- format - binary deb packages
- package manager: pkg / apt
- single source repo: https://github.com/termux/termux-packages
- native (bionic libc)
- repos / mirrors:
- termux
- termux-root
- termux-x11
- tut (others)
edge server
- termux-service / runit
- https://github.com/termux/termux-services
- SVDIR: /data/data/com.termux/files/usr/var/service
- $ tail -f ../usr/var/log/sv/sshd/current
- termux-boot
- https://github.com/termux/termux-boot
- allowing programs to be run at boot.
- termux-wake-lock
termux useful services
- ngrok - Ingress Platform
- ssh
- single user / id
- disbale password login
- openvpn (via android app)
cli / tui - old school but awesome
- colorful
- auto complete
- animation
- cli / tui framework
- http config
termux-setup-storage
https://wiki.termux.com/wiki/Internal_and_external_storage
Executing termux-setup-storage ensures:
That permission to shared storage is granted to Termux when running on Android 6.0 or later. That an app-private folder on external storage is created (if external storage exists). That a folder $HOME/storage is created.
proot: An chroot-like implementation using ptrace.
- General usage information
- unset LD_PRELOAD - Termux-exec, execve() hook, conflicts with PRoot.
- -r ./rootfs - option to specify the rootfs where Linux distribution was installed.
- -0 - tells PRoot to simulate a root user which expected to be always available in Linux distributions. This option will allow you to use package manager.
- -b /dev -b /proc -b /sys - make file systems at /dev, /proc, /sys appear in the rootfs. These 3 bindings are important and used by variety of utilities.
- /bin/sh - a program that should be executed inside the rootfs. Typically a shell.
- other forks
- AnLinux
- UserLand
proot-disto git@github.com:termux/proot-distro.git
proot-distro install debian
proot-distro login debian
`
- ubuntu / redhat
- nix
qemu
qemu-system-aarch64-headless
termux api
- termux-sms-send
$ termux-battery-status
{
"health": "GOOD",
"percentage": 27,
"plugged": "UNPLUGGED",
"status": "DISCHARGING",
"temperature": 35.099998474121094,
"current": -1780000
}
GUI
Termux:GUI
- Official
- Python
- C/C++
- Bash
- Community
- Rust
https://github.com/termux/termux-gui
- enables command line programs to use the native android GUI.
Termux:x11
- A Termux X11 server add-on app.
https://github.com/termux/termux-x11
termux am
- https://github.com/termux/TermuxAm
- https://github.com/termux/termux-am-socket
build app in termux
https://sdrausty.github.io/docsBuildAPKs/ https://gist.github.com/tmatz/817bf03433e059bf89c63dc33f286ccb
https://wiki.termux.com/wiki/Development_Environments
termux-rust / android rust
Tier 2 with Host Tools
Tier 2 without Host Tools
- aarch64-linux-android
- x86_64-linux-android
https://doc.rust-lang.org/nightly/rustc/platform-support.html https://doc.rust-lang.org/nightly/rustc/platform-support/android.html https://www.youtube.com/watch?v=gUz4thxBuTs https://android.googlesource.com/toolchain/android_rust/
termux-docker
- kind of
docker run -it termux/termux-docker:latest
docker run --rm --privileged aptman/qus -s -- -p aarch64 arm
docker run -it --privileged termux/termux-docker:aarch64
https://github.com/termux/termux-docker/blob/master/Dockerfile
FROM scratch AS bootstrap
...
ADD https://github.com/termux/termux-packages/releases/download/bootstrap-$BOOTSTRAP_VERSION/bootstrap-$BOOTSTRAP_ARCH.zip /bootstrap.zip
scrcpy
- audio forwarding (Android 11+)
- recording
- mirroring with Android device screen off
- copy-paste in both directions
- configurable quality
- camera mirroring (Android 12+)
- mirroring as a webcam (V4L2) (Linux-only)
- physical keyboard and mouse simulation (HID)
- OTG mode
- and more…
android desktop
-
samsung dex / moto ready for
- Linux on DeX (dead)
-
desktop mode / android 15
-
desktop launcher
- Taskbar
- https://github.com/axel358/smartdock
scrcpy-desktop
-
https://github.com/nikp123/scrcpy-desktop
-
adb shell settings put global overlay_display_devices $TARGET_DISPLAY_MODE
-
scrcpy --display-id $display -w -S -K &
waydroid
- Waydroid uses Linux namespaces to run a full Android system in a container (LXC) on any GNU/Linux-based platform.
- The Android inside the container has direct access to the needed hardware.