AOSP 模拟器图像未运行

AOSP Emulator Images not running

提问人:Banana999 提问时间:11/2/2023 更新时间:11/2/2023 访问量:75

问:

我正在尝试从 AOSP 源代码创建一个 AVD 模拟器映像,我可以在 M1 Macbook (arm64) 上使用标准 Android 模拟器运行该映像。

我遵循了从 https://source.android.com/docs/setup/start/initializing 开始的所有标准步骤,其中包括:

到目前为止,只有 Android 12 版本(从这里 https://android.googlesource.com/platform/manifest/+refs 的 android12-release 分支)给了我一个实际启动且可用的模拟器。

android11-release,,都生成了良好的构建,但模拟器从未启动并且似乎处于循环中,以下是 Android 13 构建的内核日志,这似乎是内核崩溃的相关位置:android13-releaseandroid14-release

[    0.359454][    T1] uart-pl011 9000000.pl011: no DMA platform data
[    0.359992][    T1] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    0.360612][    T1] Please append a correct "root=" boot option; here are the available partitions:
[    0.361315][    T1] 0100            8192 ram0
[    0.361317][    T1]  (driver?)
[    0.361912][    T1] 0101            8192 ram1
[    0.361913][    T1]  (driver?)
[    0.362513][    T1] 0102            8192 ram2
[    0.362514][    T1]  (driver?)
[    0.363177][    T1] 0103            8192 ram3
[    0.363178][    T1]  (driver?)
[    0.363761][    T1] 0104            8192 ram4
[    0.363761][    T1]  (driver?)
[    0.364361][    T1] 0105            8192 ram5
[    0.364361][    T1]  (driver?)
[    0.364976][    T1] 0106            8192 ram6
[    0.364977][    T1]  (driver?)
[    0.365559][    T1] 0107            8192 ram7
[    0.365560][    T1]  (driver?)
[    0.366179][    T1] 0108            8192 ram8
[    0.366180][    T1]  (driver?)
[    0.366777][    T1] 0109            8192 ram9
[    0.366777][    T1]  (driver?)
[    0.367363][    T1] 010a            8192 ram10
[    0.367363][    T1]  (driver?)
[    0.367949][    T1] 010b            8192 ram11
[    0.367949][    T1]  (driver?)
[    0.368532][    T1] 010c            8192 ram12
[    0.368533][    T1]  (driver?)
[    0.369119][    T1] 010d            8192 ram13
[    0.369119][    T1]  (driver?)
[    0.369730][    T1] 010e            8192 ram14
[    0.369730][    T1]  (driver?)
[    0.370359][    T1] 010f            8192 ram15
[    0.370360][    T1]  (driver?)
[    0.370951][    T1] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.371710][    T1] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.15.41-android13-8-00029-g24d27dff64c4-ab9178016 #1
[    0.359088][    T1] Hardware name: linux,ranchu (DT)
[    0.359470][    T1] Call trace:
[    0.359766][    T1]  dump_backtrace.cfi_jt+0x0/0x8
[    0.360137][    T1]  dump_stack_lvl+0x80/0xb8
[    0.360472][    T1]  panic+0x180/0x444
[    0.360764][    T1]  mount_block_root+0x1ac/0x270
[    0.361123][    T1]  mount_root+0x68/0x90
[    0.361454][    T1]  prepare_namespace+0x164/0x1e8
[    0.361825][    T1]  kernel_init_freeable+0x120/0x19c
[    0.362282][    T1]  kernel_init+0x40/0x36c
[    0.362606][    T1]  ret_from_fork+0x10/0x20
[    0.362938][    T1] SMP: stopping secondary CPUs
[    0.363367][    T1] Kernel Offset: disabled
[    0.363708][    T1] CPU features: 0x0,00000281,4b354ee8
[    0.364112][    T1] Memory Limit: none
[    0.000000][    T0] Booting Linux on physical CPU 0x0000000000 [0x00000000]
[    0.000000][    T0] Linux version 5.15.41-android13-8-00029-g24d27dff64c4-ab9178016 (build-user@build-host) (Android (8508608, based on r450784e) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6), LLD 14.0.7) #1 SMP PREEMPT Fri Oct 14 19:05:44 UTC 2022
[    0.000000][    T0] Machine model: linux,ranchu
[    0.000000][    T0] Stack Depot is disabled
[    0.000000][    T0] KVM is not available. Ignoring kvm-arm.mode
[    0.000000][    T0] printk: debug: skip boot console de-registration.

从一开始就不确定这些模拟器日志是否相关,但可能会有所帮助

❯ emulator @Test_Device2 -show-kernel
INFO    | Android emulator version 33.1.13.0 (build_id 10332831) (CL:N/A)
INFO    | Found systemPath /Users/username_here/Library/Android/sdk/system-images/android-33/default/arm64-v8a/
INFO    | Storing crashdata in: , detection is enabled for process: 40462
INFO    | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
INFO    | Increasing RAM size to 2048MB
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_posture_requested(int) ((null):0, (null))
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_posture_selection_dialog() ((null):0, (null))
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_resizable_requested(PresetEmulatorSizeType) ((null):0, (null))
INFO    | Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_resizable_dialog() ((null):0, (null))
library_mode host gpu mode host
WARNING | cannot add library /Users/username_here/Library/Android/sdk/emulator/qemu/darwin-aarch64/lib64/vulkan/libvulkan.dylib: failed
INFO    | added library /Users/username_here/Library/Android/sdk/emulator/lib64/vulkan/libvulkan.dylib

我没有更改 AOSP 源代码上的任何内容,并且所有构建都通过相同的步骤成功。如何获取有效的 Android 13 / 14 模拟器映像?

通过 Android Studio 下载的库存 arm64 模拟器映像工作正常。

我无法在我正在构建的计算机上运行该命令,因为它是在不支持虚拟化的云 Linux 计算机上。emulator

模拟器 Android-Source QEMU

评论


答:

0赞 zomega 11/2/2023 #1

这很有趣,因为目前我有完全相同的问题。

在我的构建中,我可以找到以下文件:

out/target/product/emulator_x86_64/sdk-repo-linux-system-images.zip

我想你可以找到一个类似的文件。此 zip 是 AVD 图像。

有一个官方指南(您已经知道了),但它仅适用于 Android 12 及更低版本。因为它说在 Android 12 及更低版本上,您还可以在构建中找到。将 AVD 添加到 Android Studio 时需要此文件。但是较新的 Android 版本呢?它什么也没说,我在我的 Android 15 版本中也找不到这样的文件。repo-sys-img.xml

需要的如下文件:https://dl.google.com/android/repository/sys-img/android/sys-img2-3.xml。 我从下面的屏幕截图中有这个链接。通常你可以构建这个文件,但由于它不在构建中,我现在唯一的想法就是从链接中获取这个XML文件并编辑它。repo-sys-img.xml

我昨天在android-building的Google群组中添加了一个问题,但尚未被接受。

这是必须添加XML文件的地方(我想它必须以以下开头):file://...enter image description here

评论

1赞 Banana999 11/2/2023
我实际上没有尝试整个 repo xml 的事情,我发现如果您使用 zip AVD 图像,提取文件并将它们放在包含现有 Android Studio 系统映像的文件夹中,当您尝试创建新的 AVD 时,它们就会显示出来。只要确保有一个显示构建细节的内容,你就可以从从Android Studio下载的普通图像中检查内容。package.xml