How to boot Linux bzImage in QEMU stack?

How to boot Linux bzImage in QEMU stack?

A quick test here using Arch’s kernel/initrd ( qemu -kernel /boot/vmlinuz-linux -initrd /boot/initramfs-linux.img) worked (dropped me into a recovery shell since I didn’t provide a root device). Thanks for contributing an answer to Unix & Linux Stack Exchange! Please be sure to answer the question.

How to launch a Linux kernel in QEMU?

This section explains how to launch a Linux kernel inside QEMU without having to make a full bootable image. It is very useful for fast Linux kernel testing. Use -kernel to provide the Linux kernel image and -append to give the kernel command line arguments. The -initrd option can be used to provide an INITRD image.

Which is the command line argument for QEMU?

Use -kernel to provide the Linux kernel image and -append to give the kernel command line arguments. The -initrd option can be used to provide an INITRD image. If you do not need graphical output, you can disable it and redirect the virtual serial port and the QEMU monitor to the console with the -nographic option.

How to boot bzImage in Linux multiboot stack?

Linux/Multiboot boot specific: -kernel bzImage use ‘bzImage’ as kernel image -append cmdline use ‘cmdline’ as kernel command line -initrd file use ‘file’ as initial ram disk -dtb file use ‘file’ as device tree image

Why is Linux running self compiled kernel in QEMU?

The initrd was mounted on /dev/ram and the first init process ran well. It turns out running make defconfig didn’t set thses values by default for me. The most likely thing is that the kernel doesn’t know the correct device to boot from. You can supply this explicitly from the qemu command line. So if the root is on partition 2, you can say:

Do you need drivers to mount root filesystem?

You must make sure that the kernel is able to mount the root filesystem. It must have drivers for the filesystem type and for all the layers involved in the block device (disk controller (SCSI/SATA/IDE/USB/… adapter), partition type, etc.).