Does anyone have experience about linux kernel dev and test in QEMU?

Tobin C. Harding me at tobin.cc
Mon May 22 22:50:50 EDT 2017


On Tue, May 23, 2017 at 12:29:09AM +0000, Douglas Su wrote:
> I used to develop and test kernel driver in virtual box with full Linux Debian installed. It works but not efficient due to that I have to install a full functional Linux distribution.
> 
> Previously, in this mail list, I noted some friends said that to accelerate the development process by using QEMU, a lightweight and fast VM than QEMU. After some searching works, however, I barely find any reading material or tutorial about the details of using QEMU in kernel development, especially the driver development.
> 
> Can anyone give a clue?

You can use the following command

$ qemu-system-x86_64
	-kernel arch/x86_64/boot/bzImage
	-drive
	-file=/path/to/qemu-image.img,index=0,media=disk,format=raw
	-append "root=/dev/sda console=ttyS0"
        --enable-kvm
        --nographic

You can run this command from the root directory of whichever kernel
tree you are hacking on. I can't remember how I built/got the QEMU
image though. There are tutorials online about creating a QEMU image.

Hope this helps,
Tobin.



More information about the Kernelnewbies mailing list