二、编译
模拟器镜像是通过qemu运行的。源码中定义的product为sdk_phone_xx(xx为arm,arm64,x86,x86_64等)。我们需要通过下面的命令设置环境,选择要编译的目标product并启动编译过程。
$source ./build/envsetup.sh
$lunch sdk_phone_x86
$make -j32
如果想构建 x86_64 位Android虚拟机运行镜像,则需针对 64 位目标运行 lunch
。编译完成后会生成镜像文件。通过命令emulator
可以直接启动模拟器。
$lunch sdk_phone_x86_64
$make -j32
[ 99% 36747/36947] Target empty super fs image: out/target/product/emulator_x86_64/super_empty.img
2022-11-01 15:43:06 - build_super_image.py - INFO : Building super image from info dict...
2022-11-01 15:43:06 - build_super_image.py - INFO : Done writing image out/target/product/emulator_x86_64/super_empty.img
[ 99% 36901/36947] Target cache fs image: out/target/product/emulator_x86_64/cache.img
WARNING: out/target/product/emulator_x86_64/cache.img approaching size limit (16777216 now; limit 16777216)
[ 99% 36902/36947] Target userdata fs image: out/target/product/emulator_x