Gat*_*ito 5 android qemu emulation android-source
我编译了自己的 AOSP 镜像并得到了这个:
lz@vm:/mnt/android-dev-3/aosp/grapheneos-lz_experiments/out/target/product/generic_x86_64$ ls *.img
cache.img ramdisk.img system.img vendor_boot-debug.img
dtb.img ramdisk-qemu.img system-qemu.img vendor_boot.img
encryptionkey.img super_empty.img userdata.img vendor.img
ramdisk-debug.img super.img vbmeta.img vendor-qemu.img
Run Code Online (Sandbox Code Playgroud)
我知道我不需要自己指定 .img,AOSP 预构建模拟器就可以工作,但我想用于其他目的。
所以我做了DIR_OUT = /mnt/android-dev-3/aosp/grapheneos-lz_experiments/out/target/product/generic_x86_64
./emulator -sysdir $DIR_OUT/system -datadir $DIR_OUT/data -kernel $DIR_OUT/kernel-ranchu -ramdisk $DIR_OUT/ramdisk.img -system $DIR_OUT/system.img -data $DIR_OUT/userdata.img -cache $DIR_OUT/cache.img -vendor $DIR_OUT/vendor.img
emulator: ERROR: No AVD specified. Use '@foo' or '-avd foo' to launch a virtual device named 'foo'
emulator: WARNING: userdata partition is resized from 550 M to 800 M
emulator: WARNING: encryption is off
Segmentation fault (core dumped)
Run Code Online (Sandbox Code Playgroud)
你可以看到我通过注释忽略了 AVD 错误return
if (!avdName && !avdArch && !androidOut && !forceEngineLaunch && !queryVersion) {
derror("No AVD specified. Use '@foo' or '-avd foo' to launch a virtual"
" device named 'foo'\n");
//return 1;
}
Run Code Online (Sandbox Code Playgroud)
因为没有它我就无法进行任何工作。由于我的怪癖,它可能会出现段错误,但如果没有它,我自己就不知道如何使用 .img 运行。
以下是 Android 模拟器关于指定我自己的 .img 文件的说明:
./emulator -help-disk-images
The emulator needs several key image files to run appropriately.
Their exact location depends on whether you're using the emulator
from the Android SDK, or not (more details below).
The minimal required image files are the following:
kernel-qemu the emulator-specific Linux kernel image
ramdisk.img the ramdisk image used to boot the system
system.img the *initial* system image
vendor.img the *initial* vendor image
userdata.img the *initial* data partition image
It will also use the following writable image files:
userdata-qemu.img the persistent data partition image
system-qemu.img an *optional* persistent system image
vendor-qemu.img an *optional* persistent vendor image
cache.img an *optional* cache partition image
sdcard.img an *optional* SD Card partition image
snapshots.img an *optional* state snapshots image
If you use a virtual device, its content directory should store
all writable images, and read-only ones will be found from the
corresponding platform/add-on directories. See -help-sdk-images
for more details.
If you are building from the Android build system, you should
have ANDROID_PRODUCT_OUT defined in your environment, and the
emulator shall be able to pick-up the right image files automatically.
See -help-build-images for more details.
If you're neither using the SDK or the Android build system, you
can still run the emulator by explicitely providing the paths to
*all* required disk images through a combination of the following
options: -sysdir, -datadir, -kernel, -ramdisk, -system, -data, -cache
-sdcard and -snapstorage.
The actual logic being that the emulator should be able to find all
images from the options you give it.
Run Code Online (Sandbox Code Playgroud)
没有说明如何克服该错误
更新:
分段错误就在这一行:
sysImagePath = std::string(
avdInfo_getSystemImagePath(m_avd)
?: avdInfo_getSystemInitImagePath(m_avd));
Run Code Online (Sandbox Code Playgroud)
更新:
我尝试过
./emulator -sysdir $DIR_OUT/system -datadir $DIR_OUT/data -kernel /home/project/disk/aosp/grapheneos-lz_experiments/prebuilts/qemu-kernel/x86_64/5.4/kernel-qemu2 -ramdisk $DIR_OUT/ramdisk-qemu.img -system $DIR_OUT/system.img -data $DIR_OUT/userdata-qemu.img -cache $DIR_OUT/cache.img -vendor $DIR_OUT/vendor.img
Run Code Online (Sandbox Code Playgroud)
(我将 -qemu 添加到一些名称中包含 qemu 的 .img 中)
但问题依然存在
尝试这个。 https://source.android.com/setup/create/avd 要构建并运行 AVD 系统映像:
下载安卓源码:
mkdir aosp-master; cd aosp-master
repo init -u
repo sync -j24
Run Code Online (Sandbox Code Playgroud)
如果您想构建其他 Android 版本,您可以在公共 Android 存储库中找到它们的分支名称。它们映射到 Android 代号、标签和版本号。
构建 AVD 系统映像。这与构建 Android 设备系统映像的过程相同。例如,要构建 x86 32 位 AVD:
mkdir aosp-master; cd aosp-master
source ./build/envsetup.sh
lunch sdk_phone_x86
make -j32
Run Code Online (Sandbox Code Playgroud)
如果您更喜欢构建 x86 64 位 AVD,请为 64 位目标运行午餐:
Lunch sdk_phone_x86_64 在 Android 模拟器中运行 AVD 系统映像:
模拟器 有关运行模拟器的更多详细信息,请参阅命令行启动选项。图 2 显示了运行 AVD 的 Android 模拟器的示例。
| 归档时间: |
|
| 查看次数: |
4329 次 |
| 最近记录: |