### Install Redroid Dependencies and Deploy via LXC (Bash) Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/lxc.md This snippet installs the necessary kernel modules, LXC tools, and utility programs (skopeo, umoci, jq) required for deploying Redroid. It then proceeds to create, configure, and start a Redroid container using an OCI image. ```bash apt install linux-modules-extra-`uname -r` modprobe binder_linux devices="binder,hwbinder,vndbinder" apt install lxc-utils systemctl --no-pager status lxc-net sed -i 's/set -eu/set -u/g' /usr/share/lxc/templates/lxc-oci apt install skopeo umoci jq lxc-create -n redroid11 -t oci -- -u docker://docker.io/redroid/redroid:12.0.0_64only-latest mkdir $HOME/data-redroid11 sed -i '/lxc.include/d' /var/lib/lxc/redroid11/config <> /var/lib/lxc/redroid11/config ### hacked lxc.init.cmd = /init androidboot.hardware=redroid androidboot.redroid_gpu_mode=guest lxc.apparmor.profile = unconfined lxc.autodev = 1 lxc.autodev.tmpfs.size = 25000000 lxc.mount.entry = $HOME/data-redroid11 data none bind 0 0 EOF rm /var/lib/lxc/redroid11/rootfs/vendor/bin/ipconfigstore lxc-start -l debug -o redroid11.log -n redroid11 ``` -------------------------------- ### Setup Build Environment with Docker and Packages Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md Installs essential packages like curl, docker.io, git-lfs, and jq for building Redroid. It also sets up the 'repo' tool and configures Git user information. User is added to the Docker group for seamless Docker command execution. Finally, it verifies Docker installation. ```bash # update and install packages sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install -y curl libxml2-utils docker.io docker-buildx git-lfs jq sudo apt-get remove repo -y && sudo apt-get autoremove -y # install 'repo' mkdir -p ~/.bin curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo chmod a+x ~/.bin/repo echo 'export PATH=~/.bin:$PATH' >> ~/.bashrc && source ~/.bashrc # set git variables git config --global user.email "you@example.com" git config --global user.name "Your Name" # add current user to Docker group so we don't have to type 'sudo' to run Docker sudo usermod -aG docker ubuntu # Set your username here sudo systemctl enable docker sudo systemctl restart docker # NOW YOU SHOULD LOGOUT AND LOGIN AGAIN FOR DOCKER TO RECOGNIZE OUR USER # check if Docker is running docker --version && docker ps -as ``` -------------------------------- ### Install and Run redroid Docker Container Source: https://github.com/remote-android/redroid-doc/blob/master/README.md This snippet shows how to install necessary kernel modules and run a redroid Docker container on Ubuntu. It explains the purpose of volume mounting and port exposure, and provides commands to connect via ADB and view the screen using scrcpy. It also includes a disclaimer about exposing the ADB port. ```bash ## install docker https://docs.docker.com/engine/install/#server ## install required kernel modules apt install linux-modules-extra-`uname -r` modprobe binder_linux devices="binder,hwbinder,vndbinder" modprobe ashmem_linux ## running redroid docker run -itd --rm --privileged \ --pull always \ -v ~/data:/data \ -p 5555:5555 \ redroid/redroid:12.0.0_64only-latest ### Explanation: ### --pull always -- use latest image ### -v ~/data:/data -- mount data partition ### -p 5555:5555 -- expose adb port ### DISCLAIMER ### Should NOT expose adb port on public network ### otherwise, redroid container (even host OS) may get compromised ## install adb https://developer.android.com/studio#downloads # adb connect localhost:5555 ### NOTE: change localhost to IP if running redroid remotely ## view redroid screen ## install scrcpy https://github.com/Genymobile/scrcpy/blob/master/README.md#get-the-app # scrcpy -s localhost:5555 ### NOTE: change localhost to IP if running redroid remotely ### typically running scrcpy on your local PC ``` -------------------------------- ### Start Redroid Docker Build Environment (Bash) Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.md Starts an interactive Docker container from the 'redroid-builder' image. It mounts the local '~/redroid' directory into the container at '/src', allowing the build process to access and modify the source code. The container is removed upon exit. ```bash ##################### # start builder ##################### docker run -it --rm --hostname redroid-builder --name redroid-builder -v ~/redroid:/src redroid-builder ``` -------------------------------- ### Install Podman on Deepin Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/deepin.md Installs the Podman container runtime on Deepin 23 using the apt package manager. This is a prerequisite for running containerized applications like Redroid. ```bash apt install podman ``` -------------------------------- ### Start Redroid Container on Deepin Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/deepin.md Launches a Redroid container using Podman. This command mounts a local directory for data persistence, maps port 5555 for access, and uses a specific Redroid image. It requires the container to run with privileged access. ```bash mkdir ~/data11 podman run -itd --rm --privileged \ --pull always \ -v ~/data11:/data \ -p 5555:5555 \ --name redroid11 \ redroid/redroid:12.0.0_64only-latest ``` -------------------------------- ### Install Redroid Kernel Modules on Ubuntu 22.04 Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/ubuntu.md Installs the 'linux-modules-extra' package and loads the 'binder_linux' kernel module with specified devices. It also optionally loads 'ashmem_linux' for older kernel versions. ```bash apt install linux-modules-extra-`uname -r` modprobe binder_linux devices="binder,hwbinder,vndbinder" ### optional module (removed since 5.18) modprobe ashmem_linux ``` -------------------------------- ### Create Redroid Docker Image Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This snippet shows the commands to be executed on the host machine after the Redroid build is complete. It involves mounting the system and vendor images, creating a Docker image from the build output using `docker import`, and unmounting the images. An optional entrypoint argument can be used to disable the GApps setup wizard. ```shell cd ~/redroid/out/target/product/redroid_arm64 sudo mount system.img system -o ro sudo mount vendor.img vendor -o ro # set the target platform(s) with the '--platform flag' below. eg: --platform=linux/arm64,linux/amd64 .... sudo tar --xattrs -c vendor -C system --exclude="./vendor" . | docker import --platform=linux/arm64 -c 'ENTRYPOINT ["/init", "qemu=1", "androidboot.hardware=redroid"]' - redroid # execute only ↑ (without Step 3 Gapps) or ↓ (with Step 3 Gapps) | (OPTIONAL) sudo tar --xattrs -c vendor -C system --exclude="./vendor" . | docker import --platform=linux/arm64 -c 'ENTRYPOINT ["/init", "qemu=1", "androidboot.hardware=redroid", "ro.setupwizard.mode=DISABLED"]' - redroid sudo umount system vendor ``` -------------------------------- ### Apply Redroid Patches and Setup Builder Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This snippet outlines the steps to apply Redroid-specific patches and set up a Docker build environment. It involves cloning a patch repository, running an apply-patch script, creating a Docker buildx builder, and running a build container. ```shell # apply redroid patches git clone https://github.com/remote-android/redroid-patches.git ~/redroid-patches ~/redroid-patches/apply-patch.sh ~/redroid docker buildx create --use docker buildx build --build-arg userid=$(id -u) --build-arg groupid=$(id -g) --build-arg username=$(id -un) -t redroid-builder --load . docker run -it --privileged --rm --hostname redroid-builder --name redroid-builder -v ~/redroid:/src redroid-builder ``` -------------------------------- ### Configure redroid Container with Custom Display Settings Source: https://github.com/remote-android/redroid-doc/blob/master/README.md This example demonstrates how to run a redroid Docker container with custom display parameters such as width, height, and DPI. It uses Docker run command with specific androidboot properties to override the default display configuration. ```bash ## running redroid with custom settings (custom display for example) docker run -itd --rm --privileged \ --pull always \ -v ~/data:/data \ -p 5555:5555 \ redroid/redroid:12.0.0_64only-latest \ androidboot.redroid_width=1080 \ androidboot.redroid_height=1920 \ androidboot.redroid_dpi=480 \ ``` -------------------------------- ### Start Redroid Container using Docker on Debian Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/debian.md This command launches a Redroid container using Docker. It mounts necessary binder devices, a data volume, and exposes the required port. The `--privileged` flag is crucial for device access. ```bash docker run -itd --rm --privileged \ --pull always \ -v /dev/binder1:/dev/binder \ -v /dev/binder2:/dev/hwbinder \ -v /dev/binder3:/dev/vndbinder \ -v ~/data11:/data \ -p 5555:5555 \ --name redroid11 \ redroid/redroid:12.0.0_64only-latest ``` -------------------------------- ### Configure and Build WSL2 Linux Kernel Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/wsl.md This snippet details the steps to download the WSL2 Linux kernel source, configure specific kernel features required for Redroid (like IPv6, binderfs, and ashmem), install necessary build tools, and compile the kernel. The output kernel image will be located at `arch/x86_64/boot/bzImage`. ```bash ############################## ## 5.15 ## 5.10 ############################## ## download WSL kernel source from https://github.com/microsoft/WSL2-Linux-Kernel/tags tar xf tar xf linux-msft-wsl-*.tar.gz cd WSL2-Linux-Kernel-linux-msft-wsl-* cp Microsoft/config-wsl .config ## enable following kernel features # ipv6 should enabled CONFIG_IPV6_ROUTER_PREF=y CONFIG_IPV6_ROUTE_INFO=y CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_IPV6_SUBTREES=y # codec2 required, can use ION for legacy kernel CONFIG_DMABUF_HEAPS=y CONFIG_DMABUF_HEAPS_SYSTEM=y # optional, can use memfd CONFIG_STAGING=y CONFIG_ASHMEM=y # binderfs required CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y CONFIG_ANDROID_BINDERFS=y CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder" ## install required libraries to build kernel sudo apt install make gcc flex bison libssl-dev libelf-dev dwarves -y ## build kernel make ## built kernel located in `arch/x86_64/boot/bzImage` ``` -------------------------------- ### Manage Redroid Container Lifecycle and Access (Bash) Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/lxc.md This snippet demonstrates how to manage a running Redroid container, including checking its status, stopping it, and accessing its shell either via ADB or directly using nsenter. It assumes the container is already created and started. ```bash lxc-info redroid11 adb connect `lxc-info redroid11 -i | awk '{print $2}'`:5555 nsenter -t `lxc-info redroid11 -p | awk '{print $2}'` -a sh lxc-stop -k redroid11 ``` -------------------------------- ### Dockerfile for Redroid Image Source: https://github.com/remote-android/redroid-doc/blob/master/README.md This Dockerfile defines the build process for a Redroid Docker image. It starts from a base Redroid image and adds a native bridge tarball. Ensure the native-bridge.tar file is available in the build context. ```dockerfile # Dockerfile FROM redroid/redroid:11.0.0-latest ADD native-bridge.tar / ``` -------------------------------- ### Configure Device MK File for GApps Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This snippet shows how to include GApps in the Redroid build by adding a line to the architecture-specific device.mk file. The example targets the arm64 architecture for Redroid 12. ```makefile $(call inherit-product, vendor/gapps/arm64/arm64-vendor.mk) ``` -------------------------------- ### Build Redroid in Docker Container Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This snippet details the commands to execute within the Redroid builder Docker container to compile Redroid. It includes setting up the build environment, selecting the target product and architecture, and starting the compilation process using multiple CPU cores. ```shell cd /src . build/envsetup.sh lunch redroid_arm64-userdebug # redroid_x86_64-userdebug # redroid_arm64-userdebug # redroid_x86_64_only-userdebug (64 bit only, redroid 12+) # redroid_arm64_only-userdebug (64 bit only, redroid 12+) # start to build | + ~100GB of data | ~ 2 hours on a fast cpu m -j$(nproc) exit ``` -------------------------------- ### Load Kernel Module on Fedora Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/fedora.md This command loads the 'nfnetlink' kernel module. This module is often required for network-related functionalities, including those used by Redroid. It ensures the necessary kernel components are available before starting the service. ```shell modprobe nfnetlink ``` -------------------------------- ### Upgrade Kernel and Install Redroid Modules on Ubuntu 18.04 Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/ubuntu.md Upgrades the Ubuntu 18.04 kernel to version 5.0 or later, loads the 'nfnetlink' module, and then loads the 'binder_linux' module with specific devices. It also optionally loads 'ashmem_linux' for older kernel versions. ```bash apt install linux-generic-hwe-18.04 modprobe nfnetlink modprobe binder_linux devices="binder,hwbinder,vndbinder" ### optional module (removed since 5.18) modprobe ashmem_linux ``` -------------------------------- ### Build and Run Redroid Docker Image Source: https://github.com/remote-android/redroid-doc/blob/master/README.md Commands to build a Docker image for Redroid with native bridge support and then run it. The build command tags the image, and the run command mounts a volume for data, exposes a port, and runs the container in privileged mode. ```bash # build docker image docker build . -t redroid:11.0.0-nb # running docker run -itd --rm --privileged \ -v ~/data11-nb:/data \ -p 5555:5555 \ redroid:11.0.0-nb \ ``` -------------------------------- ### Fetch Redroid Source Code (Bash) Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.md This script fetches the Redroid source code using the 'repo' tool. It initializes the repository with a specific manifest and branch, clones local manifests, and synchronizes the code. It also applies Redroid-specific patches. ```bash ##################### # fetch code ##################### mkdir ~/redroid && cd ~/redroid # check supported branch in https://github.com/remote-android/redroid-patches.git repo init -u https://android.googlesource.com/platform/manifest --git-lfs --depth=1 -b android-11.0.0_r48 # add local manifests git clone https://github.com/remote-android/local_manifests.git ~/redroid/.repo/local_manifests -b 11.0.0 # sync code repo sync -c # apply redroid patches git clone https://github.com/remote-android/redroid-patches.git ~/redroid-patches ~/redroid-patches/apply-patch.sh ~/redroid ##################### # fetch code (LEGACY) ##################### mkdir ~/redroid && cd ~/redroid repo init -u https://github.com/remote-android/platform_manifests.git -b redroid-11.0.0 --depth=1 --git-lfs # check @remote-android/platform_manifests for supported branch / manifest repo sync -c ``` -------------------------------- ### Fetch and Sync Android and Redroid Source Code Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md Initializes the Android source code repository with a specific branch and applies Redroid's local manifests. It then syncs the code, which is a large download. Finally, it verifies the presence and size of Webview.apk files, essential for the build. ```bash mkdir ~/redroid && cd ~/redroid # check supported branch in https://github.com/remote-android/redroid-patches.git repo init -u https://android.googlesource.com/platform/manifest --git-lfs --depth=1 -b android-12.0.0_r34 # add local manifests git clone https://github.com/remote-android/local_manifests.git ~/redroid/.repo/local_manifests -b 12.0.0 # sync code | ~100GB of data | ~20 minutes on a fast CPU + connection repo sync -c -j$(nproc) # get latest Dockerfile from Redroid repository wget https://raw.githubusercontent.com/remote-android/redroid-doc/master/android-builder-docker/Dockerfile # check if 'Webview.apk' files were properly synced by 'git-lfs'. Each .apk should be at least ~80MB in size. find ~/redroid/external/chromium-webview -type f -name "*.apk" -exec du -h {} + ``` -------------------------------- ### Build Redroid Image (Bash) Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.md This sequence of commands, executed inside the Redroid Docker container, sets up the build environment, selects the target product, and initiates the compilation of the Redroid image. It requires the build tools to be sourced and lunch to be configured. ```bash ##################### # build redroid ##################### cd /src . build/envsetup.sh lunch redroid_x86_64-userdebug # redroid_arm64-userdebug # redroid_x86_64_only-userdebug (64 bit only, redroid 12+) # redroid_arm64_only-userdebug (64 bit only, redroid 12+) # start to build m ``` -------------------------------- ### Inspect Redroid Image Configuration Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This command inspects the created Redroid image to verify its entrypoint and architecture. It uses `docker inspect` to retrieve image details and `jq` to parse the JSON output. ```bash docker inspect redroid:latest | jq '.[0].Config.Entrypoint, .[0].Architecture' ``` -------------------------------- ### Create Redroid Development Rootfs Image Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This command creates a Docker image from a tar archive of the root filesystem, setting an entrypoint for development purposes. It requires the root filesystem to be present in the current directory. ```bash tar --xattrs -c -C root . | docker import -c 'ENTRYPOINT ["/init", "androidboot.hardware=redroid"]' - redroid-dev ``` -------------------------------- ### Configure and Load Binder Devices on Debian Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/debian.md This snippet loads the binder kernel module and sets the correct permissions for binder devices. It is essential for Redroid to function correctly on Debian systems. ```bash modprobe binder_linux devices=binder1,binder2,binder3,binder4,binder5,binder6 chmod 666 /dev/binder* ``` -------------------------------- ### Deploy Redroid using Docker Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/README.md This snippet demonstrates how to deploy Redroid using Docker. It includes commands to pull the latest Redroid image, run it in detached mode with privileged access, mount a data volume, expose the ADB port, and name the container. It also shows how to connect to the running Redroid instance via ADB and view its screen using scrcpy. ```shell ## install docker https://docs.docker.com/engine/install/#server ## or use podman ## make sure required kernel features enabled; Check details on per distro page ## disable SELinux if present setenforce 0 ## running redroid docker run -itd --rm --privileged \ --pull always \ -v ~/data11:/data \ -p 5555:5555 \ --name redroid11 \ redroid/redroid:12.0.0_64only-latest ### Explanation: ### --pull always -- use latest image ### -v ~/data11:/data -- mount data partition ### -p 5555:5555 -- expose adb port ## install adb https://developer.android.com/studio#downloads adb connect localhost:5555 ### NOTE: change localhost to IP if running redroid remotely ## view redroid screen ## install scrcpy https://github.com/Genymobile/scrcpy/blob/master/README.md#get-the-app scrcpy -s localhost:5555 ### NOTE: change localhost to IP if running redroid remotely ### typically running scrcpy on your local PC ``` -------------------------------- ### Create Redroid Docker Image from Host (Bash) Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.md This process, run on the host machine, creates Docker images from the built Redroid system and vendor partitions. It mounts the image files, creates tarballs, and imports them into Docker, tagging them as 'redroid' and 'redroid-dev'. ```bash ##################### # create redroid image in *HOST* ##################### cd ~/redroid/out/target/product/redroid_x86_64 sudo mount system.img system -o ro sudo mount vendor.img vendor -o ro sudo tar --xattrs -c vendor -C system --exclude="./vendor" . | docker import -c 'ENTRYPOINT ["/init", "androidboot.hardware=redroid"]' - redroid sudo umount system vendor # create rootfs only image for develop purpose tar --xattrs -c -C root . | docker import -c 'ENTRYPOINT ["/init", "androidboot.hardware=redroid"]' - redroid-dev ``` -------------------------------- ### Run Redroid Container Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md These commands demonstrate how to run a Redroid container. It includes options for privileged mode, volume mounting for data persistence, port forwarding, and using either a custom-tagged image or the default 'latest' tag. The `--privileged` flag is essential for Redroid's functionality. ```bash docker run -itd --privileged --name Redroid12 -v ~/data:/data -p 5555:5555 YourDockerAccount/redroid:12.0.0_arm64-latest # or just use the default tag if you skipped Step 7 docker run -itd --privileged --name Redroid12 -v ~/data:/data -p 5555:5555 redroid:latest ``` -------------------------------- ### Run Redroid using Docker Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/wsl.md This snippet demonstrates how to run Redroid as a Docker container. It uses a privileged mode, mounts a volume for data persistence, exposes the necessary port, and names the container 'redroid'. This command is used after the WSL2 environment is set up with the custom kernel. ```bash docker run -d --rm \ --privileged \ -v ~/redroid-data:/data \ -p 5555:5555 \ --name redroid \ redroid/redroid ``` -------------------------------- ### Tag and Push Redroid Image to Docker Hub Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This section details how to tag a locally built Redroid Docker image with a personal Docker Hub account and push it. It involves listing images, tagging the specific image ID, logging into Docker Hub, and pushing the tagged image. This is optional but recommended for distribution. ```bash # Get the container ID of the imported Docker image docker images ``` ```bash # Tag it docker tag b00684099b2d YourDockerAccount/redroid:12.0.0_arm64-latest ``` ```bash # Push it to Docker Hub docker login docker push YourDockerAccount/redroid:12.0.0_arm64-latest ``` -------------------------------- ### Include GApps Product Makefile (Makefile) Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.md This makefile snippet is added to a Redroid device's 'device.mk' file to inherit the GApps product configuration. It specifies the path to the GApps makefile corresponding to the target architecture, enabling GApps integration during the build. ```makefile $(call inherit-product, vendor/gapps/x86_64/x86_64-vendor.mk) ``` -------------------------------- ### Configure Kernel for Redroid on OpenEuler Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/openeuler.md These kernel configurations are required for Redroid to function correctly on OpenEuler. They enable features like DMABUF HEAPS for memory management and BINDERFS for Android IPC. ```shell # codec2 required CONFIG_DMABUF_HEAPS=y CONFIG_DMABUF_HEAPS_SYSTEM=y # optional, can use memfd CONFIG_STAGING=y CONFIG_ASHMEM=y # binderfs required CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y CONFIG_ANDROID_BINDERFS=y CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder" ``` -------------------------------- ### Configure WSL2 to Use Custom Kernel Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/wsl.md This snippet shows how to configure the WSL2 environment to use the newly built custom kernel. It involves appending a configuration to the `.wslconfig` file, specifying the path to the kernel image. This is crucial for WSL2 to boot with the modified kernel. ```bash ## follow https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configuration-setting-for-wslconfig ## to use this new kernel <> .wslconfig [wsl2] kernel= EOF ``` -------------------------------- ### Enable Kernel Features for x86_64 Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/centos.md This section details the kernel configuration options required for Redroid on x86_64 architecture. It includes mandatory features like DMABUF_HEAPS and optional ones like STAGING and ASHMEM, along with binderfs requirements. Ensure these are enabled in your kernel build. ```bash # codec2 required, can use ION for legacy kernel CONFIG_DMABUF_HEAPS=y CONFIG_DMABUF_HEAPS_SYSTEM=y # optional, can use memfd CONFIG_STAGING=y CONFIG_ASHMEM=y # binderfs required CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y CONFIG_ANDROID_BINDERFS=y CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder" ``` -------------------------------- ### Enable BinderFS in Kernel Configuration Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/debian.md These kernel configuration options enable BinderFS, which allows for unlimited Redroid container instances without manually mounting binder devices. This is an advanced configuration for performance and scalability. ```text CONFIG_ANDROID_BINDER_IPC=y CONFIG_ANDROID_BINDERFS=y CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder" ``` -------------------------------- ### Run Redroid using Docker on OpenEuler Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/openeuler.md This command deploys and runs Redroid in a Docker container on OpenEuler. It mounts a local directory for data persistence and maps the necessary port. ```shell docker run -itd --rm --privileged \ --pull always \ -v ~/data11:/data \ -p 5555:5555 \ --name redroid11 \ redroid/redroid:12.0.0_64only-latest ``` -------------------------------- ### Enable Kernel Features for arm64 Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/centos.md This section provides the kernel configuration options necessary for Redroid on arm64 architecture. It includes features related to compatibility and page size settings. ```bash CONFIG_COMPAT=y CONFIG_COMPAT_32BIT_TIME=y CONFIG_ARM64_4K_PAGES=y ``` -------------------------------- ### Configure Binder Permissions on Deepin 20.9 Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/deepin.md Sets appropriate file permissions for binder devices on Deepin 20.9. This is often necessary for containerized Android environments to interact with the host system's binder kernel module. ```bash chmod 666 /dev/{,hw,vnd}binder ``` -------------------------------- ### Resync Repository to Fetch GApps Code Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This command is used to synchronize the Redroid source code repository after adding the GApps manifest. It fetches all necessary files, including the newly added GApps components, using multiple parallel jobs for faster download. ```shell repo sync -c -j$(nproc) ``` -------------------------------- ### Build Redroid Docker Image (Bash) Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.md Builds a Docker image for Redroid development. It uses build arguments to pass the host user's ID, group ID, and username to ensure correct file permissions within the container. The image is tagged as 'redroid-builder'. ```bash ##################### # create builder ##################### docker build --build-arg userid=$(id -u) --build-arg groupid=$(id -g) --build-arg username=$(id -un) -t redroid-builder . ``` -------------------------------- ### Collect Debug Blobs Script Source: https://github.com/remote-android/redroid-doc/blob/master/README.md This bash command fetches and executes a script to collect debug information for Redroid. It uses curl to download the script from GitHub and pipes it to sudo bash for execution. The CONTAINER argument is optional. ```bash curl -fsSL https://raw.githubusercontent.com/remote-android/redroid-doc/master/debug.sh | sudo bash -s -- [CONTAINER] ``` -------------------------------- ### Add MindTheGapps Manifest (XML) Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.md This XML snippet is a local manifest file used with the 'repo' tool to include the MindTheGapps project. It specifies the remote repository and the project path for GApps, along with a specific revision tied to a Redroid version. ```xml ``` -------------------------------- ### Patch GApps Files for Redroid Build Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This set of shell commands patches specific GApps configuration files to ensure compatibility with the Redroid build. It involves commenting out certain lines in arm64-vendor.mk and Android.bp files, and creating new entries for prebuilt shared libraries. ```shell # First we comment out some lines in "~/redroid/vendor/gapps/arm64/arm64-vendor.mk" sed -i '/^PRODUCT_COPY_FILES += /s/^/#/' ~/redroid/vendor/gapps/arm64/arm64-vendor.mk sed -i '/vendor\/gapps\/arm64\/proprietary\/product/s/^/#/' ~/redroid/vendor/gapps/arm64/arm64-vendor.mk # Then we create the "~/redroid/vendor/gapps/arm64/proprietary/product/app/MarkupGoogle/Android.bp" echo 'cc_prebuilt_library_shared { name: "libsketchology_native", srcs: ["lib/arm64/libsketchology_native.so"], shared_libs: [], stl: "none", system_shared_libs: [], vendor: true, }' > ~/redroid/vendor/gapps/arm64/proprietary/product/app/MarkupGoogle/Android.bp # And add some entries to the end of "~/redroid/vendor/gapps/arm64/Android.bp" file sed -i '$a cc_prebuilt_library_shared {\n name: "libjni_latinimegoogle",\n srcs: ["proprietary/product/lib/libjni_latinimegoogle.so"],\n shared_libs: [],\n stl: "none",\n system_shared_libs: [],\n vendor: true,\n}\n\nccncc_prebuilt_library_shared {\n name: "libjni_latinimegoogle_64",\n srcs: ["proprietary/product/lib64/libjni_latinimegoogle.so"],\n shared_libs: [],\n stl: "none",\n system_shared_libs: [],\n vendor: true,\n}' ~/redroid/vendor/gapps/arm64/Android.bp ``` -------------------------------- ### Deploy 64-bit Only Redroid using Docker Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/README.md This snippet shows how to deploy a 64-bit only version of Redroid, specifically for `aarch64` platforms. Similar to the general deployment, it uses Docker to run the image, mount a data volume, expose the ADB port, and name the container. This is useful for specific Arm architectures that only support 64-bit Android images. ```shell ## running 64bit-only redroid ## only `aarch64` supported by some Arm platforms, the 64only image required here docker run -itd --rm --privileged \ --pull always \ -v ~/data12_64only:/data \ -p 5555:5555 \ --name redroid12_64only \ redroid/redroid:12.0.0_64only-latest \ ``` -------------------------------- ### Add GApps Manifest to Redroid Build Source: https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.detailed.md This snippet demonstrates how to add a manifest file to incorporate MindTheGapps into a Redroid build. It can be done manually by creating an XML file or via a single echo command. Ensure the 'revision' parameter matches the Redroid version. ```xml ``` ```shell echo -e '\n\n \n \n' > ~/redroid/.repo/local_manifests/mindthegapps.xml ``` -------------------------------- ### Disable SELinux Temporarily Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/centos.md This command temporarily disables SELinux on the CentOS system. SELinux can interfere with certain operations required by Redroid, so it's recommended to disable it during deployment or troubleshooting. ```bash setenforce 0 ``` -------------------------------- ### Disable SELinux on Fedora Source: https://github.com/remote-android/redroid-doc/blob/master/deploy/fedora.md This code snippet disables SELinux by updating the kernel arguments in GRUB and regenerating the GRUB configuration. A reboot is required for the changes to take effect. This is a common step for services that may have SELinux conflicts. ```shell grubby --update-kernel ALL --args selinux=0 grub2-mkconfig > /boot/grub2/grub.cfg reboot ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.