No display with message:“Guest has not initialized the display (yet).” when I try to run Android on qemu

倖福魔咒の 提交于 2021-02-07 10:46:40

问题


I just try to run android on qemu. I work on an Ubuntu 16.04 with Intel(R) Core(TM) i7-4790 CPU.

I sync and compile android-6.0.1_r1 into aosp_arm-eng. I sync and compile qemu 2.9.91 with arm platform.

Then, I try to do my job by the following shell code:

    ANDROID_IMAGE_PATH=${ANDROID_PATH}/out/target/product/generic
    QEMU_ARCH="arm"
    QEMU_OPTS="-cpu cortex-a15 -machine type=virt"
    KERNEL_CMDLINE='console=ttyAMA0,38400 earlycon=pl011,0x09000000 debug nosmp drm.debug=0x0 rootwait androidboot.selinux=permissive'
    LINUX_PATH=${ANDROID_PATH}/prebuilts/qemu-kernel
    KERNEL=${LINUX_PATH}/arm/kernel-qemu-armv7

    ${QEMU_PATH}/${QEMU_ARCH}-softmmu/qemu-system-${QEMU_ARCH} \
    ${QEMU_OPTS} \
    -append "${KERNEL_CMDLINE}" \
    -m 1024 \
    -serial mon:stdio \
    -kernel ${KERNEL} \
    -initrd ${ANDROID_IMAGE_PATH}/ramdisk.img \
    -drive index=0,if=none,id=system,format=raw,file=${ANDROID_IMAGE_PATH}/system.img \
    -device virtio-blk-pci,drive=system \
    -drive index=1,if=none,id=cache,format=raw,file=${ANDROID_IMAGE_PATH}/cache.img \
    -device virtio-blk-pci,drive=cache \
    -drive index=2,if=none,id=userdata,format=raw,file=${ANDROID_IMAGE_PATH}/userdata.img \
    -device virtio-blk-pci,drive=userdata \
    -netdev user,id=mynet,hostfwd=tcp::5550-:5555 -device virtio-net-pci,netdev=mynet \
    -display gtk,gl=on \
    -device virtio-gpu-pci,virgl \
    -device nec-usb-xhci,id=xhci \
    -device sdhci-pci \
    -d guest_errors \
    $*

Then I get the message: "Guest has not initialized the display (yet)" on qemu window as the following picture:

The question may is because that the kernel and the options is not matched.

So first(1) I check the images. I run the emulator with the above images and path. The emulator is based on qemu and got from Android source code. I run the emulator with the following code and it work.

EMULATOR_PATH=${ANDROID_PATH}/prebuilts/android-emulator/linux-x86_64
${EMULATOR_PATH}/emulator \
    -kernel ${KERNEL} \
    -ramdisk ${ANDROID_IMAGE_PATH}/ramdisk.img \
    -system ${ANDROID_IMAGE_PATH}/system.img \
    -data ${ANDROID_IMAGE_PATH}/userdata.img \
-sysdir ${ANDROID_IMAGE_PATH} \
-memory 512 \
    -partition-size 1024

Now, there may has something wrong in the options with qemu. So could someone tell me the useful machine type or some other option?

I'll thank you very much if you could give me some help (⊙o⊙)


回答1:


try -display gtk,gl=off to disable the GL display driver, which possibly may vary.

or -nographic, in order to run headless.

see https://www.linux-kvm.org/images/b/b2/01x10b-QEMUGfraphics.pdf



来源:https://stackoverflow.com/questions/45809557/no-display-with-messageguest-has-not-initialized-the-display-yet-when-i-tr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!