├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── README.md
├── README.zh-cn.md
├── android-builder-docker
├── Dockerfile
├── README.detailed.md
├── README.md
├── apt.conf
└── sources.list
├── assets
└── redroid11.png
├── debug.sh
└── deploy
├── README.md
├── alibaba-cloud-linux.md
├── amazon-linux.md
├── arch-linux.md
├── centos.md
├── debian.md
├── deepin.md
├── fedora.md
├── gentoo.md
├── kubernetes.md
├── kubernetes
├── base
│ ├── kustomization.yaml
│ └── sts.yaml
└── overlays
│ ├── 10.0.0
│ └── kustomization.yaml
│ ├── 11.0.0
│ └── kustomization.yaml
│ ├── 12.0.0-64only
│ └── kustomization.yaml
│ ├── 12.0.0
│ └── kustomization.yaml
│ ├── 13.0.0
│ └── kustomization.yaml
│ ├── 8.1.0
│ └── kustomization.yaml
│ ├── 9.0.0
│ └── kustomization.yaml
│ └── autogen.sh
├── lxc.md
├── mint.md
├── openeuler.md
├── openkylin.md
├── pop_os.md
├── ubuntu.md
└── wsl.md
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | **请详细描述问题(ZH_CN)**
12 | A clear and concise description of what the bug is.
13 |
14 | **make sure the required kernel modules present**
15 | **确保必须的内核功能已开启(ZH_CN)**
16 | - [ ] `grep binder /proc/filesystems`
17 | - [ ] `grep ashmem /proc/misc` (optional)
18 |
19 | **Collect debug logs**
20 | **收集调试日志(ZH_CN)**
21 | `curl -fsSL https://raw.githubusercontent.com/remote-android/redroid-doc/master/debug.sh | sudo bash -s -- [CONTAINER]`
22 | omit CONTAINER if not exist any more.
23 | 如容器已退出,可忽略CONTAINER参数(ZH_CN)
24 |
25 | **Screenshots**
26 | **截图(ZH_CN)**
27 | If applicable, add screenshots to help explain your problem.
28 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | English | [简体中文](README.zh-cn.md)
2 |
3 | # Table of contents
4 | - [Overview](#overview)
5 | - [Getting Started](#getting-started)
6 | - [Configuration](#configuration)
7 | - [Native Bridge Support](#native-bridge-support)
8 | - [GMS Support](#gms-support)
9 | - [WebRTC Streaming](#webrtc-streaming)
10 | - [How To Build](#how-to-build)
11 | - [Troubleshooting](#troubleshooting)
12 | - [Contact Me](#contact-me)
13 | - [License](#license)
14 |
15 | ## Overview
16 | *redroid* (*Re*mote an*Droid*) is a GPU accelerated AIC (Android In Cloud) solution. You can boot many
17 | instances in Linux host (`Docker`, `podman`, `k8s` etc.). *redroid* supports both `arm64` and `amd64` architectures.
18 | *redroid* is suitable for Cloud Gaming, Virtualise Phones, Automation Test and more.
19 |
20 | 
21 |
22 | Currently supported:
23 | - Android 15 (`redroid/redroid:15.0.0-latest`)
24 | - Android 15 64bit only (`redroid/redroid:15.0.0_64only-latest`)
25 | - Android 14 (`redroid/redroid:14.0.0-latest`)
26 | - Android 14 64bit only (`redroid/redroid:14.0.0_64only-latest`)
27 | - Android 13 (`redroid/redroid:13.0.0-latest`)
28 | - Android 13 64bit only (`redroid/redroid:13.0.0_64only-latest`)
29 | - Android 12 (`redroid/redroid:12.0.0-latest`)
30 | - Android 12 64bit only (`redroid/redroid:12.0.0_64only-latest`)
31 | - Android 11 (`redroid/redroid:11.0.0-latest`)
32 | - Android 10 (`redroid/redroid:10.0.0-latest`)
33 | - Android 9 (`redroid/redroid:9.0.0-latest`)
34 | - Android 8.1 (`redroid/redroid:8.1.0-latest`)
35 |
36 |
37 | ## Getting Started
38 | *redroid* should be able to run on any linux distribution (with some kernel features enabled).
39 |
40 | Quick start on *Ubuntu 20.04* here; Check [deploy section](deploy/README.md) for other distros.
41 |
42 | ```bash
43 | ## install docker https://docs.docker.com/engine/install/#server
44 |
45 | ## install required kernel modules
46 | apt install linux-modules-extra-`uname -r`
47 | modprobe binder_linux devices="binder,hwbinder,vndbinder"
48 | modprobe ashmem_linux
49 |
50 |
51 | ## running redroid
52 | docker run -itd --rm --privileged \
53 | --pull always \
54 | -v ~/data:/data \
55 | -p 5555:5555 \
56 | redroid/redroid:12.0.0_64only-latest
57 |
58 | ### Explanation:
59 | ### --pull always -- use latest image
60 | ### -v ~/data:/data -- mount data partition
61 | ### -p 5555:5555 -- expose adb port
62 |
63 | ### DISCLAIMER
64 | ### Should NOT expose adb port on public network
65 | ### otherwise, redroid container (even host OS) may get compromised
66 |
67 | ## install adb https://developer.android.com/studio#downloads
68 | adb connect localhost:5555
69 | ### NOTE: change localhost to IP if running redroid remotely
70 |
71 | ## view redroid screen
72 | ## install scrcpy https://github.com/Genymobile/scrcpy/blob/master/README.md#get-the-app
73 | scrcpy -s localhost:5555
74 | ### NOTE: change localhost to IP if running redroid remotely
75 | ### typically running scrcpy on your local PC
76 | ```
77 |
78 | ## Configuration
79 |
80 | ```
81 | ## running redroid with custom settings (custom display for example)
82 | docker run -itd --rm --privileged \
83 | --pull always \
84 | -v ~/data:/data \
85 | -p 5555:5555 \
86 | redroid/redroid:12.0.0_64only-latest \
87 | androidboot.redroid_width=1080 \
88 | androidboot.redroid_height=1920 \
89 | androidboot.redroid_dpi=480 \
90 | ```
91 |
92 | | Param | Description | Default |
93 | | --- | --- | --- |
94 | | `androidboot.redroid_width` | display width | 720 |
95 | | `androidboot.redroid_height` | display height | 1280 |
96 | | `androidboot.redroid_fps` | display FPS | 30(GPU enabled)
15 (GPU not enabled)|
97 | | `androidboot.redroid_dpi` | display DPI | 320 |
98 | | `androidboot.use_memfd` | use `memfd` to replace deprecated `ashmem`
plan to enable by default | false |
99 | | `androidboot.use_redroid_overlayfs` | use `overlayfs` to share `data` partition
`/data-base`: shared `data` partition
`/data-diff`: private data | 0 |
100 | | `androidboot.redroid_net_ndns` | number of DNS server, `8.8.8.8` will be used if no DNS server specified | 0 |
101 | | `androidboot.redroid_net_dns<1..N>` | DNS | |
102 | | `androidboot.redroid_net_proxy_type` | Proxy type; choose from: `static`, `pac`, `none`, `unassigned` | |
103 | | `androidboot.redroid_net_proxy_host` | | |
104 | | `androidboot.redroid_net_proxy_port` | | 3128 |
105 | | `androidboot.redroid_net_proxy_exclude_list` | comma seperated list | |
106 | | `androidboot.redroid_net_proxy_pac` | | |
107 | | `androidboot.redroid_gpu_mode` | choose from: `auto`, `host`, `guest`;
`guest`: use software rendering;
`host`: use GPU accelerated rendering;
`auto`: auto detect | `guest` |
108 | | `androidboot.redroid_gpu_node` | | auto-detect |
109 | | `ro.xxx`| **DEBUG** purpose, allow override `ro.xxx` prop; For example, set `ro.secure=0`, then root adb shell provided by default | |
110 |
111 |
112 | ## Native Bridge Support
113 | It's possible to run `arm` Apps in `x86` *redroid* instance via `libhoudini`, `libndk_translation` or `QEMU translator`.
114 |
115 | Check [@zhouziyang/libndk_translation](https://github.com/zhouziyang/libndk_translation) for prebuilt `libndk_translation`.
116 | Published `redroid` images already got `libndk_translation` included.
117 |
118 | ``` bash
119 | # example structure, be careful the file owner and mode
120 |
121 | system/
122 | ├── bin
123 | │ ├── arm
124 | │ └── arm64
125 | ├── etc
126 | │ ├── binfmt_misc
127 | │ └── init
128 | ├── lib
129 | │ ├── arm
130 | │ └── libnb.so
131 | └── lib64
132 | ├── arm64
133 | └── libnb.so
134 | ```
135 |
136 | ```dockerfile
137 | # Dockerfile
138 | FROM redroid/redroid:11.0.0-latest
139 |
140 | ADD native-bridge.tar /
141 | ```
142 |
143 | ```bash
144 | # build docker image
145 | docker build . -t redroid:11.0.0-nb
146 |
147 | # running
148 | docker run -itd --rm --privileged \
149 | -v ~/data11-nb:/data \
150 | -p 5555:5555 \
151 | redroid:11.0.0-nb \
152 | ```
153 |
154 | ## GMS Support
155 |
156 | It's possible to add GMS (Google Mobile Service) support in *redroid* via [Open GApps](https://opengapps.org/), [MicroG](https://microg.org/) or [MindTheGapps](https://gitlab.com/MindTheGapps/vendor_gapps).
157 |
158 | Check [android-builder-docker](./android-builder-docker) for details.
159 |
160 |
161 | ## WebRTC Streaming
162 | Plan to port `WebRTC` solutions from `cuttlefish`, including frontend (HTML5), backend and many virtual HALs.
163 |
164 | ## How To Build
165 | It's the same way as AOSP building process, but I suggest to use `docker` to build it.
166 |
167 | Check [android-builder-docker](./android-builder-docker) for details.
168 |
169 | ## Troubleshooting
170 | - How to collect debug blobs
171 | > `curl -fsSL https://raw.githubusercontent.com/remote-android/redroid-doc/master/debug.sh | sudo bash -s -- [CONTAINER]`
172 | >
173 | > omit *CONTAINER* if not exist any more
174 |
175 | - Container disappeared immediately
176 | > make sure the required kernel modules are installed; run `dmesg -T` for detailed logs
177 |
178 | - Container running, but adb cannot connect (device offline etc.)
179 | > run `docker exec -it sh`, then check `ps -A` and `logcat`
180 | >
181 | > try `dmesg -T` if cannot get a container shell
182 |
183 | ## Contact Me
184 | - remote-android.slack.com (invite link: https://join.slack.com/t/remote-android/shared_invite/zt-q40byk2o-YHUgWXmNIUC1nweQj0L9gA)
185 | - ziyang.zhou@outlook.com
186 |
187 | ## License
188 | *redroid* itself is under [Apache License](https://www.apache.org/licenses/LICENSE-2.0), since *redroid* includes
189 | many 3rd party modules, you may need to examine license carefully.
190 |
191 | *redroid* kernel modules are under [GPL v2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
192 |
--------------------------------------------------------------------------------
/README.zh-cn.md:
--------------------------------------------------------------------------------
1 | [English](README.md) | 简体中文
2 |
3 | # redroid
4 |
5 | - https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
6 | - `export REPO_URL=https://github.com/aosp-mirror/tools_repo.git`
7 |
8 | TODO :)
9 |
10 |
--------------------------------------------------------------------------------
/android-builder-docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:20.04
2 |
3 | ARG userid
4 | ARG groupid
5 | ARG username
6 |
7 | # COPY apt.conf /etc/apt/apt.conf
8 |
9 | # COPY sources.list etc/apt/sources.list
10 |
11 | ENV DEBIAN_FRONTEND noninteractive
12 |
13 | RUN apt-get update \
14 | && echo "install package for building AOSP" \
15 | && apt-get install -y git-core gnupg flex bison build-essential zip curl zlib1g-dev \
16 | gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev \
17 | libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig \
18 | && echo "install utils" \
19 | && apt-get install -y sudo rsync \
20 | && echo "install packages for build mesa3d or meson related" \
21 | && apt-get install -y python3-pip pkg-config python3-dev ninja-build \
22 | && pip3 install mako meson \
23 | && echo "packages for legacy mesa3d (< 22.0.0)" \
24 | && apt-get install -y python2 python-mako python-is-python2 python-enum34 gettext
25 |
26 |
27 | RUN groupadd -g $groupid $username \
28 | && useradd -m -u $userid -g $groupid $username \
29 | && echo "$username ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
30 | && echo $username >/root/username \
31 | && echo "$username:$username" | chpasswd && adduser $username sudo
32 |
33 |
34 | ENV HOME=/home/$username \
35 | USER=$username \
36 | PATH=/src/.repo/repo:/src/prebuilts/jdk/jdk8/linux-x86/bin/:$PATH
37 |
38 |
39 | ENTRYPOINT chroot --userspec=$(cat /root/username):$(cat /root/username) / /bin/bash -i
40 |
--------------------------------------------------------------------------------
/android-builder-docker/README.detailed.md:
--------------------------------------------------------------------------------
1 | # Build Redroid with Docker
2 | ```
3 | WARNING: YOU NEED ~200GB OF FREE SPACE ON HDD TO COMPLETE THE WHOLE PROCESS (~250GB IF BUILDING WITH GAPPS)
4 | ```
5 | #### 1) Setup
6 | ```
7 | # update and install packages
8 | 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
9 | sudo apt-get remove repo -y && sudo apt-get autoremove -y
10 |
11 | # install 'repo'
12 | mkdir -p ~/.bin
13 | curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
14 | chmod a+x ~/.bin/repo
15 | echo 'export PATH=~/.bin:$PATH' >> ~/.bashrc && source ~/.bashrc
16 |
17 | # set git variables
18 | git config --global user.email "you@example.com"
19 | git config --global user.name "Your Name"
20 |
21 | # add current user to Docker group so we don't have to type 'sudo' to run Docker
22 | sudo usermod -aG docker ubuntu # Set your username here
23 | sudo systemctl enable docker
24 | sudo systemctl restart docker
25 |
26 | # NOW YOU SHOULD LOGOUT AND LOGIN AGAIN FOR DOCKER TO RECOGNIZE OUR USER
27 |
28 | # check if Docker is running
29 | docker --version && docker ps -as
30 | # Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1
31 | # CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
32 | ```
33 | #### 2) Fetch and sync Android and Redroid codes
34 | ```
35 | mkdir ~/redroid && cd ~/redroid
36 |
37 | # check supported branch in https://github.com/remote-android/redroid-patches.git
38 | repo init -u https://android.googlesource.com/platform/manifest --git-lfs --depth=1 -b android-12.0.0_r34
39 |
40 | # add local manifests
41 | git clone https://github.com/remote-android/local_manifests.git ~/redroid/.repo/local_manifests -b 12.0.0
42 |
43 | # sync code | ~100GB of data | ~20 minutes on a fast CPU + connection
44 | repo sync -c -j$(nproc)
45 |
46 | # get latest Dockerfile from Redroid repository
47 | wget https://raw.githubusercontent.com/remote-android/redroid-doc/master/android-builder-docker/Dockerfile
48 |
49 | # check if 'Webview.apk' files were properly synced by 'git-lfs'. Each .apk should be at least ~80MB in size.
50 | find ~/redroid/external/chromium-webview -type f -name "*.apk" -exec du -h {} +
51 | ```
52 | #### 3) GApps (optional)
53 | ##### In case you want to add GApps to your build (PlayStore, etc), you can follow these steps, otherwise, just skip it
54 | - Add this manifest under `.repo/local_manifests/mindthegapps.xml`, for the specific redroid revision selected.
55 | For example, for Redroid 11 the revision is 'rho', and for Redroid 12 is 'sigma', and this is the expected manifest:
56 | ```xml
57 |
58 |
59 |
60 |
61 |
62 | ```
63 | You can add manually **↑** or with this 1 line command **↓** that will create and write to the file (remember to set proper revision)
64 | ```
65 | echo -e '\n\n \n \n' > ~/redroid/.repo/local_manifests/mindthegapps.xml
66 | ```
67 | - Add the path to the mk file corresponding to your selected arch `~/redroid/device/redroid/redroid_ARCHITECTURE/device.mk`, for example if we want arm64 arch (arm64 for Redroid 12 as in 'sigma' Mind The Gapps, as only arm64 GApps)
68 | ```
69 | nano ~/redroid/device/redroid/redroid_arm64/device.mk
70 | ```
71 | ```makefile
72 | $(call inherit-product, vendor/gapps/arm64/arm64-vendor.mk)
73 | ```
74 | - Resync `~/redroid` | Fetch GApps code
75 | ```
76 | repo sync -c -j$(nproc)
77 | ```
78 | - Patch GApps files
79 | ```
80 | # First we comment out some lines in "~/redroid/vendor/gapps/arm64/arm64-vendor.mk"
81 | sed -i '/^PRODUCT_COPY_FILES += /s/^/#/' ~/redroid/vendor/gapps/arm64/arm64-vendor.mk
82 | sed -i '/vendor\/gapps\/arm64\/proprietary\/product/s/^/#/' ~/redroid/vendor/gapps/arm64/arm64-vendor.mk
83 |
84 | # Then we create the "~/redroid/vendor/gapps/arm64/proprietary/product/app/MarkupGoogle/Android.bp"
85 | echo 'cc_prebuilt_library_shared {
86 | name: "libsketchology_native",
87 | srcs: ["lib/arm64/libsketchology_native.so"],
88 | shared_libs: [],
89 | stl: "none",
90 | system_shared_libs: [],
91 | vendor: true,
92 | }' > ~/redroid/vendor/gapps/arm64/proprietary/product/app/MarkupGoogle/Android.bp
93 |
94 | # And add some entries to the end of "~/redroid/vendor/gapps/arm64/Android.bp" file
95 | 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\ncc_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
96 | ```
97 |
98 | - OPTIONAL (recommended)
99 |
100 | While importing the image in the Step 6 (docker import command), change the entrypoint to `ENTRYPOINT ["/init", "androidboot.hardware=redroid", "ro.setupwizard.mode=DISABLED"]`, so you avoid doing it manually at every container start, or if you want set `ro.setupwizard.mode=DISABLED` at container start, skipping the GApps setup wizard at redroid boot. Optional line available in Step 6.
101 |
102 | #### 4) Apply Redroid patches, create builder and start it
103 | ```
104 | # apply redroid patches
105 | git clone https://github.com/remote-android/redroid-patches.git ~/redroid-patches
106 | ~/redroid-patches/apply-patch.sh ~/redroid
107 |
108 | docker buildx create --use
109 | docker buildx build --build-arg userid=$(id -u) --build-arg groupid=$(id -g) --build-arg username=$(id -un) -t redroid-builder --load .
110 | docker run -it --privileged --rm --hostname redroid-builder --name redroid-builder -v ~/redroid:/src redroid-builder
111 | ```
112 | #### 5) Build Redroid
113 | #### Now we should be in the `redroid-builder` docker container
114 | ```
115 | cd /src
116 | . build/envsetup.sh
117 |
118 | lunch redroid_arm64-userdebug
119 | # redroid_x86_64-userdebug
120 | # redroid_arm64-userdebug
121 | # redroid_x86_64_only-userdebug (64 bit only, redroid 12+)
122 | # redroid_arm64_only-userdebug (64 bit only, redroid 12+)
123 |
124 | # start to build | + ~100GB of data | ~ 2 hours on a fast cpu
125 | m -j$(nproc)
126 |
127 | exit
128 | ```
129 | #### 6) Create Redroid image in *HOST*
130 | ```
131 | cd ~/redroid/out/target/product/redroid_arm64
132 | sudo mount system.img system -o ro
133 | sudo mount vendor.img vendor -o ro
134 |
135 | # set the target platform(s) with the '--platform flag' below. eg: --platform=linux/arm64,linux/amd64 ....
136 | sudo tar --xattrs -c vendor -C system --exclude="./vendor" . | docker import --platform=linux/arm64 -c 'ENTRYPOINT ["/init", "qemu=1", "androidboot.hardware=redroid"]' - redroid
137 | # execute only ↑ (without Step 3 Gapps) or ↓ (with Step 3 Gapps) | (OPTIONAL)
138 | 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
139 |
140 | sudo umount system vendor
141 |
142 | # create rootfs only image for develop purpose (Optional)
143 | tar --xattrs -c -C root . | docker import -c 'ENTRYPOINT ["/init", "androidboot.hardware=redroid"]' - redroid-dev
144 |
145 | # inspect the created image to see if everything is ok
146 | docker inspect redroid:latest | jq '.[0].Config.Entrypoint, .[0].Architecture'
147 | [
148 | "/init",
149 | "qemu=1",
150 | "androidboot.hardware=redroid"
151 | ]
152 | "arm64"
153 | ```
154 | #### 7) Tag and push image to Docker Hub (optional)
155 | ##### Now you can tag the docker image to your personal docker account and push it to Docker Hub
156 | ```
157 | # Get the container ID of the imported Docker image
158 | docker images
159 | REPOSITORY TAG IMAGE ID CREATED SIZE
160 | redroid latest b00684099b2d 9 minutes ago 1.91GB
161 |
162 | # Tag it
163 | docker tag b00684099b2d YourDockerAccount/redroid:12.0.0_arm64-latest
164 |
165 | # Push it to Docker Hub
166 | docker login
167 | docker push YourDockerAccount/redroid:12.0.0_arm64-latest
168 | ```
169 | #### 8) Run the container
170 | ```
171 | docker run -itd --privileged --name Redroid12 -v ~/data:/data -p 5555:5555 YourDockerAccount/redroid:12.0.0_arm64-latest
172 | # or just use the default tag if you skipped Step 7
173 | docker run -itd --privileged --name Redroid12 -v ~/data:/data -p 5555:5555 redroid:latest
174 | ```
175 |
--------------------------------------------------------------------------------
/android-builder-docker/README.md:
--------------------------------------------------------------------------------
1 | # Build redroid with docker
2 |
3 | ```bash
4 | #####################
5 | # fetch code
6 | #####################
7 | mkdir ~/redroid && cd ~/redroid
8 |
9 | # check supported branch in https://github.com/remote-android/redroid-patches.git
10 | repo init -u https://android.googlesource.com/platform/manifest --git-lfs --depth=1 -b android-11.0.0_r48
11 |
12 | # add local manifests
13 | git clone https://github.com/remote-android/local_manifests.git ~/redroid/.repo/local_manifests -b 11.0.0
14 |
15 | # sync code
16 | repo sync -c
17 |
18 | # apply redroid patches
19 | git clone https://github.com/remote-android/redroid-patches.git ~/redroid-patches
20 | ~/redroid-patches/apply-patch.sh ~/redroid
21 |
22 | #####################
23 | # fetch code (LEGACY)
24 | #####################
25 | mkdir ~/redroid && cd ~/redroid
26 |
27 | repo init -u https://github.com/remote-android/platform_manifests.git -b redroid-11.0.0 --depth=1 --git-lfs
28 | # check @remote-android/platform_manifests for supported branch / manifest
29 |
30 | repo sync -c
31 |
32 | #####################
33 | # create builder
34 | #####################
35 | docker build --build-arg userid=$(id -u) --build-arg groupid=$(id -g) --build-arg username=$(id -un) -t redroid-builder .
36 |
37 | #####################
38 | # start builder
39 | #####################
40 | docker run -it --rm --hostname redroid-builder --name redroid-builder -v ~/redroid:/src redroid-builder
41 |
42 | #####################
43 | # build redroid
44 | #####################
45 | cd /src
46 |
47 | . build/envsetup.sh
48 |
49 | lunch redroid_x86_64-userdebug
50 | # redroid_arm64-userdebug
51 | # redroid_x86_64_only-userdebug (64 bit only, redroid 12+)
52 | # redroid_arm64_only-userdebug (64 bit only, redroid 12+)
53 |
54 | # start to build
55 | m
56 |
57 | #####################
58 | # create redroid image in *HOST*
59 | #####################
60 | cd ~/redroid/out/target/product/redroid_x86_64
61 |
62 | sudo mount system.img system -o ro
63 | sudo mount vendor.img vendor -o ro
64 | sudo tar --xattrs -c vendor -C system --exclude="./vendor" . | docker import -c 'ENTRYPOINT ["/init", "androidboot.hardware=redroid"]' - redroid
65 | sudo umount system vendor
66 |
67 | # create rootfs only image for develop purpose
68 | tar --xattrs -c -C root . | docker import -c 'ENTRYPOINT ["/init", "androidboot.hardware=redroid"]' - redroid-dev
69 | ```
70 |
71 | ## Build with GApps
72 |
73 | You can build a redroid image with your favorite GApps package if you need, for simplicity there is an example with Mind The Gapps.
74 |
75 | This is not different from the normal building process, except for some small things, like:
76 |
77 | - When following the "Sync Code" paragraph, after running the repo sync, add this manifest under .repo/local_manifests/mindthegapps.xml, for the specific redroid revision selected.
78 |
79 | For example, for Redroid 11 the revision is 'rho', and for Redroid 12 is 'sigma', and this is the expected manifest:
80 |
81 | ```xml
82 |
83 |
84 |
85 |
86 |
87 | ```
88 |
89 | - Add the path to the mk file corresponding to your selected arch to `device/redroid/redroid_ARCHITECTURE/device.mk` , for example we want x86_64 arch (x86 for redroid 11 as in 'rho' Mind The Gapps as only x86 GApps)
90 |
91 | ```makefile
92 | $(call inherit-product, vendor/gapps/x86_64/x86_64-vendor.mk)
93 | ```
94 |
95 | putting this, modified for the corresponding architecture you need. So change 'x86_64' with arm64 if you need arm64 GApps.
96 |
97 | Resync the repo with a new `repo sync -c` and continue following the building guide exactly as before.
98 |
99 | - OPTIONAL but recommended. While importing the image, change the entrypoint to 'ENTRYPOINT ["/init", "androidboot.hardware=redroid", "ro.setupwizard.mode=DISABLED"]' , so you avoid doing it manually at every container start, or if you want set `ro.setupwizard.mode=DISABLED` at container start, skipping the GApps setup wizard at redroid boot.
100 |
--------------------------------------------------------------------------------
/android-builder-docker/apt.conf:
--------------------------------------------------------------------------------
1 |
2 | Acquire::https::proxy "http://some-proxy:8080";
3 | Acquire::https::proxy "https://some-proxy:8080/";
4 |
--------------------------------------------------------------------------------
/android-builder-docker/sources.list:
--------------------------------------------------------------------------------
1 | deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
2 | deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
3 | deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
4 | deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
5 | deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
6 | deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
7 | deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
8 | deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
9 | deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
10 | deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
11 |
--------------------------------------------------------------------------------
/assets/redroid11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/remote-android/redroid-doc/2be3dc3dc33088e0cf13b61a06c094565d252b25/assets/redroid11.png
--------------------------------------------------------------------------------
/debug.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | usage="
4 | USAGE: $(basename "$0") [container] [-h]
5 |
6 | where:
7 | container: container id or container name
8 | "
9 |
10 | while getopts ':h' option; do
11 | case "$option" in
12 | *) echo "$usage" ;exit 0;;
13 | esac
14 | done
15 |
16 | container=$1
17 |
18 | if [[ -z "$container" ]]; then
19 | echo -n "Container name (leave empty if stopped):"
20 | read -r container < /dev/tty
21 | fi
22 |
23 | echo "Collecting, please wait..."
24 |
25 | tmp_dir=$(mktemp -d -t redroid-debug.XXXXXXXX)
26 | #echo "creating tmp dir: $tmp_dir"
27 |
28 | cd "$tmp_dir" || exit 1
29 |
30 | { cp /boot/config-"$(uname -r)" ./ || zcat /proc/config.gz > config-"$(uname -r)"; } &> /dev/null
31 |
32 | { grep binder /proc/filesystems; grep ashmem /proc/misc; } > drivers.txt
33 |
34 | uname -a &> uname.txt
35 |
36 | lscpu &> lscpu.txt
37 |
38 | getenforce &> getenforce.txt
39 |
40 | {
41 | lshw -C display
42 | ls -al /dev/dri/
43 | cat /sys/kernel/debug/dri/*/name;
44 | } &> dri.txt
45 |
46 | dmesg -T > dmesg.txt
47 |
48 | docker info &> docker-info.txt
49 |
50 | if [[ -n $container ]]; then
51 | docker exec "$container" ps -A &> ps.txt
52 | docker exec "$container" logcat -d &> logcat.txt
53 | docker exec "$container" logcat -d -b crash &> crash.txt
54 | docker exec "$container" /vendor/bin/vainfo -a &> vainfo.txt
55 | docker exec "$container" getprop &> getprop.txt
56 | docker exec "$container" dumpsys &> dumpsys.txt
57 |
58 | <<'EOF' >network.txt docker exec -i "$container" sh
59 | echo "************** ip a"
60 | ip a
61 | echo "************** ip rule"
62 | ip rule
63 | echo;echo "************** ip r show table eth0"
64 | ip r list table eth0
65 | EOF
66 | docker container inspect "$container" &> container-inspect.txt
67 | docker image inspect "$(docker container inspect -f '{{.Config.Image}}' "$container")" &> image-inspect.txt
68 | fi
69 |
70 | tmp_tar=${tmp_dir}.tgz
71 | tar czf "$tmp_tar" "$tmp_dir" &> /dev/null
72 |
73 | echo
74 | echo "==================================="
75 | echo "Please provide the collected logs"
76 | echo "(zh_CN) 请提供此处收集的日志"
77 | echo "${tmp_tar}"
78 | echo "==================================="
79 |
--------------------------------------------------------------------------------
/deploy/README.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid
2 |
3 | *redroid* should be able to run on any Linux environment as long as the
4 | required kernel features are available (`binderfs`, etc.). Fortunately, these
5 | kernel features are already enabled in some Linux distros
6 | (extra packages might needed). *redroid* also provides
7 | [redroid-modules](https://github.com/remote-android/redroid-modules) repo
8 | to support those distros without the required kernel features. And as last
9 | resort, it's always capable via customizing Linux kernel.
10 |
11 |
12 | **mandatory kernel features**
13 | - `binderfs`
14 | - `ashmem` / `memfd`
15 | - `IPv6`
16 | - `ION` / `DMA-BUF Heaps`
17 | - 4KB page size
18 | - ...
19 |
20 |
21 | **deployment per distro / platform**
22 | - [Alibaba-Cloud-Linux](alibaba-cloud-linux.md)
23 | - [Amazon-Linux](amazon-linux.md)
24 | - [Arch-Linux](arch-linux.md)
25 | - [CentOS](centos.md)
26 | - [Debian](debian.md)
27 | - [Deepin](deepin.md)
28 | - [Fedora](fedora.md)
29 | - [Gentoo](gentoo.md)
30 | - [Kubernetes](kubernetes.md)
31 | - [LXC](lxc.md)
32 | - [Mint](mint.md)
33 | - [OpenEuler](openeuler.md)
34 | - [openKylin](openkylin.md)
35 | - [PopOS](pop_os.md)
36 | - [Ubuntu](ubuntu.md)
37 | - [WSL](wsl.md)
38 |
39 |
40 | **general deploy redroid instructions**
41 | ```
42 | ## install docker https://docs.docker.com/engine/install/#server
43 | ## or use podman
44 |
45 | ## make sure required kernel features enabled; Check details on per distro page
46 |
47 | ## disable SELinux if present
48 | setenforce 0
49 |
50 | ## running redroid
51 | docker run -itd --rm --privileged \
52 | --pull always \
53 | -v ~/data11:/data \
54 | -p 5555:5555 \
55 | --name redroid11 \
56 | redroid/redroid:12.0.0_64only-latest
57 |
58 | ### Explanation:
59 | ### --pull always -- use latest image
60 | ### -v ~/data11:/data -- mount data partition
61 | ### -p 5555:5555 -- expose adb port
62 |
63 |
64 | ## install adb https://developer.android.com/studio#downloads
65 | adb connect localhost:5555
66 | ### NOTE: change localhost to IP if running redroid remotely
67 |
68 | ## view redroid screen
69 | ## install scrcpy https://github.com/Genymobile/scrcpy/blob/master/README.md#get-the-app
70 | scrcpy -s localhost:5555
71 | ### NOTE: change localhost to IP if running redroid remotely
72 | ### typically running scrcpy on your local PC
73 |
74 |
75 | ## running 64bit-only redroid
76 | ## only `aarch64` supported by some Arm platforms, the 64only image required here
77 | docker run -itd --rm --privileged \
78 | --pull always \
79 | -v ~/data12_64only:/data \
80 | -p 5555:5555 \
81 | --name redroid12_64only \
82 | redroid/redroid:12.0.0_64only-latest \
83 | ```
84 |
--------------------------------------------------------------------------------
/deploy/alibaba-cloud-linux.md:
--------------------------------------------------------------------------------
1 | # Deploy on Alibaba Cloud Linux
2 |
3 | Check [redroid-modules](https://github.com/remote-android/redroid-modules) to install
4 | required kernel modules.
5 |
6 | ```
7 | ## running redroid
8 | docker run -itd --rm --privileged \
9 | --pull always \
10 | -v ~/data11:/data \
11 | -p 5555:5555 \
12 | --name redroid11 \
13 | redroid/redroid:12.0.0_64only-latest
14 | ```
15 |
--------------------------------------------------------------------------------
/deploy/amazon-linux.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on Amazon Linux
2 | *5.4* / *4.14* kernel supported currently (*5.10* support still under construction).
3 |
4 | Check [redroid-modules](https://github.com/remote-android/redroid-modules) to install
5 | required kernel modules.
6 |
7 | ```
8 | ## redroid use fuse to emulate external storage
9 | modprobe fuse
10 |
11 | ## running redroid
12 | docker run -itd --rm --privileged \
13 | --pull always \
14 | -v ~/data11:/data \
15 | -p 5555:5555 \
16 | --name redroid11 \
17 | redroid/redroid:12.0.0_64only-latest
18 | ```
19 |
--------------------------------------------------------------------------------
/deploy/arch-linux.md:
--------------------------------------------------------------------------------
1 | # Deploy on Arch Linux
2 |
3 | ```
4 | ## install zen kernel
5 | pacman -S linux-zen
6 |
7 | ## run redroid
8 | docker run -itd --rm --privileged \
9 | --pull always \
10 | -v ~/data11:/data \
11 | -p 5555:5555 \
12 | --name redroid11 \
13 | redroid/redroid:12.0.0_64only-latest
14 | ```
15 |
--------------------------------------------------------------------------------
/deploy/centos.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on CentOS
2 | ```
3 | ## use custom 5.10 kernel
4 |
5 | ### enable kernel features for x86_64
6 |
7 | # codec2 required, can use ION for legacy kernel
8 | CONFIG_DMABUF_HEAPS=y
9 | CONFIG_DMABUF_HEAPS_SYSTEM=y
10 |
11 | # optional, can use memfd
12 | CONFIG_STAGING=y
13 | CONFIG_ASHMEM=y
14 |
15 | # binderfs required
16 | CONFIG_ANDROID=y
17 | CONFIG_ANDROID_BINDER_IPC=y
18 | CONFIG_ANDROID_BINDERFS=y
19 | CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
20 |
21 |
22 | ### extra kernel features for arm64
23 |
24 | CONFIG_COMPAT=y
25 | CONFIG_COMPAT_32BIT_TIME=y
26 |
27 | CONFIG_ARM64_4K_PAGES=y
28 |
29 |
30 | ## disable SELinux temporarily
31 | setenforce 0
32 |
33 | ## running redroid
34 | docker run -itd --rm --privileged \
35 | --pull always \
36 | -v ~/data11:/data \
37 | -p 5555:5555 \
38 | --name redroid11 \
39 | redroid/redroid:12.0.0_64only-latest
40 | ```
41 |
--------------------------------------------------------------------------------
/deploy/debian.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on Debian
2 |
3 | ```
4 | ##############################
5 | ## Debian 12
6 | ## Debian 11
7 | ##############################
8 |
9 | ### add binder devices
10 | modprobe binder_linux devices=binder1,binder2,binder3,binder4,binder5,binder6
11 | chmod 666 /dev/binder*
12 |
13 | ### start redroid
14 | docker run -itd --rm --privileged \
15 | --pull always \
16 | -v /dev/binder1:/dev/binder \
17 | -v /dev/binder2:/dev/hwbinder \
18 | -v /dev/binder3:/dev/vndbinder \
19 | -v ~/data11:/data \
20 | -p 5555:5555 \
21 | --name redroid11 \
22 | redroid/redroid:12.0.0_64only-latest
23 |
24 |
25 | ### NOTE:
26 | ### try enable binderfs in kernel to run unlimited redroid containers
27 | ### no need to mount binder devices if binderfs enabled
28 |
29 | CONFIG_ANDROID_BINDER_IPC=y
30 | CONFIG_ANDROID_BINDERFS=y
31 | CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
32 | ```
33 |
--------------------------------------------------------------------------------
/deploy/deepin.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on Deepin
2 |
3 | ```
4 | ##############################
5 | ## Deepin 23
6 | ##############################
7 |
8 | ### install podman or docker
9 | apt install podman
10 |
11 | ### start redroid
12 | mkdir ~/data11
13 | podman run -itd --rm --privileged \
14 | --pull always \
15 | -v ~/data11:/data \
16 | -p 5555:5555 \
17 | --name redroid11 \
18 | redroid/redroid:12.0.0_64only-latest
19 |
20 |
21 | ##############################
22 | ## Deepin 20.9
23 | ##############################
24 |
25 | chmod 666 /dev/{,hw,vnd}binder
26 |
27 | ### install podman: https://github.com/mgoltzsche/podman-static
28 |
29 | ### start redroid
30 | mkdir ~/data11
31 | podman run -itd --rm --privileged \
32 | --pull always \
33 | -v ~/data11:/data \
34 | -p 5555:5555 \
35 | --name redroid11 \
36 | redroid/redroid:12.0.0_64only-latest
37 |
38 | ### NOTE:
39 | ### You can start only one redroid container at the same time.
40 | ### Try enable `binderfs` if want to start unlimit redroid containers.
41 | ```
42 |
--------------------------------------------------------------------------------
/deploy/fedora.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on Fedora
2 |
3 | ```
4 | ##############################
5 | ## Fedora 39
6 | ##############################
7 |
8 | ## disable selinux
9 | grubby --update-kernel ALL --args selinux=0
10 | grub2-mkconfig > /boot/grub2/grub.cfg
11 | reboot
12 |
13 | ## add possible missing kernel modules
14 | modprobe nfnetlink
15 |
16 | ## start redroid
17 | docker run -itd --rm --privileged \
18 | --pull always \
19 | -v ~/data11:/data \
20 | -p 5555:5555 \
21 | --name redroid11 \
22 | redroid/redroid:12.0.0_64only-latest
23 |
24 |
25 | ##############################
26 | ## Fedora 38
27 | ##############################
28 |
29 | ## disable selinux
30 | grubby --update-kernel ALL --args selinux=0
31 | grub2-mkconfig > /boot/grub2/grub.cfg
32 | reboot
33 |
34 | ## start redroid
35 | docker run -itd --rm --privileged \
36 | --pull always \
37 | -v ~/data11:/data \
38 | -p 5555:5555 \
39 | --name redroid11 \
40 | redroid/redroid:12.0.0_64only-latest
41 | ```
42 |
--------------------------------------------------------------------------------
/deploy/gentoo.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on Gentoo
2 |
3 | ```
4 | ## tested on 5.18.5-gentoo-dist kernel
5 | ## binderfs etc. already enabled
6 |
7 | ## run redroid
8 | docker run -itd --rm --privileged \
9 | --pull always \
10 | -v ~/data11:/data \
11 | -p 5555:5555 \
12 | --name redroid11 \
13 | redroid/redroid:12.0.0_64only-latest
14 | ```
15 |
--------------------------------------------------------------------------------
/deploy/kubernetes.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on K8S
2 |
3 | **Make sure required kernel features available, check details on [README.md](README.md)**
4 |
5 | ```
6 | kubectl apply -k kubernetes/overlays/
7 | ```
8 |
--------------------------------------------------------------------------------
/deploy/kubernetes/base/kustomization.yaml:
--------------------------------------------------------------------------------
1 | resources:
2 | - sts.yaml
3 |
--------------------------------------------------------------------------------
/deploy/kubernetes/base/sts.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: StatefulSet
3 | metadata:
4 | name: redroid11
5 | spec:
6 | selector:
7 | matchLabels:
8 | app: redroid11
9 | replicas: 1
10 | serviceName: redroid
11 | template:
12 | metadata:
13 | labels:
14 | app: redroid11
15 | spec:
16 | terminationGracePeriodSeconds: 0
17 | containers:
18 | - name: redroid
19 | image: redroid/redroid:12.0.0_64only-latest
20 | readinessProbe:
21 | exec:
22 | command:
23 | - /system/bin/sh
24 | - -c
25 | - test "1" = "`/system/bin/getprop sys.boot_completed`"
26 | initialDelaySeconds: 5
27 | securityContext:
28 | privileged: True
29 | stdin: true
30 | tty: true
31 | volumeMounts:
32 | - name: data
33 | mountPath: /data
34 | volumes:
35 | - name: data
36 | emptyDir: {}
37 |
--------------------------------------------------------------------------------
/deploy/kubernetes/overlays/10.0.0/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | images:
5 | - name: redroid/redroid
6 | newTag: 10.0.0-latest
7 |
8 | patches:
9 | - target:
10 | kind: StatefulSet
11 | patch: |-
12 | - op: replace
13 | path: /metadata/name
14 | value: redroid10
15 | - op: replace
16 | path: /spec/replicas
17 | value: 1
18 | - op: replace
19 | path: /spec/selector/matchLabels/app
20 | value: redroid10
21 | - op: replace
22 | path: /spec/template/metadata/labels/app
23 | value: redroid10
24 |
--------------------------------------------------------------------------------
/deploy/kubernetes/overlays/11.0.0/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | images:
5 | - name: redroid/redroid
6 | newTag: 11.0.0-latest
7 |
8 | patches:
9 | - target:
10 | kind: StatefulSet
11 | patch: |-
12 | - op: replace
13 | path: /metadata/name
14 | value: redroid11
15 | - op: replace
16 | path: /spec/replicas
17 | value: 1
18 | - op: replace
19 | path: /spec/selector/matchLabels/app
20 | value: redroid11
21 | - op: replace
22 | path: /spec/template/metadata/labels/app
23 | value: redroid11
24 |
--------------------------------------------------------------------------------
/deploy/kubernetes/overlays/12.0.0-64only/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | images:
5 | - name: redroid/redroid
6 | newTag: 12.0.0-64only-latest
7 |
8 | patches:
9 | - target:
10 | kind: StatefulSet
11 | patch: |-
12 | - op: replace
13 | path: /metadata/name
14 | value: redroid12-64only
15 | - op: replace
16 | path: /spec/replicas
17 | value: 1
18 | - op: replace
19 | path: /spec/selector/matchLabels/app
20 | value: redroid12-64only
21 | - op: replace
22 | path: /spec/template/metadata/labels/app
23 | value: redroid12-64only
24 |
--------------------------------------------------------------------------------
/deploy/kubernetes/overlays/12.0.0/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | images:
5 | - name: redroid/redroid
6 | newTag: 12.0.0-latest
7 |
8 | patches:
9 | - target:
10 | kind: StatefulSet
11 | patch: |-
12 | - op: replace
13 | path: /metadata/name
14 | value: redroid12
15 | - op: replace
16 | path: /spec/replicas
17 | value: 1
18 | - op: replace
19 | path: /spec/selector/matchLabels/app
20 | value: redroid12
21 | - op: replace
22 | path: /spec/template/metadata/labels/app
23 | value: redroid12
24 |
--------------------------------------------------------------------------------
/deploy/kubernetes/overlays/13.0.0/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | images:
5 | - name: redroid/redroid
6 | newTag: 13.0.0-latest
7 |
8 | patches:
9 | - target:
10 | kind: StatefulSet
11 | patch: |-
12 | - op: replace
13 | path: /metadata/name
14 | value: redroid13
15 | - op: replace
16 | path: /spec/replicas
17 | value: 1
18 | - op: replace
19 | path: /spec/selector/matchLabels/app
20 | value: redroid13
21 | - op: replace
22 | path: /spec/template/metadata/labels/app
23 | value: redroid13
24 |
--------------------------------------------------------------------------------
/deploy/kubernetes/overlays/8.1.0/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | images:
5 | - name: redroid/redroid
6 | newTag: 8.1.0-latest
7 |
8 | patches:
9 | - target:
10 | kind: StatefulSet
11 | patch: |-
12 | - op: replace
13 | path: /metadata/name
14 | value: redroid8
15 | - op: replace
16 | path: /spec/replicas
17 | value: 1
18 | - op: replace
19 | path: /spec/selector/matchLabels/app
20 | value: redroid8
21 | - op: replace
22 | path: /spec/template/metadata/labels/app
23 | value: redroid8
24 |
--------------------------------------------------------------------------------
/deploy/kubernetes/overlays/9.0.0/kustomization.yaml:
--------------------------------------------------------------------------------
1 | bases:
2 | - ../../base
3 |
4 | images:
5 | - name: redroid/redroid
6 | newTag: 9.0.0-latest
7 |
8 | patches:
9 | - target:
10 | kind: StatefulSet
11 | patch: |-
12 | - op: replace
13 | path: /metadata/name
14 | value: redroid9
15 | - op: replace
16 | path: /spec/replicas
17 | value: 1
18 | - op: replace
19 | path: /spec/selector/matchLabels/app
20 | value: redroid9
21 | - op: replace
22 | path: /spec/template/metadata/labels/app
23 | value: redroid9
24 |
--------------------------------------------------------------------------------
/deploy/kubernetes/overlays/autogen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | REPLICAS=1
4 |
5 | for ver in 8.1.0 {9..13}.0.0 {12..12}.0.0-64only
6 | do
7 |
8 | base_ver=`echo $ver | cut -d'.' -f 1`
9 | [[ $ver == *"-64only" ]] && base_ver+='-64only'
10 |
11 | [ -d $ver ] || mkdir $ver
12 | cat > $ver/kustomization.yaml <<-END
13 | bases:
14 | - ../../base
15 |
16 | images:
17 | - name: redroid/redroid
18 | newTag: $ver-latest
19 |
20 | patches:
21 | - target:
22 | kind: StatefulSet
23 | patch: |-
24 | - op: replace
25 | path: /metadata/name
26 | value: redroid$base_ver
27 | - op: replace
28 | path: /spec/replicas
29 | value: $REPLICAS
30 | - op: replace
31 | path: /spec/selector/matchLabels/app
32 | value: redroid$base_ver
33 | - op: replace
34 | path: /spec/template/metadata/labels/app
35 | value: redroid$base_ver
36 | END
37 |
38 | done
39 |
--------------------------------------------------------------------------------
/deploy/lxc.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid via LXC
2 |
3 | ```
4 | ## take Ubuntu 22.04 as example here
5 | ## adjust for other Linux distros
6 |
7 | ## install required kernel modules
8 | apt install linux-modules-extra-`uname -r`
9 | modprobe binder_linux devices="binder,hwbinder,vndbinder"
10 |
11 | ## install lxc tools
12 | apt install lxc-utils
13 |
14 | ## check lxc netowrking
15 | systemctl --no-pager status lxc-net
16 |
17 | ## adjust oci template
18 | sed -i 's/set -eu/set -u/g' /usr/share/lxc/templates/lxc-oci
19 |
20 | ## install required tools
21 | apt install skopeo umoci jq
22 |
23 | ## create redroid container
24 | lxc-create -n redroid11 -t oci -- -u docker://docker.io/redroid/redroid:12.0.0_64only-latest
25 |
26 | ## adjust container config
27 | mkdir $HOME/data-redroid11
28 | sed -i '/lxc.include/d' /var/lib/lxc/redroid11/config
29 | <> /var/lib/lxc/redroid11/config
30 | ### hacked
31 | lxc.init.cmd = /init androidboot.hardware=redroid androidboot.redroid_gpu_mode=guest
32 | lxc.apparmor.profile = unconfined
33 | lxc.autodev = 1
34 | lxc.autodev.tmpfs.size = 25000000
35 | lxc.mount.entry = $HOME/data-redroid11 data none bind 0 0
36 | EOF
37 |
38 | ## [workaround] for redroid networking
39 | rm /var/lib/lxc/redroid11/rootfs/vendor/bin/ipconfigstore
40 |
41 | ## start redroid container
42 | lxc-start -l debug -o redroid11.log -n redroid11
43 |
44 | ## check container info
45 | lxc-info redroid11
46 |
47 | ## grab adb shell
48 | adb connect `lxc-info redroid11 -i | awk '{print $2}'`:5555
49 |
50 | ## or execute sh directly
51 | nsenter -t `lxc-info redroid11 -p | awk '{print $2}'` -a sh
52 |
53 | ## stop redroid container
54 | lxc-stop -k redroid11
55 | ```
56 |
--------------------------------------------------------------------------------
/deploy/mint.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on Linux Mint
2 |
3 | Same as [Ubuntu](ubuntu.md)
4 |
--------------------------------------------------------------------------------
/deploy/openeuler.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on OpenEuler
2 |
3 | ```
4 | ## use custom kernel 5.10.* LTS
5 |
6 | # codec2 required
7 | CONFIG_DMABUF_HEAPS=y
8 | CONFIG_DMABUF_HEAPS_SYSTEM=y
9 |
10 | # optional, can use memfd
11 | CONFIG_STAGING=y
12 | CONFIG_ASHMEM=y
13 |
14 | # binderfs required
15 | CONFIG_ANDROID=y
16 | CONFIG_ANDROID_BINDER_IPC=y
17 | CONFIG_ANDROID_BINDERFS=y
18 | CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
19 |
20 |
21 | ## run redroid
22 | docker run -itd --rm --privileged \
23 | --pull always \
24 | -v ~/data11:/data \
25 | -p 5555:5555 \
26 | --name redroid11 \
27 | redroid/redroid:12.0.0_64only-latest
28 | ```
29 |
--------------------------------------------------------------------------------
/deploy/openkylin.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on openKylin
2 |
3 | ```
4 | ##############################
5 | ## openKylin 2
6 | ##############################
7 |
8 | chmod 666 /dev/{,hw,vnd}binder
9 |
10 | ### start redroid
11 | docker run -itd --rm --privileged \
12 | --pull always \
13 | -v ~/data11:/data \
14 | -p 5555:5555 \
15 | --name redroid11 \
16 | redroid/redroid:12.0.0_64only-latest
17 |
18 | ### NOTE:
19 | ### You can start only one redroid container at the same time.
20 | ### Try enable `binderfs` if want to start unlimit redroid containers.
21 | ```
22 |
--------------------------------------------------------------------------------
/deploy/pop_os.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on Pop!_OS
2 |
3 | ```
4 | ##############################
5 | ## Pop!_OS 22.04
6 | ##############################
7 |
8 | ## install linux-xanmod (https://xanmod.org) to get binderfs support
9 |
10 | ## enable PSI in /etc/default/grub
11 | ## GRUB_CMDLINE_LINUX_DEFAULT="... psi=1"
12 |
13 | ## run redroid
14 | docker run -itd --rm --privileged \
15 | --pull always \
16 | -v ~/data11:/data \
17 | -p 5555:5555 \
18 | --name redroid11 \
19 | redroid/redroid:12.0.0_64only-latest
20 | ```
21 |
--------------------------------------------------------------------------------
/deploy/ubuntu.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on ubuntu
2 | ```
3 | ##############################
4 | ## Ubuntu 22.04
5 | ##############################
6 |
7 | ## install required kernel modules
8 | apt install linux-modules-extra-`uname -r`
9 | modprobe binder_linux devices="binder,hwbinder,vndbinder"
10 | ### optional module (removed since 5.18)
11 | modprobe ashmem_linux
12 |
13 | ## running redroid
14 | docker run -itd --rm --privileged \
15 | --pull always \
16 | -v ~/data11:/data \
17 | -p 5555:5555 \
18 | --name redroid11 \
19 | redroid/redroid:12.0.0_64only-latest
20 |
21 |
22 | ##############################
23 | ## Ubuntu 20.04
24 | ##############################
25 |
26 | ## install required kernel modules
27 | apt install linux-modules-extra-`uname -r`
28 | modprobe binder_linux devices="binder,hwbinder,vndbinder"
29 | ### optional module (removed since 5.18)
30 | modprobe ashmem_linux
31 |
32 | ## running redroid normally
33 |
34 |
35 | ##############################
36 | ## Ubuntu 18.04
37 | ##############################
38 |
39 | ## upgrade kernel (5.0+)
40 | apt install linux-generic-hwe-18.04
41 |
42 | ## add possible missing kernel module
43 | modprobe nfnetlink
44 |
45 | ## install required kernel modules
46 | modprobe binder_linux devices="binder,hwbinder,vndbinder"
47 | ### optional module (removed since 5.18)
48 | modprobe ashmem_linux
49 |
50 | ## running redroid normally
51 | ```
52 |
--------------------------------------------------------------------------------
/deploy/wsl.md:
--------------------------------------------------------------------------------
1 | # Deploy redroid on WSL2
2 |
3 | ```
4 | ##############################
5 | ## 5.15
6 | ## 5.10
7 | ##############################
8 |
9 | ## download WSL kernel source from https://github.com/microsoft/WSL2-Linux-Kernel/tags
10 |
11 | tar xf tar xf linux-msft-wsl-*.tar.gz
12 | cd WSL2-Linux-Kernel-linux-msft-wsl-*
13 | cp Microsoft/config-wsl .config
14 |
15 | ## enable following kernel features
16 |
17 | # ipv6 should enabled
18 | CONFIG_IPV6_ROUTER_PREF=y
19 | CONFIG_IPV6_ROUTE_INFO=y
20 | CONFIG_IPV6_MULTIPLE_TABLES=y
21 | CONFIG_IPV6_SUBTREES=y
22 |
23 | # codec2 required, can use ION for legacy kernel
24 | CONFIG_DMABUF_HEAPS=y
25 | CONFIG_DMABUF_HEAPS_SYSTEM=y
26 |
27 | # optional, can use memfd
28 | CONFIG_STAGING=y
29 | CONFIG_ASHMEM=y
30 |
31 | # binderfs required
32 | CONFIG_ANDROID=y
33 | CONFIG_ANDROID_BINDER_IPC=y
34 | CONFIG_ANDROID_BINDERFS=y
35 | CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"
36 |
37 | ## install required libraries to build kernel
38 | sudo apt install make gcc flex bison libssl-dev libelf-dev dwarves -y
39 |
40 | ## build kernel
41 | make
42 |
43 | ## built kernel located in `arch/x86_64/boot/bzImage`
44 |
45 | ## follow https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configuration-setting-for-wslconfig
46 | ## to use this new kernel
47 | <> .wslconfig
48 | [wsl2]
49 | kernel=
50 | EOF
51 |
52 |
53 | ## running redroid
54 | docker run -d --rm \
55 | --privileged \
56 | -v ~/redroid-data:/data \
57 | -p 5555:5555 \
58 | --name redroid \
59 | redroid/redroid
60 | ```
61 |
--------------------------------------------------------------------------------