Does anyone have experience about linux kernel dev and test in QEMU?
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?
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.
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?
Hello, Douglas. There is a great video about the topic on youtube: Kernel Recipes 2015 - Speed up your kernel development cycle with QEMU - Stefan Hajnoczi https://www.youtube.com/watch?v=PBY9l97-lto
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hi Douglas, I'm not terribly experienced, but here are my two cents. On Tue, May 23, 2017 at 12:29:09AM +0000, Douglas Su wrote:
After some searching works, however, I barely find any reading material or tutorial about the details of using QEMU in kernel development,
I might suggest two tools I've found useful for this purpose. First, eudyptula-boot [1], a shell script that helps you run QEMU using the same file system as your host (thanks to 9P). Second, vido [2], a similar tool implemented in Python. I prefer vido because it's easier for me to extend in Python. In both cases, you don't have to mess around with building a VM image, and for the most part filesystem access is seamless. These solutions don't bother with a dedicated init process, so some things are odd (for instance, orphaned processes that die remain zombies forever). Their minimum configuration is pretty small so rebuilding is quick and your development cycle is pretty great.
especially the driver development.
You'll probably need to get into some low-level specifics for getting your devices passed through to QEMU. I have no experience here. I've not really thought of QEMU as being an excellent solution for driver development. Best, Stephen [1]: https://github.com/vincentbernat/eudyptula-boot [2]: https://github.com/g2p/vido
participants (4)
-
Douglas Su -
Roman Storozhenko -
Stephen Brennan -
Tobin C. Harding