2024-07-08
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Initial address:https://mp.weixin.qq.com/s/1e8er_amC94DTVCaNbSuUw
I didn't bother with this thing to play games or anything, I just wanted to be less dependent on my phone when reverse engineering apps. After all, the steps to flash a phone are pretty annoying, and it's easy to brick it if you're not careful.
Some apps that do not strictly require environment detection can be tested on it, which is also convenient for changing the system source code and flashing the machine later. Unfortunately, it is impossible to customize the kernel (redroid and Waydroid both use container solutions and share the kernel with the host). If you want to customize the kernel, you can only use Google's cuttlefish or avd, but these have limited support on arm. They can run but there is no GPU acceleration. I will try cuttlefish later.
I won’t go into the details of how to flash Ubuntu to the Orange Pi. If you are interested, please read the previous article:Orange Pi 5 Plus boots Ubuntu from SSDIf you flash this system, you don't need to install or configure anything to run redroid. However, if you want to use virtual WIFI or ebpf, you still have to modify the kernel parameters and compile the Linux kernel yourself to achieve it. The next article will explain the compilation process in detail.
Official tutorial:https://github.com/remote-android/redroid-doc
grep binder /proc/filesystems
grep ashmem /proc/misc
If nothing is printed, you may need to start it manually (I used the following two commands on a Kunpeng 920 machine with Ubuntu installed. Although this machine has an AMD graphics card, it cannot directly call the GPU)
sudo modprobe ashmem_linux
sudo modprobe binder_linux devices=binder,hwbinder,vndbinder
If these two commands report an error or have no effect, it may be that the current Linux kernel does not have these two features enabled. You need to refer to the following repository instructions to install a supported kernel or compile a kernel to enable these two features:https://github.com/remote-android/redroid-modules
It can be started using the official docker image, but there is no GPU acceleration, and the video is soft decoded (CPU simulation), so the operation is a bit stuck.issue[1]Searching for rk3588 in the article will reveal several comments related to GPU acceleration.
But no one has shared how to compile an image with GPU acceleration. The only helpful conclusion from the comments is: get some GPU acceleration related driver files from the official Orange Pi SDK source code and compile them together with the Android source code. Or directly copy these files into the Docker container and restart the container.
This conclusion is too vague, and there must be many pitfalls, so I never tried it. Until a big guy sent a completeCompilation process and source code[2]:
The tutorial is very detailed, and you can compile it once according to the steps.And the big guys[3]One thing is added based on this image.
So here we use thisThe mirror image of the boss[4]Before that, let's take a look at the dependencies he mentioned (kernel version 5.10.160 and mali ddk g18p0):
That should be no problem. It also mentioned thatmali_csffw.bin
Copy the file to/lib/firmware/
I checked the folder and found this file.
The default is linkedg15p0
, so we delete this soft link and create a new link tog18p0
However, after testing,g15p0
The redroid container can also use the GPU normally.
The video flashing test was also OK. I can only say that it was not stuck, nor was it smooth. After all, the configuration of mobile phones is very high now, which is much smoother than this development board.
sudo apt install docker.io -y
sudo usermod -aG docker $USER
sudo chmod a rw /var/run/docker.sock
The last two lines of commands are for ordinary users to run docker without adding sudo.
Then pull the image: docker pull cnflysky/redroid-rk3588:12.0.0-latest
。
docker run -d --privileged
-p 5555:5555
-v ~/redroid-data:/data
--name redroid
cnflysky/redroid-rk3588:12.0.0-latest androidboot.redroid_height=1920 androidboot.redroid_width=1080 androidboot.redroid_magisk=1 androidboot.redroid_virt_wifi=1
Then connect to this port with adb (adb connect 192.168.31.208:5555
) can be usedQtScrcpy
See the desktop of this container
First install aida64 to see if the graphics card call is normal:
If the graphics card uses mali-G610 for rendering, then there is no problem, and the refresh rate is also 60hz. If soft decoding is used, the refresh rate is only 15hz.
When this container is started, it brings aandroidboot.redroid_magisk=1
Just turn on magisk, so you can see that magisk is running normally after booting up. You may be asked to restart when you click in for the first time.docker restart redroid
After restarting it can be used normally.
First, open zygisk in magisk, and then use adb push command to push the lsposed installation package into the container. Then install it in Modules, and then restart to see that lsposed is running normally.
Just install an xposed module and you can enter the lsposed settings interface.
OfficiallyTutorial[5]How to compile a docker image with gapps, but even with gapps it won't pass Google'ssafetynet
Verification, many APPs cannot be used.
Someone asked about it in the issue, but there is no solution:https://github.com/remote-android/redroid-doc/issues/378
. The downloaded images include Google Store.
I read the issue and found that if you don't set up virtual WIFI, some software will think there is no network even if there is network, such as QQ. This is because they only detect WIFI and traffic, both of which are not available in the docker container. However, I tested and found that many software will show no network when there is virtual WIFI, and can connect to the network normally without virtual WIFI, so it is recommended not to turn it on, just know that there is such a thing.
So you need to create a virtual WIFI in the container.Kernel support[6]
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
Switch toip6tables-legacy
After that, Docker needs to restart the servicesudo systemctl restart docker
, restarting the machine is useless, and it will cause the container to have no network.
The installed system kernel does not have this parameter enabled.zcat /proc/config.gz | grep CONFIG_MAC80211_HWSIM
The kernel code provided by GitHub is very simple to compile, and it can be compiled in one step, but unfortunately there is no option to modify kernel parameters, and when you modify the kernel configuration file, it will be changed back during compilation.
After a few days of struggling, I went through all the issues but still couldn't find the answer. I had no choice but to look at the compilation script myself. The specific process will be discussed in the next article. The compiled kernel is provided here.
Kernel deb package download address, system useUbuntu22[7]:https://www.123pan.com/s/ihEKVv-TbOx.html
Extraction code:AZ3A
In addition to the above parameters, I also added ebpf related parameters, which will be discussed later.
First withuname -a
Check the current kernel information
First transfer the compiled kernel file to the machine, then runsudo dpkg -i *.deb
There are five deb files in total. The first one is the build information and can be installed.
Then usesudo reboot
Reboot and check the kernel information.
The kernel parameters are also enabled normally:
After updating the kernel and restarting, the previously created container lost its internet connection, and only the container created later could access the internet normally. At first I thought there was something wrong with the kernel, so I had to flash the system again and recompile the kernel.
Although there is internet, the videos on Bilibili cannot be refreshed. I can only refresh the homepage, and the browser cannot access the webpage. (Note: You must first connect to the virtual WIFI in the settings to have internet)
According to the description in this:https://github.com/CNflysky/redroid-rk3588/issues/2
Is it guaranteed to be wireless only? Although I don't understand what it means, can it only be connected by one router?ip route
By default, there are two routes.
The second one is a virtual WIFI, so why don’t I delete the first one and try: ip route del 192.168.200.0/24 dev radio0 proto kernel scope link src 192.168.200.2
I found that sometimes the video can be played when there is a network, but most of the time it is stuck and takes some time to load the video, but refreshing the homepage is very fast and loading comments is also very fast. Changing the DNS does not work. I will try other software later to see if it is the same.
You can refer to:https://github.com/CNflysky/redroid-rk3588/issues/5
, I won't try it. According to the instructions of redroid, you can also specify a proxy when starting. If you set a vpn globally, adb may disconnect.
You may fail, just try a few more times.
https://github.com/remote-android/redroid-doc/issues?q=rk3588
https://github.com/redroid-rockchip
https://blog.csdn.net/CNflysky/article/details/136452455
https://github.com/CNflysky/redroid-rk3588
https://github.com/remote-android/redroid-doc/blob/master/android-builder-docker/README.md
https://github.com/redroid-rockchip/vendor_redroid_ext/tree/master/wifi
https://github.com/Joshua-Riek/ubuntu-rockchip/releases