Integrating Droidspaces natively into Android's init.rc allows for Daemon Mode at the deepest level. This enables containers to start independently of the userspace app, facilitates auto-start on boot, and ensures your containers remain persistent (unkillable by Android's OOM killer - auto-spawn if killed).
- Tooling: You must use Android_Image_Tools to unpack/repack your
vendor.img. - AVB/dm-verity: You must disable AVB (Android Verified Boot) to boot a modified vendor image. This typically involves removing
avbflags from yourfstab(inbootorvendor_bootramdisk). - Preparation: Ensure a pure, repacked
vendor.img(unpacked and repacked without changes) boots successfully before attempting modifications.
Choose one of the following methods based on your preference for flexibility vs. self-containment.
This method creates a symlink at /vendor/bin/droidspaces pointing to /data/local/Droidspaces/bin/droidspaces. This is highly recommended as it allows you to update the droidspaces binary via the app without re-flashing your vendor.img.
- Unpack
vendor.imgusing the image tools. - Configure Symlink:
- Navigate to the
.repack_infohidden folder in your unpacked output. - Append the contents of symlink-configuration/symlink_info.txt to the existing
symlink_info.txt. - Append the contents of symlink-configuration/fs-config.txt to the existing
fs-config.txt. - Append the contents of symlink-configuration/file_contexts.txt to the existing
file_contexts.txt.
- Navigate to the
- Apply SELinux Policy:
- Append the contents of symlink-configuration/droidspaces_symlink.cil to your
<Unpacked folder>/etc/selinux/vendor_sepolicy.cil.
- Append the contents of symlink-configuration/droidspaces_symlink.cil to your
This method places the raw droidspaces binary directly into the /vendor partition. It is more self-contained but requires a re-flash for binary updates.
- Unpack
vendor.img. - Move Binary: Copy the
droidspacesbinary (arm64 static) to<Unpacked folder>/vendor/bin/droidspaces. - Configure Permissions:
- Navigate to the
.repack_infohidden folder. - Append the contents of binary-configuration/fs-config.txt to
fs-config.txt. - Append the contents of binary-configuration/file_contexts.txt to
file_contexts.txt.
- Navigate to the
- Apply SELinux Policy:
- Append the contents of binary-configuration/droidspaces_binary.cil to your
<Unpacked folder>/etc/selinux/vendor_sepolicy.cil.
- Append the contents of binary-configuration/droidspaces_binary.cil to your
Regardless of the method chosen above, you must perform these steps to register the service:
- Register Init Script:
Copy init.droidspaces.rc to
<Unpacked folder>/etc/init/. - Add Autoboot Script:
Copy droidspaces_autoboot.sh to
<Unpacked folder>/vendor/bin/. - Repack & Flash:
Repack the
vendor.imgusing the image tool and flash it via fastboot:fastboot flash vendor vendor.img
Important
Filesystem Consistency: Always repack using the same filesystem type as the original image (check using file vendor.img).
-
Silencing SELinux Spam (Highly Recommended): While not strictly necessary for functionality, we strongly recommend applying the rules in selinux-testing/ds_log_spam_fix.cil.
- Benefit: This reduces approximately 90% of AVC denials caused by Droidspaces in your
dmesg, keeping your system logs clean. - Risk: As detailed below, applying this file is the most common cause of bootloops if your host SELinux policy lacks certain domains.
- Benefit: This reduces approximately 90% of AVC denials caused by Droidspaces in your
-
Verification: Once booted, verify that the Droidspaces service is active:
getprop init.svc.droidspacesd
-
Bootloops: If the device bootloops after modification, there is a 90% probability it is caused by the
ds_log_spam_fix.cilfile. This occurs when a domain defined in our CIL is not found in your host's SELinux policy, triggering a kernel panic during boot.- How to Fix: Capture the boot logs. The
secilc(SELinux CIL Compiler) binary will typically point to the exact line number causing the error. Remove the faulty line from the CIL file, repack, and try again until the device boots successfully. - Logs: If you can't get a live serial log, pull
/proc/last_kmesgorconsole-ramoopsafter the crash to inspect the panic.
- How to Fix: Capture the boot logs. The