开源是一种精神,分享是一种美德!

qemu

相关命令:暂无相关命令

qemu是一个快速的动态译指的虚拟机。他支持多种处理器指令集的模拟。他有两种运行模式:
(1)全系统仿真,这种模式下,他就像一个PC,有独立CPU和外设,可支持多种操作系统。
(2)用户模式仿真,在这种模式下,他就像Wine一样,成为一个windows api模拟器




qemu系统仿真外设:(PCI,)
- i440FX host PCI bridge and PIIX3 PCI to ISA bridge (PCI桥和PCI到ISA桥)
- Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA extensions (hardware level, including all non standard modes).
(VGA设备)
- PS/2 mouse and keyboard (PS2鼠标键盘)
- 2 PCI IDE interfaces with hard disk and CD-ROM support (两个PCI上的IDE借口,用于接硬盘和光驱)
- Floppy disk (软盘)
- NE2000 PCI network adapters (PCI网卡)
- Serial ports (串口)
- Creative SoundBlaster 16 sound card (声卡)
- ENSONIQ AudioPCI ES1370 sound card (声卡)
- Adlib(OPL2) - Yamaha YM3812 compatible chip (音频兼容芯片)
- PCI UHCI USB controller and a virtual USB hub. (PCI UHCI USB控制器和一个虚拟usb hub)



快速启动
qemu linux.img



调用
usage:qemu [options] [disk_image]
一般使用:
-h:帮助
-version:查看版本
-M machine:选择虚拟机
-fda file:
-fdb file:使用文件作为软盘,可以使用主机的“/dev/fd0”
-hda file:硬盘选项
-hdb file:硬盘选项
-hdc file:硬盘选项
-hdd file:硬盘选项
-cdrom file:光驱选项
-drive option[,option[,option[,...]]]:定义一个新的驱动器,有效选项如下:
 file=file:定义镜像文件
 if=interface:该选项定义驱动被连接的类型,ide, scsi, sd, mtd, floppy, pflash, virtio.
 bus=bus,unit=unit:这些选项定义连接的驱动器定义总线数字和单位ID。
 index=index:此选项定义驱动器连接在一个给定的接口类型列表中可用的连接器使用索引。(可能为盘符)
 media=media:cdrom还是disk
 cyls=c,heads=h,secs=s[,trans=t]:选项同‘-hdachs’
 snapshot=snapshot:值为"on" or "off",允许被给的驱动器使能snapshot
 cache=cache:值为"none", "writeback", or "writethrough" ,控制主机缓存用于访问数据块
 aio=aio:值为"threads", or "native" ,选择线程基于磁盘IO还是本地linux IO
 format=format:指定磁盘格式,建议使用raw
 serial=serial:给设备指定序列号(可能是串口,也可能和串口无关)
 addr=addr:指定PCI地址(仅仅:if=virtio)
    默认情况下,连续写入缓存被用于所有的块设备,这意味着主机页缓存将被用于读和写数据,但是仅仅当数据被报知被写入存储子系统,写通

知将被发送到客户机。
    Instead of ‘-cdrom’ you can use:qemu -drive file=file,index=2,media=cdrom
    Instead of ‘-hda’, ‘-hdb’, ‘-hdc’, ‘-hdd’, you can use:
qemu -drive file=file,index=0,media=disk
qemu -drive file=file,index=1,media=disk
qemu -drive file=file,index=2,media=disk
qemu -drive file=file,index=3,media=disk

