http://www.hopelesscase.com/linuxnotes/qemu

author

qemu

  1. author
  2. qemu
    1. links
    2. commands
    3. examples
      1. downloaded test images
      2. separate initrd, kernel, and hda arguments
      3. vnc display option, -k option
      4. qemu booting a debian installation DVD iso image
  3. kqemu: the qemu accelerator kernel module

links

commands

Here are the installed executables from a normal build of qemu:

usr/bin/qemu
usr/bin/qemu-armeb
usr/bin/qemu-sparc
usr/bin/qemu-mipsel
usr/bin/qemu-system-sparc
usr/bin/qemu-system-arm
usr/bin/qemu-system-ppc
usr/bin/qemu-i386
usr/bin/qemu-m68k
usr/bin/qemu-mips
usr/bin/qemu-system-mips
usr/bin/qemu-arm
usr/bin/qemu-img
usr/bin/qemu-ppc
usr/bin/qemu-system-mipsel
usr/bin/qemu-system-x86_64

Here are notes on each command:

examples

downloaded test images

You can download these test images:

  • linux-0.2.img.bz2

  • arm-test-0.2.tar.gz

from the qemu website. You run them like this:

qemu ./linux-0.2.img

and

qemu-system-arm -kernel zImage.integrator -initrd arm_root.img

Running these two causes an xwindow to come up that represents the console of the machine booted with a framebuffer device. When running this, I notice wierd behavior.

  • the mouse pointer disappears after you start using the window and you have to cntl-alt-f1 to get away from X so you can kill it to get your mouse back

  • I can't even run this under a vncserver without the vncserver blocking (no mouse gestures accepted through vncviewer)

  • If I run these commands under Xnest, they seem to work but any keys typed become garbled.

You can run qemu-system-arm in a non-graphical mode like this:

qemu-system-arm -kernel zImage.integrator -initrd arm_root.img -nographic -append "console=ttyAMA0"

This seems to work fine.

If I run it like this:

qemu-system-arm -kernel zImage.integrator -initrd arm_root.img -nographic

then I don't see the kernel boot messages but after the kernel boots, I can log in.

separate initrd, kernel, and hda arguments

Here is how you can boot a linux kernel with an initrd.gz and a image of disk hda

qemu -initrd initrd.gz -kernel /boot/vmlinuz-generic-2.6.18 -hda hda_image

vnc display option, -k option

This form of the command:

qemu -vnc :1 -initrd initrd.gz -kernel /boot/vmlinuz-generic-2.6.18 -hda hda_image

causes qemu to open a vncserver of its own for displaying graphics. You then use vncviewer to connect to it like this:

vncviewer :1

This assumes that the keyboard layout is en-us. If it is not, you need to specify it with the -k option. In general, whenever qemu is in a situation where it can't access the raw keycodes, it needs you to specify a -k option. Running under a vncserver environment (I mean runing qemu with is environment variable DISPLAY set to a vnc X server and not a normal ont, not running qemu with a -vnc argument).

qemu booting a debian installation DVD iso image

qemu -hda image_file -cdrom iso_image_file -vnc :3 -boot d

At first I had trouble getting this working because I tried this:

qemu -hda image_file -hdc iso_image_file -vnc :3 -boot d

The problem was that qemu was treating the hdc image as if it were a hard disk. That is why you need the -cdrom argument.

kqemu: the qemu accelerator kernel module

  • The kqemu package has the source code for a kernel module that accelerates emulation for x86-on-x86 execution.

  • I assume it does that by running code directly, instead of emulating the x86 processor.

  • "modprobe kqemu" loads the module

  • it creates the device /dev/kqemu through the udev system.

  • you would typically run "chmod a+rw /dev/kqemu" so that non-root users can benefit.

  • I wonder what security holes this opens?




Reply via email to