编译Android14 AOSP并运行模拟器时出现fstab错误求助
解决思路
核心问题是镜像路径与编译目标不匹配:你执行lunch aosp_cf_x86_64-phone-trunk_staging-userdebug指定的编译目标是cf_x86_64_phone,但启动模拟器时却引用了vsoc_x86_64目录下的镜像,导致init无法找到对应设备的fstab配置文件。
具体修复步骤
- 修正启动命令的路径:将所有
vsoc_x86_64替换为cf_x86_64_phone,命令如下:
emulator \ -kernel ./out/target/product/cf_x86_64_phone/kernel \ -ramdisk ./out/target/product/cf_x86_64_phone/ramdisk.img \ -system ./out/target/product/cf_x86_64_phone/system.img \ -data ./out/target/product/cf_x86_64_phone/userdata.img \ -vendor ./out/target/product/cf_x86_64_phone/vendor.img \ -no-audio \ -no-window \ -selinux permissive \ -show-kernel \ -verbose
- 更简便的启动方式:编译完成后,直接执行
emulator命令即可——lunch操作已经配置好正确的环境变量,模拟器会自动加载cf_x86_64_phone目录下的镜像文件,无需手动指定路径。
额外排查点
- 确认
out/target/product/cf_x86_64_phone目录下存在所有需要的镜像文件(kernel、ramdisk.img、system.img等) - 检查是否在编译后切换过终端窗口或重置过环境变量,若有需重新执行
source build/envsetup.sh和lunch aosp_cf_x86_64-phone-trunk_staging-userdebug
内容的提问来源于stack exchange,提问作者Marco Polo
相关产品推荐
相关产品推荐

