# Guide of Lindroid ## What is Lindroid? Lindroid is an Android app that lets you run Linux in a container, with support for hardware-acceleration. Official group: https://t.me/linux_on_droid ## How to Compile Lindroid? 1. Ensure your device has the necessary configurations: - Obtain a usable device configuration, kernel source, and ROM source code for your device. 2. Clone the necessary repositories [Linux-on-droid repository](https://github.com/Linux-on-droid): - Clone `vendor_lindroid` from to `$ANDROID_BUILD_TOP/vendor/lindroid`. - Clone `external_lxc` to `$ANDROID_BUILD_TOP/external/lxc`. - Clone `libhybris` (use the staging/lindroid-20 branch) to `$ANDROID_BUILD_TOP/libhybris`. - Cherry-pick or am/apply the patch from [this commit](https://github.com/Linux-on-droid/platform_system_core/commit/cb644190eeb9fefc3959a01dbdb83d89873e0b73) to `$ANDROID_BUILD_TOP/system/core`. 3. Modify device configurations: - Add `$(call inherit-product, vendor/lindroid/lindroid.mk)` to your device's mk file. - Add `BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive` or `BOARD_BOOTCONFIG += androidboot.selinux=permissive` for GKI devices to BoardConfig.mk. - Ensure SELinux is set to permissive mode for Lindroid. 4. Kernel configuration: - For non-GKI devices, refer to kernel configurations for enabling LXC/Docker support.(Search keywords 'lxc docker android' in GitHub) Make sure to add `CONFIG_VT=y`. - Example kernel configurations provided by Lindroid developers include: ``` +CONFIG_SYSVIPC=y +CONFIG_UTS_NS=y +CONFIG_PID_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_NET_NS=y +CONFIG_CGROUP_DEVICE=y +CONFIG_KERNEL_CGROUP_FREEZER=y (likely `CONFIG_CGROUP_FREEZER`) ``` - For GKI 5.10, refer to this [source](https://github.com/lateautumn233/Common-Android-Kernel-Tree/tree/lxc) and ensure `CONFIG_VT=y`. For 5.15 and 6.1, explore the configurations accordingly. - I recommend that compile KernelSU simultaneously for root access (use v0.9.5 tag for non-GKI). Or use magisk etc. 5. Build your ROM using the userdebug variant: - Avoid using user variant for now. - If FCM (Framework Compatibility Matrix) errors occur, leading to OTA package build failure, manually build images (make systemimage vendorimage productimage bootimage ...) and flash them using fastboot in fastbootd. ## How to Use Lindroid? 1. Download and prepare the root filesystem - Download the pre-packaged Debian image from [Lindroid website](https://lindroid.org/lindroid.tar.gz). - Push it to /data/data/org.lindroid.ui/files/rootfs.tar.gz (rename to rootfs). - Open Lindroid and follow the prompts to create the container. 2. Configure your device - Ensure network connection, disable auto-rotate, set screen timeout to 30 minutes, and grant root access to shell in developer options. - Use adb shell or terminal to enter: ```shell su lxc_ls lxc_attach default /bin/bash -c "source /etc/profile && exec su - root" ``` - Optionally, change Debian source mirrors for CN users: `sed -i 's/deb.debian.org/mirrors.bfsu.edu.cn/g' /etc/apt/sources.list` - Then upgrade all packages (Especially Kwin etc. from lindroid) ```shell apt update && apt-get -o Dpkg::Options::="--force-overwrite" full-upgrade ``` 3. Test and configure the graphical interface: - Test graphics with `test_hwcomposer`. - Start or restart SDDM service: ```shell systemctl restart sddm ``` - If touch doesn't work, try: ```shell sudo setcap cap_dac_read_search+ep /usr/bin/startplasma-wayland sudo setcap cap_dac_read_search+ep /usr/bin/kwin_wayland sudo setcap cap_dac_read_search+ep /usr/bin/sddm ``` - Use evtest to check for Lindroid virtual input devices. Adjust /dev/uinput permissions if needed and restart Lindroid in adb shell. ```shell chmod 777 /dev/uinput am force-stop org.lindroid.ui ``` ## Notes: - Subsequent usage may encounter touch issues; restart Lindroid and SDDM as needed. - Use `plasma-settings` instead of `system-settings` for now. - External keyboard/mouse is recommended. KDE Connect can help with remote control. - Strongly suggest SSH for better terminal experience. This guide is a compilation of my personal exploration and guidance from Lindroid developers [Erfan Abdi, Luka, Nick]. Expect some initial issues, but it’s a promising start. Explore further on your own.