Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attention on /proc folder and /dev/shm #67

Open
JanuszChmiel opened this issue Jun 25, 2020 · 4 comments
Open

Attention on /proc folder and /dev/shm #67

JanuszChmiel opened this issue Jun 25, 2020 · 4 comments

Comments

@JanuszChmiel
Copy link

Yours script is excellent. Unfortunately it do not contain important code, which makes installed Debian system less usable than ArchLinux. I have found very useful line from The startarch script from MR Rausty. The aim of his command is to use /dev/shem to allow used shared memory by special native .so library and by mounting /proc folder on Android 8 and newer.

exec proot --kill-on-exit --link2symlink -0 -r /data/data/com.termux/files/home/arch -b /data/data/com.termux/files/home/arch/tmp:/dev/shm -b /data/data/com.termux/files/home/arch/var/binds/fbindprocstat:/proc/stat -b /proc/self/fd/1:/dev/stdout -b /proc/self/fd/2:/dev/stderr -b "$ANDROID_DATA" -b /dev/ -b "$EXTERNAL_STORAGE" -b "$HOME" -b /proc/ -b /storage/ -b /sys/ -w "$PWD" /usr/bin/env -i HOME=/root TERM=xterm /bin/bash -l ||:
Do you think, that some part of The Archlinux starting command could be incorporated to yours script to allow users to acces /proc folder also on Android 8 and newer and to allow them to use shared memory?
There are currently two libraryes to support shared memory on Android, thus none of them is A full replacement for standard Linux memory sharing. Because if .C code of The library access some files to emulate shared memory, if app calls too many request related to shared memory access, device drivers which acces file storage chip have no chance to have The equal speed like direct memory access.
Gnuroot debian contain compiled .so library for shared memory. Its source code is here.
https://github.com/pelya/android-shmem

Termux programmers have used tis code to develop their own release of Android-shmem.so but their library is only for Termux. It do not use file handles to emulate shared memory, so it is much more faster and much more reliable. Unfortunately, it is compatible only with Termux, so it would very probably crash on Debian.
Android-shmem.so from Pelia can be loaded by adding The following line at The end of /etc/profile Bash script file.
export LD_PRELOAD=/data/data/com.termux/files/home/ubuntu-fs/usr/lib/libandroid-shmem.so
Sure, folder have been assigned for Ubuntu, not for Debian installed by using yorus script.
Shared memory has also last approach for Android.
Approach, which have been used by Userland developers.
They are using memalloc.so and other .so files, I do not know, which .so file emulate shared memory while using their project. But their approach is fast but produces also crashes.
X11vnc and xinit Xorg is incompatible. Very probably, also their .so library uses file handles.
Recoding android-shmem for Termux to be compatible with various Linux distros is very probably heavy task for very experienced C programmers. And I even do not know, if is it possible or no.

@Dmole
Copy link
Collaborator

Dmole commented Jun 25, 2020

What is the use case for shared memory?

proot ... -b /data/data/com.termux/files/home/arch/tmp:/dev/shm

how is arch/tmp made?

mounting /proc

proc is already mounted;
#53 (comment)

@JanuszChmiel
Copy link
Author

JanuszChmiel commented Jun 26, 2020 via email

@JanuszChmiel
Copy link
Author

JanuszChmiel commented Jun 26, 2020 via email

@JanuszChmiel
Copy link
Author

JanuszChmiel commented Jun 26, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants