在RK3588开发板上使用AIC(Android IN Container)!

在RK3588开发板上使用AIC(Android IN Container)!

canoziia
2023-07-15 / 3 评论 / 1,216 阅读 / 正在检测是否收录...

系统: https://github.com/Joshua-Riek/ubuntu-rockchip

镜像1: shangzebei/rk3588
感谢shangzebei ( https://github.com/rk-docker/rk-gpu )
issue https://github.com/remote-android/redroid-doc/issues/362

镜像2: chisbread/rk3588-gaming:redroid-firefly
感谢malior团队 https://github.com/ChisBread/malior#malior-redroid
以及zhz https://zhz.moe/57/

docker-compose.yml

version: "3"
services:
  android:
    image: shangzebei/rk3588
    container_name: android
    network_mode: bridge
    privileged: true
    restart: always
    stdin_open: true
    tty: true
    volumes:
      - /root/app/android/data:/data
      - /dev/mali0:/dev/mali0
    ports:
      - 5555:5555
    # devices: # 不要用device传递/dev/mali0!
    command:
      - androidboot.redroid_width=2560
      - androidboot.redroid_height=1440
      - androidboot.redroid_dpi=480
      # - androidboot.redroid_gpu_mode=auto
      - androidboot.redroid_gpu_mode=host # 用shangzebei/rk3588的话选mali
      # - androidboot.redroid_net_proxy_type=static
      # - androidboot.redroid_net_proxy_host=x.x.x.x
      # - androidboot.redroid_net_proxy_port=7890
      # - androidboot.redroid_net_proxy_exclude_list=localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*
# 有这两个能运行安卓容器
grep binder /proc/filesystems
grep ashmem /proc/misc

# 安装v4l2loopback, 创建/dev/video1
sudo apt install v4l2loopback-dkms
sudo modprobe v4l2loopback video_nr=1

# 安装scrcpy最新版
# for Debian/Ubuntu
sudo apt install ffmpeg libsdl2-2.0-0 adb wget \
                 gcc git pkg-config meson ninja-build libsdl2-dev \
                 libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
                 libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
git clone https://github.com/Genymobile/scrcpy
cd scrcpy
./install_release.sh
scrcpy --tcpip=127.0.0.1 --v4l2-sink=/dev/video1 --video-codec=h265 --video-encoder='c2.rk.hevc.encoder' # --no-video-playback --window-borderless
root@nanopc-t6:/# cat /etc/systemd/system/bilibili.service 
[Unit]
Description=BilibiliLiver
After=android-display.service
Requires=android-display.service

[Service]
WorkingDirectory=/home/canoziia/app/bilibili
ExecStart=/home/canoziia/app/bilibili/BilibiliLiver
Restart=always
# SyslogIdentifier=BilibiliLiver Tool
Type=simple

[Install]
WantedBy=default.target
root@nanopc-t6:/# cat /etc/systemd/system/android-display.service 
[Unit]
Description=Android Display
After=docker.services
Requires=docker.services

[Service]
ExecStart=scrcpy --tcpip=127.0.0.1 --v4l2-sink=/dev/video4 --video-codec=h265 --video-encoder='c2.rk.hevc.encoder' --no-video-playback --require-audio
# --v4l2-buffer=300
Restart=always
Type=simple

[Install]
WantedBy=default.target
version: "3"
services:
  android:
    image: shangzebei/rk3588
    container_name: android
    network_mode: bridge
    privileged: true
    restart: always
    volumes:
      - /Data/android/data:/data
      - /dev/mali0:/dev/mali0
    ports:
      - 5555:5555
    # devices: # 不要用device传递/dev/mali0!
    command:
      - androidboot.redroid_width=1440
      - androidboot.redroid_height=2560
      - androidboot.redroid_dpi=480
      # - androidboot.redroid_gpu_mode=auto
      - androidboot.redroid_gpu_mode=mali
      - androidboot.redroid_net_proxy_type=static
      - androidboot.redroid_net_proxy_host=192.168.31.2
      - androidboot.redroid_net_proxy_port=7890
      - androidboot.redroid_net_proxy_exclude_list=localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*


# grep binder /proc/filesystems
# grep ashmem /proc/misc
# # for Debian/Ubuntu
# sudo apt install ffmpeg libsdl2-2.0-0 adb wget \
#                  gcc git pkg-config meson ninja-build libsdl2-dev \
#                  libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
#                  libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
# git clone https://github.com/Genymobile/scrcpy
# cd scrcpy
# ./install_release.sh
# scrcpy --tcpip=127.0.0.1 --v4l2-sink=/dev/video1 --video-codec=h265 --video-encoder='c2.rk.hevc.encoder'
1

评论 (3)

取消
  1. 头像
    知了
    MacOS · Google Chrome

    apt install linux-modules-extra-uname -r
    modprobe binder_linux devices="binder,hwbinder,vndbinder"
    modprobe ashmem_linux

    楼主这个必要条件自已编译的内核吗?

    回复
    1. 头像
      canoziia 作者
      Windows 10 · Google Chrome
      @ 知了

      我用的内核刚好有。github上的ubuntu-rockchip

      回复
  2. 头像
    hi
    Windows 10 · Google Chrome

    画图

    回复