windows下利用qemu学习开发linux

学习qemu是我工作以来一直进行的事情,可一直都没有全面系统的学习与记录过。

        qemu是一个模拟器、虚拟机,跟大家伙常用的virtual box 和VMware都是差不多意思的。只不过这个qemu更适合于开发者使用,首先它是免费的,并且是开源的,而且速度不是那么快,但是针对于嵌入式开发的学习还是有很大用途的。因为它支持很多平台ARM X86 X64 MIPS等等。软件平台能运行在mac上windows上linux上,有人用它在安卓上跑w

        使用起来大部分都是用命令行进行操作,所以非开发者就不要那么深入了,目前qemu的使用很是广泛,据我所知安卓的模拟器应该就是qemu,思科的GNS3底层也可以用qemu。因为网上大多数教程都介绍的是linux下的qemu使用方法,为了不重复,就只说windows下的使用教程,

一.如何获取qemu

百度qemu for windows qemu下载站 ;

下载一个最新的版本吧。qemu下载地址 windows的安装过程简单明了,不介绍


安装完成后在安装目录下能找到C:\Program Files (x86)\qemu 找到N多exe 就是qemu 的应用程序


        以x86 32位为例讲解 

        至此获取qemu就成功了。主要关心的几个qemu应用程序分别名字为qemu-system-i386.exe  qemu-img.exe qemu-io.exe

二.   qemu快速开始 qemu的hello world。如何用qemu启动一个镜像。

为了更加快速的开始,我们的镜像都不用自己制作直接下载。现在openwrt比较流行,我们就尝试用qemu如何启动openwrt。

        可以简单的分为三步,

1.百度找到openwrt的镜像

2.编写一个启动脚本

3.启动openwrt的qemu

百度一下openwrt找到openwrt的Y文官网下载地址(https://downloads.openwrt.org/chaos_calmer/15.05-rc2/),不是崇洋媚外,国内的openwrt.cn根本没人搞X86


找到x86的镜像下载下载这个文件.

https://downloads.openwrt.org/chaos_calmer/15.05-rc2/x86/generic/


       2.编写启动脚本;run.bat内容如下 这个bat就放在qemu安装目录下

qemu-system-i386.exe -L . -m 128  -hda  openwrt-x86-generic-combined-ext4.img  


其中 openwrt-x86-generic-combined-ext4.img 就是下载文件解压后得到的。

运行结果:



用qemu能够让你自己编译的kernel +image直接运行。使用起来较为方便。不需要硬件复杂的烧写过程。

Qemu 1.0.1 Windows QEMU emulator version 1.0.1, Copyright (c) 2003-2008 Fabrice Bellard usage: qemu [options] [disk_image] 'disk_image' is a raw hard disk image for IDE hard disk 0 Standard options: -h or -help display this help and exit -version display version information and exit -machine [type=]name[,prop[=value][,...]] selects emulated machine (-machine ? for list) property accel=accel1[:accel2[:...]] selects accelerator supported accelerators are kvm, xen, tcg (default: tcg) -cpu cpu select CPU (-cpu ? for list) -smp n[,maxcpus=cpus][,cores=cores][,threads=threads][,sockets=sockets] set the number of CPUs to 'n' [default=1] maxcpus= maximum number of total cpus, including offline CPUs for hotplug, etc cores= number of CPU cores on one socket threads= number of threads on one CPU core sockets= number of discrete sockets in the system -numa node[,mem=size][,cpus=cpu[-cpu]][,nodeid=node] -fda/-fdb file use 'file' as floppy disk 0/1 image -hda/-hdb file use 'file' as IDE hard disk 0/1 image -hdc/-hdd file use 'file' as IDE hard disk 2/3 image -cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master) -drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i] [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off] [,cache=writethrough|writeback|none|directsync|unsafe][,format=f] [,serial=s][,addr=A][,id=name][,aio=threads|native] [,readonly=on|off] use 'file' as a drive image -set group.id.arg=value set parameter for item of type i.e. -set drive.$id.file=/path/to/image -global driver.property=value set a global default for a driver property -mtdblock file use 'file' as on-board Flash memory image -sd file use 'file' as SecureDigital card image -pflash file use 'file'
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值