由於沒有 kqemu 的 qemu 實在太慢了
所以小弟效棄使用了(因不想花時間 compile kqemu),
以下筆記仍未完成, 敬請原諒 = , =
====================================
安裝:
apt-get install qemu
====================================
建立影像檔:
qemu-img create -f qcow2 vm-linux-base.img 1G
cow 是指 Copy On Write
====================================
插入 CD 到虛擬機:
主要指令 "-cdrom"
載入實體CD方法:
qemu -cdrom /dev/cdrom -hda vm-linux-base.img -m 256 -boot d
載入影像檔方法:
qemu -cdrom debian-40r4a-i386-netinst.iso -hda vm-linux-base.img -m 256 -boot d
====================================
QEMU Monitor
(在 putty 內係用唔到的)
Ctrl+Alt+1
主晝面
Ctrl+Alt+2
進入指令介面
指令:
commit
將以 -snapshot 的檔案寫回 img
info XXXX
eject
-----------------
stop
暫停
cont
繼續
system_reset
重開
-----------------
====================================
保存即時狀態
這裡指的狀態是指 CPU state, RAM, device state, writable disks
info snapshots
查看現有什麼影像檔
savevm TAG
保存
loadvm TAG
還原
delvm TAG
刪除
====================================
VNC
qemu ... -vnc :1 -usbdevice tablet -monitor stdio
-vnc :X (X = display number, e. g. "1").
-usbdevice tablet is used to avoid annoying mouse effects.
-monitor stdio redirects QEMU monitor to the console
vncviewer -FullColor 192.168.123.254:1
====================================
Overlay images
qemu-img create -b os.img -f qcow os.ovl
qemu ... -hda os.ovl ...
`commit [-f fmt] filename'
Commit the changes recorded in filename in its base image.
`info [-f fmt] filename'
====================================
Snapshot mode
temporary file created in `/tmp'
Ctrl-a s
Save disk data back to file (if -snapshot)
====================================
VM snapshots
info snapshots
loadvm
savevm
delvm
====================================
debian-root
qemu-make-debian-root [-k] size-in-MiB distrib deburl image [files-to-copy-in-/root]
* The generated image is not bootable by itself
qemu disk.img -kernel /boot/vmlinuz
====================================
====================================
usage: qemu [options] [disk_image]
-hda/-hdb/-hdc/-hdd
-cdrom file
use 'file' as IDE cdrom image (cdrom is ide1 master)
-boot [a|c|d]
boot on floppy (a), hard disk (c) or CD-ROM (d)
-m megs
set virtual RAM size to megs MB [default=128]
-localtime
set the real time clock to local time [default=utc]
====================================
qemu ... -vnc :1 -usbdevice devname
devname:
host:bus.addr
host:vendor_id:product_id
mouse
keyboard
====================================
User-mode
qemu-i386 -L / /bin/ls
-L path set the directory for the BIOS and VGA BIOS
(default=/usr/gnemul/qemu-arm).
====================================
QEMU Accelerator Module
(qemu) info kqemu
qemu -hda c.img -m 256 -kernel-kqemu
====================================