-boot:启动选项,软盘(a)、硬盘(c)、光驱(D)、网卡(n),默认是从硬盘启动
-snapshot:快照功能
-no-fd-bootchk:禁止启动检测软盘
-m megs:内存大小
-cpu model:选择cpu模式
-smp n:cpu个数
-numar opts:模拟一个多节点的非统一内存访问,如果cpu内存都被忽略,资源平分
-nographic:通常,QEMU使用SDL显示VGA输出,使用这个选项,使qemu成为简单的命令行应用程序
-k language:键盘布局,默认是en-us
-audio-help:声音子系统帮助显示,驱动列表,可调参数等
-soundhw card1,card2,... or -soundhw all:使能音频并选择声卡
-localtime:设置真实时钟为本地时钟,默认是UTC时间
-full-screen:全屏
-pidfile file:存储qemu进程PID到文件,用于脚本启动
-daemonize:初始化后QEMU进程长期驻留,qemu将不从标准IO分离,除非他准备连接到他的设备中的起其中一个。这个选项用于外部程序启动qemu
而不用去初始化静态条件。
-option-rom file:加载一个可选ROM文件内容,用于加载像EtherBoot这样的东西。
-mtdblock file:



USB选项:

-usb:使能usb驱动,默认项
-usbdevice devname:添加usb设备名称,有效的设备如下:
 mouse:虚拟鼠标,会覆盖ps/2鼠标仿真
 tablet:使用绝对坐标的指针设备(如:触摸屏),也会覆盖ps/2鼠标
 disk:file:基于文件的大容量存储设备
 host:bus.addr:通过总线地址传递主机设备(仅仅linux平台有效)
 host:vendor_id:product_id:通过pid、vid传递主机设备(仅仅linux平台有效)
Network options: (网络这里先不做重点)
-net nic[,vlan=n][,macaddr=addr][,model=type]:
-net user[,vlan=n][,hostname=name]:
-net tap[,vlan=n][,fd=h][,ifname=name][,script=file]:
-net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]:
-net socket[,vlan=n][,fd=h][,mcast=maddr:port]:
-net none:
-tftp prefix:
-smb dir:
-redir [tcp|udp]:host-port:[guest-host]:guest-port:重定向网络
-kernel bzImage: 内核镜像
-append cmdline:内核命令行
-initrd file:使用文件作为ram盘



Debug/Expert options: 
-serial dev:重定向虚拟串口到主机设备。默认设备是vc在图形模式下,是stdio在非图形界面。这个选项可被使用多次,可模拟4个串口。使用-

serial none会屏蔽所有串口。有效的字符设备是:
 vc:虚拟控制台
 pty:仅仅linux有效,虚拟tty(一个虚拟伪终端会被立刻分配)
 none:没有设备被分配
 null:无效设备
 /dev/XXX:仅仅linux有效,使用主机tty,e.g. `/dev/ttyS0'. 
 /dev/parportN:仅仅linux有效,使用主机并口N,当前仅仅SPP(串行式)特征能被使用。
 file:filename:写输出到filename,没有字符被读
 stdio:仅仅unix可用
 pipe:filename:命名管道
 COMn:仅仅windows可用,使用主机串口n
 udp:[remote_host]:remote_port[@[src_ip]:src_port]:这实现了UDP网络控制台,当远程主机(remote_host)或源ip(src_ip)未指定

,则会被默认设置为0.0.0.0。当未使用源端口(src_port)

tcp:[host]:port[,server][,nowait][,nodelay]:TCP网络控制方式有两种模式。可以发送串口I/O到一个位置或等待一个连接。默认情况下,TCP

网络控制台通过port发送主机。
Example to send tcp console to 192.168.0.2 port 4444 
-serial tcp:192.168.0.2:4444 
Example to listen and wait on port 4444 for connection 
-serial tcp::4444,server 
Example to not wait and listen on ip 192.168.0.100 port 4444 
-serial tcp:192.168.0.100:4444,server,nowait

telnet:host:port[,server][,nowait][,nodelay]:telnet协议是用来代替原始的tcp协议,这个选项工作类似于-serial tcp。

unix:path[,server][,nowait]:使用unix域套接字代替tcp套接字,这个选项工作类似于-serial tcp。

-parallel dev:重定向虚拟并口到主机设备。最多可虚拟3个并口。
暂无该命令例子,添加例子

评论(0)

暂无评论

评论

名字:
验证码:
获取验证码
内容: