Warm tip: This article is reproduced from serverfault.com, please click

Unable to boot kernel image built for vexpress-a9 on qemu : Blank Screen

发布于 2018-02-23 05:02:06

I have compiled linux kernel v4.9 using the following steps :

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabi-
make vexpress_defconfig
make all -j40

Then I created ramdisk with a simple hello world program as init process

#include <stdio.h> 

void main() {
  printf("Hello World!\n");
  while(1);
}

//compile and pack
arm-linux-gnueabi-gcc -static init.c -o init
echo init|cpio -o --format=newc > initramfs

Now when I try to run with qemu, I get a black screen and nothing else

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

Also, on my terminal from which qemu was launched, I get the following prints (which look irrelevant)

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

This is my qemu screen (completely blank) : enter image description here

I am using Qemu for the first time and was using this article for reference.

Questioner
Insane Coder
Viewed
0
Peter Maydell 2018-02-24 00:11:40

"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".

The most obvious problem with your command line is that you aren't passing QEMU a device tree blob with -dtb. Older Arm kernels would boot with just a kernel and initrd, but newer ones require the dtb, or they will not boot. The tutorial you're looking at uses a version of the kernel that predates this change, but it looks like you're using a much later version that needs a dtb. You should be able to find the relevant dtb (probably vexpress-v2p-ca9.dtb) in arch/arm/boot/dts/ in your kernel build tree. You might need to specifically tell the kernel makefiles to build it from the dts -- I forget. Check kernel build documentation to find out how to do that if necessary.