Last Update: 04.11.2026/bs
| Action |
Default directories |
Comment |
| mount |
directories listed in the environment
variable DIRS_TO_OVERLAY |
use the action mount_existing to only
mount the existing overlay filesystems on a virtual disk use the action mount_only to only mount the virtual disk without creating the overlay mounts |
| diff |
directories listed in the environment
variable DIRS_TO_OVERLAY |
the action is done regardless of the mount
status of the directories use the option --active to process only the mounted overlay filesystems |
| undo |
directories listed in the environment
variable DIRS_TO_OVERLAY |
the action is done regardless of the mount
status of the directories use the option --active to process only the mounted overlay filesystems |
| test |
directories currently mounted with an overlay
filesystem |
|
| umount |
directories currently mounted with an overlay filesystem | |
| remount |
directories currently mounted with an overlay filesystem | |
| get |
directories listed in the environment variable DIRS_TO_OVERLAY | use the option --active to process
only the mounted overlay filesystems This action can also be used for files. |
| Variable |
Usage |
Default value |
Comment |
| IMAGE_FILE | file used for the virtual disk |
/data/local/tmp/image001 |
The value of this variable is ignored if the
${BASEDIR} is already mounted to a virtual disk |
| BASEDIR | the mount point for the virtual disk | /dev/ov |
the parent directory for this directory (/dev
in the default config) must be readable and executable by
any user |
| DIRS_TO_OVERLAY | the directories for which the script creates an overlay mount | /system_ext /product /odm /system |
|
| FILESYSTEM_TO_USE | the filesystem used on the virtual disk |
ext4 |
This must be a filesystem known by the
running Android that supports overlay mounts (e.g. ext4
or ext3) The parameter is only used when creating a new filesystem on the virtual disk. |
| FILESYSTEM_SIZE | the size of the virtual disk | 100m |
the value can be any value that is known by
the binary dd for the parameter bs (see the
output of "dd --help") The variable is only used when the virtual disk is created. |
| MKFS_OPTIONS | additional options for the mkfs* command to create the filesystem on the loop device | The variable is only used when the virtual
disk is created. set this variable to "none" to execute mkfs without options |
|
| MOUNT_OPTIONS | additional options for the mount command to mount the filesystem on the loop device | set this variable to "none" to execute mount without options | |
| SELINUX_CONTEXT | the SELinux context used for new directories if the script can not read the SELinux context of an existing directory | u:object_r:system_file:s0 |
|
| MOUNT |
mount executable to use |
$( which mount ) |
|
| UMOUNT |
umount executable to use | $( which umount ) | |
| LOSETUP |
losetup executable to use | $( which losetup ) | |
| MKFS |
mkfs executable to use | $( which mkfs.${FILESYSTEM_TO_USE} ) | |
| DD |
dd executable to use | $( which dd ) | |
| UMOUNT_WAIT_TIME |
time in seconds to wait between umounting the
bind mounts and umounting the overlay mounts |
0 |
in some Android versions it's necessary to
wait some time between umounting the bind mount andumounting
the overlay mount. Set this variable to the number of
seconds the script should wait between these umounts. |
| BIND_MOUNT_TARGET_DIR |
target directory for bind mounts for the
files listed in the variable FILES_TO_KEEP |
/data/local/tmp |
see using Magisk and overlay mounts in parallel |
| FILES_TO_KEEP |
list of files for which a bind mount shoud be
created |
see using Magisk and overlay mounts in parallel | |
| DIFF |
diff executable to use |
$( which diff ) |
|
| DIFF_OPTIONS |
options for the diff command | -o |
set this variable to "none" to execute diff
without options |
| TMPMOUNT_OPTIONS |
mount options for the temporary mounts for
the devices with the original directories |
"-o ro" for read-only mounted filesystems and "-o rw" for read-write mounted filesystesms |
In Android the mount options for rw or ro for
a second mount to a device must match the mount options for
the first mount |
| USER_RESPONSE |
this is the default value for the questions
for confirmation |
the known values for this variable are "yes"
or "no" The parameter --yes and --no overwrite the value of this variable |
| Rule |
Example |
| filenames without a slash are searched in the directory "/system/bin" | bash -> /system/bin/bash |
| filenames starting with "bin/" are searched in the directory "/system" | bin/sh -> /system/bin/sh |
| filenames starting with "./" are searched in the directory "/system" | /etc/ssh/sshd_config -> /system/etc/ssh/sshd_config |
| fully qualified names are searched in "/" | /system_ext/bin/rsync -> /system_ext/bin/rsync |
All files in other directories than /system must be
specified with fully qualified directory name.
The script create_overlay_mount.sh only creates bind
mounts for files in a directory for which an overlay mount should
be created. Other entries in the variable FILES_TO_KEEP
are silently ignored
| Environment variable |
Default Value |
Comment |
| HOME |
/data/local/tmp/home/$( id -un ) |
the variable is also set to the default value
if the value is "/" The home directory is created by the script prepare_clang21_environment if it does not yet exist |
| TMPDIR |
/data/local/tmp |
|
| TERMINFO |
/system/etc/terminfo |
the terminfo database is part of the virtual
disk |
| TERM |
vt100 |
|
| SSL_CERT_DIR |
/system/etc/security/cacerts |
|
| SSL_CERT_FILE |
/data/local/tmp/home/ca-certificates.crt |
This file is created by the script
prepare_clang21_environment If the file does not exist the script uses the file /system/etc/security/ca-certificates.crt (That file is part of the virtual disk) |
| CLANG_VERSION |
21 |
|
| CLANG_DIR |
/system/usr/clang${CLANG_VERSION} |
|
| NDK_VERSION |
r29 |
|
| NDK_DIR |
/system/usr/ndk/${NDK_VERSION] |
|
| SYSROOT |
/system/usr/ndk/${NDK_VERSION]/toolchains/llvm/prebuilt/aarch64/sysroot |
|
| API |
31 |
|
| CPU_TYPE |
uname -m |
|
| TARGET_ROOT |
/data/local/tmp/develop/sysroot |
this variable can be used for the parameter
"--prefix" for the configure scripts. The environment variable is only defined if the directory exists (the directory is not created by the script) |
| CFLAGS, CPPFLAGS, CXXFLAGS, LDFLAGS |
mandatory values for using the clang compiler |
|
ASUS_I006D:/data/local/tmp/nano-8.6 # ls -ltr src/nano
-rwxr-xr-x 1 root root 3329704 2025-10-19 13:35 src/nano
ASUS_I006D:/data/local/tmp/nano-8.6 #
ASUS_I006D:/data/local/tmp/nano-8.6 # file src/nano
src/nano: ELF executable, 64-bit LSB arm64, static, for Android
31, built by NDK r29 (14206865), not stripped
ASUS_I006D:/data/local/tmp/nano-8.6 #
ASUS_I006D:/data/local/tmp/nano-8.6 # src/nano --version
GNU nano, version 8.6
(C) 2025 the Free Software Foundation and various
contributors
Compiled options: --disable-libmagic --disable-nls
--enable-utf8
ASUS_I006D:/data/local/tmp/nano-8.6 #
ASUS_I006D:/data/local/tmp/develop/nano-8.5 $ ls
-ltr src/nano
-rwxrwxrwx 1 shell shell 3394288 2025-07-11 13:51
src/nano
ASUS_I006D:/data/local/tmp/develop/nano-8.5 $
ASUS_I006D:/data/local/tmp/develop/nano-8.5 $ file
src/nano
src/nano: ELF executable, 64-bit LSB arm64, static, for
Android 31, built by NDK r27b (12297006), not stripped
ASUS_I006D:/data/local/tmp/develop/nano-8.5 $
ASUS_I006D:/data/local/tmp/develop/nano-8.5
$ src/nano --version
GNU nano, version 8.5
(C) 2025 the Free Software Foundation and various
contributors
Compiled options: --disable-libmagic
--disable-nls --enable-utf8
ASUS_I006D:/data/local/tmp/develop/nano-8.5 $