记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。

QEMU编译安装支持ARM架构


QEMU是一个支持跨平台虚拟化的虚拟机,有user mode和system mode两种配置方式。其中qemu在system mode配置下模拟出整个计算机,可以在qemu之上运行一个操作系统。QEMU的system mode与常见的VMware和Virtualbox等虚拟机比较相似,但是QEMU的优势是可以跨指令集。例如,VMware和Virtualbox之类的工具通常只能在x86计算机上虚拟出一个x86计算机,而QEMU支持在x86上虚拟出一个ARM计算机。qemu在user mode配置下,可以运行跟当前平台指令集不同的平台可执行程序。例如可以用qemu在x86上运行ARM的可执行程序,但是两个平台必须是同一种操作系统,比如Linux。

QEMU还支持很多其他的平台,详细列表参见这里。

QEMU中有两个重要的名词host和target(guest),其中host表示qemu程序本身运行的平台,target(guest)表示qemu虚拟出的计算机平台(system mode)或支持的可执行程序的运行平台(user mode)。

下面描述一下编译和使用host为x86,target(guest)为ARM的步骤

1. 下载QEMU源码

wget http://wiki.qemu-project.org/download/qemu-1.4.0.tar.bz2

2. 解压、configure

tar xvf qemu-1.4.0.tar.bz2
cd qemu-1.4.0
./configure --target-list=arm-softmmu,arm-linux-user --prefix=<prefix>

其中--target-list指定需要编译的target(guest),arm-softmmu表示要编译system mode的QEMU,arm-linux-user表示要编译user mode的QEMU。

如果configure提示缺少某些库的话,按照提示安装即可。

3. make和安装

make && make install

编译完成之后,得到的qemu-system-arm对应的就是system mode的虚拟机,qemu-arm对应的就是user mode的模拟器。

4. 使用qemu-arm

使用qemu-arm的方法很简单,只需要在原来的程序执行命令之前添加qemu-arm即可。

例如: 原来运行命令

<executable> <arg1> <arg2> ...

  使用qemu-arm运行

qemu-arm <executable> <arg1> <arg2> ...

5. 使用qemu-system-arm

使用qemu-system-arm的方法相对稍微复杂。


Linux系统安装ARM(官网原文)

QEMU is packaged by most Linux distributions:

  • Arch: pacman -S qemu

  • Debian/Ubuntu: apt-get install qemu

  • Fedora: dnf install @virtualization

  • Gentoo: emerge --ask app-emulation/qemu

  • RHEL/CentOS: yum install qemu-kvm

  • SUSE: zypper install qemu

macOS

QEMU can be installed from Homebrew:

brew install qemu

QEMU requires Mac OS X 10.5 or later, but it is recommendedto use Mac OS X 10.7 or later.

Windows

Stefan Weil provides binaries and installers forboth 32-bit and64-bit Windows.

Source code

Grab the source code for the latest releases and compile it yourself!Detailed compilation instructions can be found in the wiki forLinux,Win32 andmacOS.

or stay on the bleeding edge with the git repository!

Build instructions

To download and build QEMU 2.11.0-rc3:

wget https://download.qemu.org/qemu-2.11.0-rc3.tar.xz
tar xvJf qemu-2.11.0-rc3.tar.xz
cd qemu-2.11.0-rc3
./configure
make

To download and build QEMU from git:

git clone git://git.qemu.org/qemu.git
cd qemu
git submodule init
git submodule update --recursive
./configure
make

The latest development happens on the masterbranch. The stable trees are located in branches namedstable-X.YY branch, where X.YY is the releaseversion.




转载请标明出处【linux系统QEMU编译安装支持ARM架构】。

《www.micoder.cc》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论