using qemu to test kernel
using qemu to test kernel
Hi i need to find a way to use qemu to test my kernel, can someone point me to a tutorial on os development and running it in qemu, i need to know how to get qemu to create a floppy image and then be able to install grub
- gzaloprgm
- Member
- Posts: 141
- Joined: Sun Sep 23, 2007 4:53 pm
- Location: Buenos Aires, Argentina
- Contact:
http://jamesmolloy.co.uk/tutorial_html/ ... setup.html
There you can see how to create the image with grub and your kernel.
Emulation with qemu is very easy, just exec "qemu -fda image.img" and it should work.
Cheers
Gonzalo
There you can see how to create the image with grub and your kernel.
Emulation with qemu is very easy, just exec "qemu -fda image.img" and it should work.
Cheers
Gonzalo
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
- codemastersnake
- Member
- Posts: 148
- Joined: Sun Nov 07, 2004 12:00 am
- Contact:
- codemastersnake
- Member
- Posts: 148
- Joined: Sun Nov 07, 2004 12:00 am
- Contact:
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
The QEMU manual pages relating to only the command line options are many times bigger than the Bochs ones, and you can do more complex things when setting up QEMU through the command line (setting up an entire usermode network stack for all emulators, for instance).Snake wrote:Also you can control many aspects of a Bochs Machine.
My only problem with QEMU is that it crashes on my system whenever the kernel triple faults.
Hi,
Apart from that, the only difference is debugging capabilities and speed. Bochs has better debugging capabilities, and Bochs has better speed (because it's slower, which makes it easier for me to see where my code needs improvement).
Qemu will also emulate other (non-80x86) architectures, but that's not very useful to me at the moment.
Cheers,
Brendan
I still haven't figured out how to get Qemu to emulate an Opteron, a Pentium or an 80486 or something else; which is very useful if you want to know if your kernel works on a wide variety of CPUs (e.g. with/without PAE, with/without FPU/32Now/MMX/SSE1/SSE2/SSE3/SSE4, with/without global pages, with/without RDTSC, with/without syscall/sysenter, etc)....pcmattman wrote:The QEMU manual pages relating to only the command line options are many times bigger than the Bochs ones, and you can do more complex things when setting up QEMU through the command line (setting up an entire usermode network stack for all emulators, for instance).
Apart from that, the only difference is debugging capabilities and speed. Bochs has better debugging capabilities, and Bochs has better speed (because it's slower, which makes it easier for me to see where my code needs improvement).
Qemu will also emulate other (non-80x86) architectures, but that's not very useful to me at the moment.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
I believe qemu 0.9.1 has partial support for customizing the emulated CPU.Brendan wrote:I still haven't figured out how to get Qemu to emulate an Opteron, a Pentium or an 80486 or something else; which is very useful if you want to know if your kernel works on a wide variety of CPUs (e.g. with/without PAE, with/without FPU/32Now/MMX/SSE1/SSE2/SSE3/SSE4, with/without global pages, with/without RDTSC, with/without syscall/sysenter, etc)....
Perhaps "qemu -M ?" will list a few additional targets? (I'm still using 0.9.0...).QEMU Changelog wrote: -CPU model selection support (J. Mayer, Paul Brook, Herve Poussineau)
EDIT: I was wrong, type "-cpu ?" to get a list of all CPU models qemu can emulate.
I should note, there are quite a few changes in the 0.9.1 release.. some *really* cool command line options.
-
- Member
- Posts: 391
- Joined: Wed Jul 25, 2007 8:45 am
- Libera.chat IRC: aejsmith
- Location: London, UK
- Contact:
This is fixed in the CVS repo, now it properly dies with an error an a register dump (which is *very* useful)pcmattman wrote:My only problem with QEMU is that it crashes on my system whenever the kernel triple faults.
Edit the sourceBrendan wrote:I still haven't figured out how to get Qemu to emulate an Opteron, a Pentium or an 80486 or something else; which is very useful if you want to know if your kernel works on a wide variety of CPUs (e.g. with/without PAE, with/without FPU/32Now/MMX/SSE1/SSE2/SSE3/SSE4, with/without global pages, with/without RDTSC, with/without syscall/sysenter, etc)....
I personally prefer debugging with QEMU by attaching GDB to it. Works fine for me.Brendan wrote:Apart from that, the only difference is debugging capabilities and speed. Bochs has better debugging capabilities, and Bochs has better speed (because it's slower, which makes it easier for me to see where my code needs improvement).
Hi,
There is one more issue with Qemu though - for SMP (for e.g. on my machine, IIRC) one emulated CPU runs for about 500000000 instructions, then the next emulated CPU runs for about 500000000 instructions, then the next CPU, etc. This improves performance (which isn't important to me), but also severely reduces the chance of finding race conditions and reentrancy problems in the guest OS's code (which is extremely important to me).
Cheers,
Brendan
I hope so (I haven't tried 0.9.1 yet either)Brynet-Inc wrote:I believe qemu 0.9.1 has partial support for customizing the emulated CPU.
The main thing I'm hoping for is an EFI BIOS - last time I looked there was an EFI BIOS available for Qemu, but it only worked for the unstable/CVS version of Qemu (which didn't seem to work on my machine at the time).Brynet-Inc wrote:I should note, there are quite a few changes in the 0.9.1 release.. some *really* cool command line options.
There is one more issue with Qemu though - for SMP (for e.g. on my machine, IIRC) one emulated CPU runs for about 500000000 instructions, then the next emulated CPU runs for about 500000000 instructions, then the next CPU, etc. This improves performance (which isn't important to me), but also severely reduces the chance of finding race conditions and reentrancy problems in the guest OS's code (which is extremely important to me).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
-
- Member
- Posts: 391
- Joined: Wed Jul 25, 2007 8:45 am
- Libera.chat IRC: aejsmith
- Location: London, UK
- Contact:
I tried the EFI stuff a while ago and I couldn't get it working, even with the CVS version. If it works for 0.9.1 however, that would be really cool.Brendan wrote:The main thing I'm hoping for is an EFI BIOS - last time I looked there was an EFI BIOS available for Qemu, but it only worked for the unstable/CVS version of Qemu (which didn't seem to work on my machine at the time).