Skip to content

Commit

Permalink
update Android docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn111 committed Apr 28, 2024
1 parent 3bcf460 commit 97fbd43
Showing 1 changed file with 154 additions and 33 deletions.
187 changes: 154 additions & 33 deletions collections/android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ theme:

# Andriod


Android is Linux
Android is a kind of Linux with google magic
---

- termux - an Android terminal emulator and Linux environment app
Expand All @@ -30,7 +29,7 @@ https://gs.statcounter.com/os-market-share
-----
<!-- end_slide -->

# Android is Linux/bionic Distro
# Android parts

- Android 啟動過程 - init 進程 https://hackmd.io/pJpAeKAeRea0VIW3oI-mXw?view
- https://hackmd.io/@AlienHackMd/BkvyAzNf9
Expand All @@ -44,16 +43,39 @@ https://gs.statcounter.com/os-market-share
-----
<!-- end_slide -->

# termux

![https://pbs.twimg.com/media/EeDRB0aX0AMj5kh?format=jpg&name=large](termux-screenshot.jpg)


## termux

<!-- column_layout: [1, 2] -->

<!-- column: 0 -->
![https://pbs.twimg.com/media/EeDRB0aX0AMj5kh](termux-screenshot.jpg)
<!-- column: 1 -->

- 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
- 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

<!-- reset_layout -->

-----
<!-- end_slide -->

# termux application (main parts)
### termux application (main parts)

- single user
- native (bionic libc)
- terminal-emulator
Expand All @@ -62,6 +84,31 @@ https://gs.statcounter.com/os-market-share
- 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

-----
<!-- end_slide -->

### 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} | |


-----
<!-- end_slide -->
Expand All @@ -72,8 +119,6 @@ https://gs.statcounter.com/os-market-share
- package manager: pkg / apt
- single source repo: https://github.com/termux/termux-packages
- native (bionic libc)
- termux file system layout
- https://github.com/termux/termux-packages/wiki/Termux-file-system-layout
- repos / mirrors:
- termux
- termux-root
Expand All @@ -83,14 +128,67 @@ https://gs.statcounter.com/os-market-share
-----
<!-- end_slide -->

### 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


-----
<!-- end_slide -->

### termux useful services

- ngrok - Ingress Platform
- ssh
- single user / id
- disbale password login
- openvpn (via android app)


-----
<!-- end_slide -->

### cli / tui - old school but awesome

- colorful
- auto complete
- animation
- cli / tui framework
- http config

-----
<!-- end_slide -->

## termux-setup-storage


https://wiki.termux.com/wiki/Internal_and_external_storage

-----
<!-- end_slide -->

## 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

-----
<!-- end_slide -->

Expand All @@ -104,6 +202,12 @@ proot-distro login debian
- ubuntu / redhat
- nix
-----
<!-- end_slide -->
## qemu
qemu-system-aarch64-headless
-----
<!-- end_slide -->
Expand All @@ -112,10 +216,30 @@ proot-distro login debian
# termux api
- termux-sms-send
$ termux-battery-status
```
{
"health": "GOOD",
"percentage": 27,
"plugged": "UNPLUGGED",
"status": "DISCHARGING",
"temperature": 35.099998474121094,
"current": -1780000
}
```
-----
<!-- end_slide -->
Termux:GUI
# termux am
- https://github.com/termux/TermuxAm
- https://github.com/termux/termux-am-socket
-----
<!-- end_slide -->
### other plugins
- Termux:API
Expand Down Expand Up @@ -149,48 +273,42 @@ https://doc.rust-lang.org/nightly/rustc/platform-support.html
-----
<!-- end_slide -->
## termux-setup-storage
-----
<!-- end_slide -->
## termux-docker
## termux- services / runit
- kind of
```
pkg install termux-services
docker run -it termux/termux-docker:latest
```
-----
<!-- end_slide -->
## ssh
```
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

```
https://blog.csdn.net/Billhe_zju/article/details/122706171
-----
<!-- end_slide -->
## cli / tui - old school but fashion
## termux-x11
https://blog.csdn.net/Billhe_zju/article/details/122706171
-----
<!-- end_slide -->
## termux-docker
-----
<!-- end_slide -->
## scrcpy
-----
Expand All @@ -211,6 +329,9 @@ https://blog.csdn.net/Billhe_zju/article/details/122706171
<!-- end_slide -->
# waydroid
- Waydroid uses Linux namespaces to run a full Android system in a container on any GNU/Linux-based platform.
- The Android inside the container has direct access to the needed hardware.
LXC
Expand Down

0 comments on commit 97fbd43

Please sign in to comment.