谁家套娃高手?不过用的redroid,跑docker,关系不大,懒得单独开安卓x86虚拟机了
更换内核&添加驱动
懒得编译,直接找个现成的省事!
使用xanmod的内核
# 添加源
sudo apt update && sudo apt install -y wget gpg
# 注册 GPG 密钥
wget -qO - https://dl.xanmod.org/archive.key | sudo gpg --dearmor -o /usr/share/keyrings/xanmod-archive-keyring.gpg
# 添加软件源仓库
echo 'deb [signed-by=/usr/share/keyrings/xanmod-archive-keyring.gpg] http://deb.xanmod.org releases main' | sudo tee /etc/apt/sources.list.d/xanmod-release.list
# 更新
sudo apt update
# 安装内核
sudo apt install -y linux-xanmod-x64v3
sudo reboot
# 检查是否生效
uname -r
# ->返回结果6.18.4-x64v3-xanmod1(包含xanmod)
grep "CONFIG_ANDROID_BINDERFS" /boot/config-$(uname -r)
# ->返回结果CONFIG_ANDROID_BINDERFS=m(结果为m)启动模块 modprobe -v binder_linux devices="binder,hwbinder,vndbinder"
# 开机自动配置
sudo echo 'options binder_linux devices="binder,hwbinder,vndbinder"' | sudo tee /etc/modprobe.d/binder_linux.conf
options binder_linux devices="binder,hwbinder,vndbinder"
sudo echo "binder_linux" | sudo tee /etc/modules-load.d/binder_linux.conf
# 检查
lsmod | grep -e binder
# ->应该有回显binder_linux编译核显驱动(以6.18.4-x64v3-xanmod1为例)
# 编译前工具下载
apt install build-* dkms linux-headers-$(uname -r) clang llvm lld
# 下载驱动文件,自动编译
wget -P /tmp https://ghfast.top/https://github.com/strongtz/i915-sriov-dkms/releases/download/2025.12.10/i915-sriov-dkms_2025.12.10_amd64.deb
sudo apt install /tmp/i915-sriov-dkms_2025.12.10_amd64.deb
# 启动参数
sudo nano /etc/default/grub
# 在GRUB_CMDLINE_LINUX_DEFAULT后面添加
i915.enable_guc=3
# 更新重启
sudo update-grub
sudo reboot
# 检查是否生效
sudo dmesg | grep i915
# ->返回结果i915: You are using the i915-sriov-dkms module, a ported version of the i915/xe module with SR-IOV support.下载镜像&安卓启动!
拉取redroid镜像
安卓11有问题,得安卓12及以上
我这里用的erstt佬的镜像
docker run -itd \
--privileged \
--name redroid \
-p 5555:5555 \
--device /dev/dri \
--device /dev/binder \
-v ~/redroid/data:/data \
erstt/redroid:12.0.0_houdini_MUMU \
androidboot.redroid_gpu_mode=host \
androidboot.use_memfd=1 \
ro.enable.native.bridge.exec64=1 \
ro.dalvik.vm.native.bridge=libhoudini.so莫名奇妙卡顿?
我的问题:安卓系统卡死,一开始怀疑显卡,但是隔壁飞牛都能正常用,后排查是缺参数了
sudo nano /etc/default/grub
# 在GRUB_CMDLINE_LINUX_DEFAULT后面添加
psi=1 cgroup_enable=memory cgroup_memory=1 systemd.unified_cgroup_hierarchy=0"
# ps:如果跟着我走,你现在参数应该是这样
# GRUB_CMDLINE_LINUX_DEFAULT="quiet i915.enable_guc=3 psi=1 cgroup_enable=memory cgroup_memory=1 systemd.unified_cgroup_hierarchy=0"
# 更新重启
sudo update-grub
sudo reboot温馨提示:善用AI
# 显示内核日志,先输命令,再打开redroid容器,把内核日志丢给ai解决
sudo dmesg -w结语
wow,耗费了我3天时间,终于把安卓容器部署到位了,希望我的这篇博客能帮助到你,
评论