Tuesday, February 22, 2022

[SOLVED] QEMU Showing Black Screen Only

Issue

I compiled my custom kernel with different configs and images like u,zImages. But when I try to run qemu with my image, qemu showing only black screen.

Also I looked at href="https://stackoverflow.com/questions/20763344/just-black-screen-after-running-qemu">this post but it didn't help me.

EDIT

I just tried to compile kernel with these commands.

make ARCH=arm distclean

make ARCH=arm integrator_defconfig

make ARCH=arm menuconfig

NOTE: I used default menuconfig.

make ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage

qemu-system-arm -M integratorcp -kernel arch/arm/boot/zImage

And last i tried this command;

qemu-system-arm -M integratorcp -kernel arch/arm/boot/zImage -append 'console=ttyAMA0 earlyprintk=ttyAMA0' -serial stdio

NOTE: when i try to use -dtb, qemu giving to me "Unable to copy device tree in memory." error.


Solution

"QEMU does nothing with a black screen" almost always means "QEMU is running fine, but the guest code crashed or stopped early in the boot process without sending any output". Almost certainly either your kernel is misconfigured, or your QEMU command line is wrong. You don't give enough information to say which. You need to tell us at least:

  • what the kernel is you're running and what machine you've configured it for
  • what the QEMU command line you're using is

Given your updated question with a command line, some suggestions:

  • tell your guest to use the serial port (use the QEMU option -append 'console=ttyAMA0' to set the guest kernel command line)
  • either check the serial output view in the GUI, or send it to stdout with -nographic or -serial stdio
  • enable any earlyprintk or earlycon options in the guest config that you can and on the guest command line, so if the guest fails early you have more chance to catch it
  • pass the device tree for the kernel with -dtb integratorcp.dtb (use the one from your kernel tree; you'll probably have to tell the kernel makefiles to build it for you)

PS: integratorcp is an absolutely ancient development board -- why do you want to use it?



Answered By - Peter Maydell
Answer Checked By - Dawn Plyler (WPSolving Volunteer)