Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qemu-Arm Is stuck with black screen - running vanilla kernel

I have tried to run qemu-arm with a complied linux kernel (Version 4.9) and with an initfs that i have created with a sample program.

This is was based on an excellent post from here.

This is the command that i have executed:

qemu-system-arm -M vexpress-a9 -kernel linux-4.9/arch/arm/boot/zImage -initrd initramfs -append "console=tty1"

then, qemu shows me these errors and its graphical window is getting stuck:

pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument

Even when I run it without the -initrd parameter, for just loading the kernel - nothing happens.

When I tried run it with a vmlinuz-3.2.0-4-vexpress image in this example, it worked for me.

Does someone have clue what may be the problem? Something with the fact that it is a zImage? Is there a way to debug it?

Thanks!

like image 835
sborpo Avatar asked Nov 07 '22 13:11

sborpo


1 Answers

"QEMU sits there and prints nothing" is quite a common symptom, and it almost always means "the guest kernel crashed before being able to print anything, because it wasn't configured correctly". This is pretty much the same effect you get if you try to boot a wrongly configured kernel on real hardware, and the process for debugging it is about the same:

  • check the obvious kernel config options are set correctly: in particular, that you have built it to support the ARM board and CPU that you're trying to run it on, and that you've enabled support for whatever devices you're trying to use for console output
  • give yourself the maximum chance of being able to see something, by configuring QEMU to output serial port information, and configuring the guest to send its console output to serial, and enabling any earlycon/earlyprintk options you can (serial output happens much earlier than graphics output, and the Linux kernel earlycon/earlyprintk options mean the kernel will start printing output earlier than it defaults to)
  • if you have a kernel that works, and one that doesn't, look at the differences between the kernel configs to see if one is missing something
  • if all else fails, you have to break out the debugger to find out what's going on

Nothing about this is particularly QEMU specific -- it's the same sort of pain you have to go through if you're trying to do kernel bringup on hardware.

PS: my first guess is that the kernel is crashing because it doesn't have enough memory -- you haven't passed QEMU a '-m' option, so it is defaulting to 128MB; the vexpress-a9 board can handle up to 1GB. earlycon would probably be sufficient debug output to identify this issue. You also aren't passing a device tree blob via -dtb, which may be an issue for newer kernels (older kernels would happily boot without one).

like image 148
Peter Maydell Avatar answered Nov 18 '22 03:11

Peter Maydell