# 检测kvm支持
grep -c -w "vmx\|svm" /proc/cpuinfo
apt install -y cpu-checker
kvm-ok
# 环境
apt install -y sudo libfdt-dev git devscripts config-package-dev debhelper-compat bridge-utils libarchive-tools golang curl
# 拉取源码
cd /opt && git clone https://github.com/google/android-cuttlefish.git
cd android-cuttlefish
git checkout origin/steve-dir-fix
# 宿主机编译方式
vim build.sh
for dir in base frontend; do
pushd $dir
dpkg-buildpackage -uc -us
popd
done
chmod -R 777 ./build.sh && ./build.sh
sudo apt install ./cuttlefish-base_*.deb ./cuttlefish-user_*.deb
# docker编译方式
curl https://get.docker.com | sh
cd android-cuttlefish
docker/build.sh --build_debs_only --rebuild_debs_verbose
sudo usermod -aG kvm,cvdnetwork,render $USER
reboot
重启后安装下载Android官方镜像
https://ci.android.com/builds/branches/aosp-master/grid?
或者使用编译AOSP后的cf镜像
. build/envsetup.sh
launch aosp_cf_x86_64_phone-userdebug
launch_cvd –start_webrtc=true -console=true -x_res=1280 -y_res=800
or
launch_cvd -vm_manager=qemu_cli
# 修改GOPROXY
vim ./frontend/src/goutil
export GOPROXY="https://goproxy.cn,direct" // line 27
DIST_FOLDER=$(readlink -f ../kernel-common/out/android-mainline/dist)
HOME=${PWD} ./bin/launch_cvd -daemon -initramfs_path "${DIST_FOLDER}"/initramfs.img -kernel_path "${DIST_FOLDER}"/bzImage
Dockerfile替换国内源
RUN sed -i s@/deb.debian.org/@/mirrors.ustc.edu.cn/@g /etc/apt/sources.list \
&& sed -i s@/security.debian.org/@/mirrors.ustc.edu.cn/@g /etc/apt/sources.list \
&& apt-get clean \
&& apt-get update