Skip to content

Commit f7357bd

Browse files
feat: Add android-shmem to LD_PRELOAD
1 parent 4aa5693 commit f7357bd

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
DIE() { echo -e "${@}"; exit 1 ;:;}
44
GWARN() { echo -e "\e[90m${*}\e[0m";:;}
55

6-
apt install -y jq wget proot pv pulseaudio
6+
apt install -y jq wget proot pv pulseaudio libandroid-shmem-static
77
[[ ! -d udroid/src ]] && {
88
echo "udroid/src not found"
99
exit 1

udroid/src/proot-utils/proot-fixes.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,13 @@ while read -r group_name group_id; do
313313
fi
314314
done < <(paste <(id -Gn | tr ' ' '\n') <(id -G | tr ' ' '\n'))
315315

316+
PROG_PRINT "setting up android shmem"
317+
shmem_lib="${PREFIX}/usr/lib/libandroid-shmem.a"
318+
if [ -f "${shmem_lib}" ]; then
319+
PROG_PRINT "copying android shmem library"
320+
cp "${shmem_lib}" "${root_fs_path}/usr/lib/"
321+
fi
322+
316323
# ## android GID
317324
# # a list of all android groups
318325
# AID_GROUPS="aid_ROOT:0

udroid/src/udroid.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ login() {
280280
local no_cwd_active_directory=false
281281
local no_cap_last_cap=false
282282
local no_pulseserver=false
283+
local no_android_shmem=false
283284
local no_fake_root_id=false
284285
local fix_low_ports=false
285286
local make_host_tmp_shared=true # its better to run with shared tmp
@@ -366,6 +367,9 @@ login() {
366367
--no-pulseserver)
367368
no_pulseserver=true; shift
368369
;;
370+
--no-android-shmem)
371+
no_android_shmem=true; shift
372+
;;
369373
--no-kill-on-exit)
370374
no_kill_on_exit=true; shift
371375
;;
@@ -448,6 +452,14 @@ login() {
448452
"TERM=${TERM-xterm-256color}" \
449453
"$@"
450454

455+
# set LD_PRELOAD to libandroid-shmem.a
456+
if ! $no_android_shmem; then
457+
shmem_lib_path="${root_fs_path}/lib/libandroid-shmem.a"
458+
[[ -f "$shmem_lib_path" ]] && {
459+
set -- "LD_PRELOAD=$shmem_lib_path" "$@"
460+
}
461+
fi
462+
451463
# set --rootfs
452464
set -- "--rootfs=${root_fs_path}" "$@"
453465

0 commit comments

Comments
 (0)