首先下载qemu:
git clonegit://git.sv.gnu.org/qemu.git或者自行下载需要版本http://wiki.qemu.org/Download
然后安装
cd qemu
./configure--enable-kvm --target-list="x86_64-softmmu" //选择对应的系统版本和位数
make && makeinstall
安装过程可能出现的错误解决办法:
安装glib:apt-get install libglib2.0-dev
安装libtool:apt-get install libtool
解决依赖模块更新:
git submodule update --init pixman
gitsubmodule update --init dtc若更新不成功则需手动执行将下载的dtc-1760e7c.tar.gz的内容拷贝到qemu目录下的dtc/中
dtc下载地址:git.qemu-project.org/?p=dtc.git;a=snapshot;h=1760e7ca03894689118646e229ca9487158cd0e8;sf=tgz
######################################################################################################################
问题详解(转载):
http://itdrafts.blogspot.jp/2015/07/qemu-unable-to-find-current-revision-in.html
root@laikc-virtual-machine:~# root@laikc-virtual-machine:~# git clone git://git.qemu-project.org/qemu.git
remote: Counting objects: 191623, done.
remote: Compressing objects: 100% (44312/44312), done.
remote: Total 191623 (delta 153059), reused 183484 (delta 146732)
Receiving objects: 100% (191623/191623), 63.02 MiB | 456 KiB/s, done.
Resolving deltas: 100% (153059/153059), done.
Checking out files: 100% (3603/3603), done.cd gemu
檢查 ./configure 參數
./configure --help
Usage: configure [options]
Options: [defaults in brackets after descriptions]
Standard options:
--help print this message
--prefix=PREFIX install in PREFIX [/usr/local]
--interp-prefix=PREFIX where to find shared libraries, etc.
use %M for cpu name [/usr/gnemul/qemu-%M]
--target-list=LIST set target list (default: build everything)
Available targets: aarch64-softmmu alpha-softmmu
arm-softmmu cris-softmmu i386-softmmu lm32-softmmu
m68k-softmmu microblaze-softmmu microblazeel-softmmu
mips-softmmu mips64-softmmu mips64el-softmmu
mipsel-softmmu moxie-softmmu or32-softmmu
ppc-softmmu ppc64-softmmu ppcemb-softmmu
s390x-softmmu sh4-softmmu sh4eb-softmmu
sparc-softmmu sparc64-softmmu unicore32-softmmu
x86_64-softmmu xtensa-softmmu xtensaeb-softmmu
aarch64-linux-user alpha-linux-user arm-linux-user
armeb-linux-user cris-linux-user i386-linux-user
m68k-linux-user microblaze-linux-user
microblazeel-linux-user mips-linux-user
mips64-linux-user mips64el-linux-user
mipsel-linux-user mipsn32-linux-user
mipsn32el-linux-user or32-linux-user ppc-linux-user
ppc64-linux-user ppc64abi32-linux-user
s390x-linux-user sh4-linux-user sh4eb-linux-user
sparc-linux-user sparc32plus-linux-user
sparc64-linux-user unicore32-linux-user
x86_64-linux-user
Advanced options (experts only):
--source-path=PATH path of source code [/root/qemu]
--cross-prefix=PREFIX use PREFIX for compile tools []
--cc=CC use C compiler CC [cc]
--iasl=IASL use ACPI compiler IASL [iasl]
--host-cc=CC use C compiler CC [cc] for code run at
build time
--cxx=CXX use C++ compiler CXX [c++]
--objcc=OBJCC use Objective-C compiler OBJCC [cc]
--extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
--extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
--make=MAKE use specified make [make]
--install=INSTALL use specified install [install]
--python=PYTHON use specified python [python -B]
--smbd=SMBD use specified smbd [/usr/sbin/smbd]
--static enable static build [no]
--mandir=PATH install man pages in PATH
--datadir=PATH install firmware in PATH/qemu
--docdir=PATH install documentation in PATH/qemu
--bindir=PATH install binaries in PATH
--libdir=PATH install libraries in PATH
--sysconfdir=PATH install config in PATH/qemu
--localstatedir=PATH install local state in PATH (set at runtime on win32)
--with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [/qemu]
--enable-modules enable modules support
--enable-debug-tcg enable TCG debugging
--disable-debug-tcg disable TCG debugging (default)
--enable-debug-info enable debugging information (default)
--disable-debug-info disable debugging information
--enable-debug enable common debug build options
--enable-sparse enable sparse checker
--disable-sparse disable sparse checker (default)
--disable-strip disable stripping binaries
--disable-werror disable compilation abort on warning
--disable-stack-protector disable compiler-provided stack protection
--disable-sdl disable SDL
--enable-sdl enable SDL
--with-sdlabi select preferred SDL ABI 1.2 or 2.0
--disable-gtk disable gtk UI
--enable-gtk enable gtk UI
--with-gtkabi select preferred GTK ABI 2.0 or 3.0
--disable-virtfs disable VirtFS
--enable-virtfs enable VirtFS
--disable-vnc disable VNC
--enable-vnc enable VNC
--disable-cocoa disable Cocoa (Mac OS X only)
--enable-cocoa enable Cocoa (default on Mac OS X)
--audio-drv-list=LIST set audio drivers list:
Available drivers: oss alsa sdl esd pa fmod
--block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
--block-drv-rw-whitelist=L
set block driver read-write whitelist
(affects only QEMU, not qemu-img)
--block-drv-ro-whitelist=L
set block driver read-only whitelist
(affects only QEMU, not qemu-img)
--disable-xen disable xen backend driver support
--enable-xen enable xen backend driver support
--disable-xen-pci-passthrough
--enable-xen-pci-passthrough
--disable-brlapi disable BrlAPI
--enable-brlapi enable BrlAPI
--disable-vnc-tls disable TLS encryption for VNC server
--enable-vnc-tls enable TLS encryption for VNC server
--disable-vnc-sasl disable SASL encryption for VNC server
--enable-vnc-sasl enable SASL encryption for VNC server
--disable-vnc-jpeg disable JPEG lossy compression for VNC server
--enable-vnc-jpeg enable JPEG lossy compression for VNC server
--disable-vnc-png disable PNG compression for VNC server (default)
--enable-vnc-png enable PNG compression for VNC server
--disable-vnc-ws disable Websockets support for VNC server
--enable-vnc-ws enable Websockets support for VNC server
--disable-curses disable curses output
--enable-curses enable curses output
--disable-curl disable curl connectivity
--enable-curl enable curl connectivity
--disable-fdt disable fdt device tree
--enable-fdt enable fdt device tree
--disable-bluez disable bluez stack connectivity
--enable-bluez enable bluez stack connectivity
--disable-slirp disable SLIRP userspace network connectivity
--disable-kvm disable KVM acceleration support
--enable-kvm enable KVM acceleration support
--disable-rdma disable RDMA-based migration support
--enable-rdma enable RDMA-based migration support
--enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
--enable-system enable all system emulation targets
--disable-system disable all system emulation targets
--enable-user enable supported user emulation targets
--disable-user disable all user emulation targets
--enable-linux-user enable all linux usermode emulation targets
--disable-linux-user disable all linux usermode emulation targets
--enable-bsd-user enable all BSD usermode emulation targets
--disable-bsd-user disable all BSD usermode emulation targets
--enable-guest-base enable GUEST_BASE support for usermode
emulation targets
--disable-guest-base disable GUEST_BASE support
--enable-pie build Position Independent Executables
--disable-pie do not build Position Independent Executables
--fmod-lib path to FMOD library
--fmod-inc path to FMOD includes
--oss-lib path to OSS library
--cpu=CPU Build for host CPU [i386]
--disable-uuid disable uuid support
--enable-uuid enable uuid support
--disable-vde disable support for vde network
--enable-vde enable support for vde network
--disable-netmap disable support for netmap network
--enable-netmap enable support for netmap network
--disable-linux-aio disable Linux AIO support
--enable-linux-aio enable Linux AIO support
--disable-cap-ng disable libcap-ng support
--enable-cap-ng enable libcap-ng support
--disable-attr disables attr and xattr support
--enable-attr enable attr and xattr support
--disable-blobs disable installing provided firmware blobs
--enable-docs enable documentation build
--disable-docs disable documentation build
--disable-vhost-net disable vhost-net acceleration support
--enable-vhost-net enable vhost-net acceleration support
--enable-trace-backend=B Set trace backend
Available backends: nop, dtrace, ftrace, simple, stderr, ust
--with-trace-file=NAME Full PATH,NAME of file to store traces
Default:trace-
--disable-spice disable spice
--enable-spice enable spice
--enable-rbd enable building the rados block device (rbd)
--disable-libiscsi disable iscsi support
--enable-libiscsi enable iscsi support
--disable-libnfs disable nfs support
--enable-libnfs enable nfs support
--disable-smartcard-nss disable smartcard nss support
--enable-smartcard-nss enable smartcard nss support
--disable-libusb disable libusb (for usb passthrough)
--enable-libusb enable libusb (for usb passthrough)
--disable-usb-redir disable usb network redirection support
--enable-usb-redir enable usb network redirection support
--enable-lzo enable the support of lzo compression library
--enable-snappy enable the support of snappy compression library
--disable-guest-agent disable building of the QEMU Guest Agent
--enable-guest-agent enable building of the QEMU Guest Agent
--with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
--with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
--disable-seccomp disable seccomp support
--enable-seccomp enables seccomp support
--with-coroutine=BACKEND coroutine backend. Supported options:
gthread, ucontext, sigaltstack, windows
--disable-coroutine-pool disable coroutine freelist (worse performance)
--enable-coroutine-pool enable coroutine freelist (better performance)
--enable-glusterfs enable GlusterFS backend
--disable-glusterfs disable GlusterFS backend
--enable-gcov enable test coverage analysis with gcov
--gcov=GCOV use specified gcov [gcov]
--enable-tpm enable TPM support
--disable-libssh2 disable ssh block device support
--enable-libssh2 enable ssh block device support
--disable-vhdx disables support for the Microsoft VHDX image format
--enable-vhdx enable support for the Microsoft VHDX image format
--disable-quorum disable quorum block filter support
--enable-quorum enable quorum block filter support
NOTE: The object files are built at the place where configure is launched檢查 gcc version and path
root@laikc-virtual-machine:~/qemu# ls /usr/bin/gcc*
/usr/bin/gcc /usr/bin/gcc-ar-4.7 /usr/bin/gcc-ranlib-4.7
/usr/bin/gcc-4.7 /usr/bin/gcc-nm-4.7
root@laikc-virtual-machine:~/qemu#我們用 ARM 系列的 CPU
./configure --cc=/usr/bin/gcc-4.7 --host-cc=/usr/bin/gcc-4.7 --target-list=arm-softmmu
./configure --cc=/usr/bin/gcc-4.7 --host-cc=/usr/bin/gcc-4.7 --target-list=arm-softmmu
No C++ compiler available; disabling C++ specific optional code
Disabling libtool due to broken toolchain support
ERROR: zlib check failed
Make sure to have the zlib libs and headers installed.失敗囉, 缺 zlib
root@laikc-virtual-machine:~/qemu#安裝 zlib
apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
zlib1g-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 177 kB of archives.
After this operation, 420 kB of additional disk space will be used.
Get:1 http://tw.archive.ubuntu.com/ubuntu/ raring/main zlib1g-dev i386 1:1.2.7.dfsg-13ubuntu2 [177 kB]
Fetched 177 kB in 0s (205 kB/s)
Selecting previously unselected package zlib1g-dev:i386.
(Reading database ... 235219 files and directories currently installed.)
Unpacking zlib1g-dev:i386 (from .../zlib1g-dev_1%3a1.2.7.dfsg-13ubuntu2_i386.deb) ...
Processing triggers for man-db ...
Setting up zlib1g-dev:i386 (1:1.2.7.dfsg-13ubuntu2) ...再來...失敗囉
./configure --cc=/usr/bin/gcc-4.7 --host-cc=/usr/bin/gcc-4.7 --target-list=arm-softmmu
No C++ compiler available; disabling C++ specific optional code
Disabling libtool due to broken toolchain support
ERROR: glib-2.12 gthread-2.0 is required to compile QEMU安裝 libtool
root@laikc-virtual-machine:~/qemu# apt-get install libtool
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
autotools-dev libltdl-dev
Suggested packages:
libtool-doc autoconf automaken gfortran fortran95-compiler gcj
The following NEW packages will be installed:
autotools-dev libltdl-dev libtool
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 549 kB of archives.
After this operation, 2,553 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://tw.archive.ubuntu.com/ubuntu/ raring/main autotools-dev all 20120608.1 [42.9 kB]
Get:2 http://tw.archive.ubuntu.com/ubuntu/ raring/main libltdl-dev i386 2.4.2-1.2ubuntu1 [203 kB]
Get:3 http://tw.archive.ubuntu.com/ubuntu/ raring/main libtool i386 2.4.2-1.2ubuntu1 [303 kB]
Fetched 549 kB in 0s (1,884 kB/s)
Selecting previously unselected package autotools-dev.
(Reading database ... 235247 files and directories currently installed.)
Unpacking autotools-dev (from .../autotools-dev_20120608.1_all.deb) ...
Selecting previously unselected package libltdl-dev:i386.
Unpacking libltdl-dev:i386 (from .../libltdl-dev_2.4.2-1.2ubuntu1_i386.deb) ...
Selecting previously unselected package libtool.
Unpacking libtool (from .../libtool_2.4.2-1.2ubuntu1_i386.deb) ...
Processing triggers for man-db ...
Setting up autotools-dev (20120608.1) ...
Setting up libltdl-dev:i386 (2.4.2-1.2ubuntu1) ...
Setting up libtool (2.4.2-1.2ubuntu1) ...
root@laikc-virtual-machine:~/qemu#失敗再失敗....裝軟體囉, 細節不寫了
apt-get install autoconf
apt-get install libglib2.0
apt-get install libsdl-console
apt-get install libsdl-console-dev./configure --cc=/usr/bin/gcc-4.7 --host-cc=/usr/bin/gcc-4.7 --target-list=arm-softmmu --enable-sdl
ERROR: pixman not present. Your options:
(1) Preferred: Install the pixman devel package (any recent
distro should have packages as Xorg needs pixman too).
(2) Fetch the pixman submodule, using:
git submodule update --init pixman又缺東西了
執行
root@laikc-virtual-machine:~/qemu# git submodule update --init pixman
cd pixman
autoreconf -v --install
cd ..
root@laikc-virtual-machine:~/qemu#
root@laikc-virtual-machine:~/qemu# ./configure --cc=/usr/bin/gcc-4.7 --host-cc=/usr/bin/gcc-4.7 --target-list=arm-softmmu --enable-sdl
ERROR: DTC (libfdt) not present. Your options:
(1) Preferred: Install the DTC (libfdt) devel package
(2) Fetch the DTC submodule, using:
git submodule update --init dtc
又缺東西了
執行
git submodule update --init dtcroot@laikc-virtual-machine:~/qemu# ./configure --cc=/usr/bin/gcc-4.7 --host-cc=/usr/bin/gcc-4.7 --target-list=arm-softmmu --enable-sdl
No C++ compiler available; disabling C++ specific optional code
Install prefix /usr/local
BIOS directory /usr/local/share/qemu
binary directory /usr/local/bin
library directory /usr/local/lib
module directory /usr/local/lib/qemu
libexec directory /usr/local/libexec
include directory /usr/local/include
config directory /usr/local/etc
local state directory /usr/local/var
Manual directory /usr/local/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path /root/qemu
C compiler /usr/bin/gcc-4.7
Host C compiler /usr/bin/gcc-4.7
C++ compiler
Objective-C compiler /usr/bin/gcc-4.7
ARFLAGS rv
CFLAGS -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pthread -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -g
QEMU_CFLAGS -Werror -fPIE -DPIE -m32 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -Wendif-labels -Wmissing-include-dirs
-Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all -I/usr/include/libpng12 -I$(SRC_PATH)/pixman/pixman -I$(BUILD_DIR)/pixman/pixman
-I$(SRC_PATH)/dtc/libfdt
LDFLAGS -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m32 -g
make make
install install
python python -B
smbd /usr/sbin/smbd
module support no
host CPU i386
host big endian no
target list arm-softmmu
tcg debug enabled no
gprof enabled no
sparse enabled no
strip binaries yes
profiler no
static build no
pixman internal
SDL support yes
GTK support no
VTE support no
curses support no
curl support no
mingw32 support no
Audio drivers oss
Block whitelist (rw)
Block whitelist (ro)
VirtFS support no
VNC support yes
VNC TLS support no
VNC SASL support no
VNC JPEG support no
VNC PNG support yes
VNC WS support no
xen support no
brlapi support no
bluez support no
Documentation no
GUEST_BASE yes
PIE yes
vde support no
netmap support no
Linux AIO support no
ATTR/XATTR support yes
Install blobs yes
KVM support yes
RDMA support no
TCG interpreter no
fdt support yes
preadv support yes
fdatasync yes
madvise yes
posix_madvise yes
sigev_thread_id yes
uuid support no
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
Trace backend nop
spice support no
rbd support no
xfsctl support no
nss used no
libusb no
usb net redir no
GLX support yes
libiscsi support no
libnfs support no
build guest agent yes
QGA VSS support no
seccomp support no
coroutine backend ucontext
coroutine pool yes
GlusterFS support no
virtio-blk-data-plane no
gcov gcov
gcov enabled no
TPM support no
libssh2 support no
TPM passthrough no
QOM debugging yes
vhdx no
Quorum no
lzo support no
snappy support no
root@laikc-virtual-machine:~/qemu#基本上可以了 Makefile 有了
root@laikc-virtual-machine:~/qemu# make
沒錯誤
root@laikc-virtual-machine:~/qemu# make install
內定是 /usr/local/bin
root@laikc-virtual-machine:~/arm-test# ls -al /usr/local/bin/*
-rwxr-xr-x 1 root root 359796 5月 31 15:45 /usr/local/bin/qemu-ga
-rwxr-xr-x 1 root root 839976 5月 31 15:45 /usr/local/bin/qemu-img
-rwxr-xr-x 1 root root 815636 5月 31 15:45 /usr/local/bin/qemu-io
-rwxr-xr-x 1 root root 811608 5月 31 15:45 /usr/local/bin/qemu-nbd
-rwxr-xr-x 1 root root 6101088 5月 31 15:45 /usr/local/bin/qemu-system-arm
下載測試 image 找這個 arm-test-0.2.tar.gz
http://wiki.qemu.org/Testing
arm-test-0.2.tar.gz ARM Linux 2.6 test kernel and initrd disk image
root@laikc-virtual-machine:~# wget http://wiki.qemu.org/download/arm-test-0.2.tar.gz
--2014-05-31 16:07:22-- http://wiki.qemu.org/download/arm-test-0.2.tar.gz
Resolving wiki.qemu.org (wiki.qemu.org)... 140.211.15.109
Connecting to wiki.qemu.org (wiki.qemu.org)|140.211.15.109|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3310162 (3.2M) [application/x-gzip]
Saving to: ‘arm-test-0.2.tar.gz’
root@laikc-virtual-machine:~# tar xvfz arm-test-0.2.tar.gz
arm-test/
arm-test/arm_root.img
arm-test/README
arm-test/zImage.integrator
root@laikc-virtual-machine:~#
Check your machine and kernel image type, 注意與舊版不同參數, machine 與 kernel 不合就不行!!!!!!!!!!!!!!!!!!!!
這個 zImage.integrator 是 integratorcp 這個
root@laikc-virtual-machine:~# /usr/local/bin/qemu-system-arm -machine help
Supported machines are:
versatileab ARM Versatile/AB (ARM926EJ-S)
versatilepb ARM Versatile/PB (ARM926EJ-S)
lm3s811evb Stellaris LM3S811EVB
z2 Zipit Z2 (PXA27x)
connex Gumstix Connex (PXA255)
sx1 Siemens SX1 (OMAP310) V2
realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
cubieboard cubietech cubieboard
vexpress-a9 ARM Versatile Express for Cortex-A9
lm3s6965evb Stellaris LM3S6965EVB
realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
mainstone Mainstone II (PXA27x)
terrier Terrier PDA (PXA270)
n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
nuri Samsung NURI board (Exynos4210)
realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
verdex Gumstix Verdex (PXA270)
spitz Spitz PDA (PXA270)
canon-a1100 Canon PowerShot A1100 IS
akita Akita PDA (PXA270)
smdkc210 Samsung SMDKC210 board (Exynos4210)
integratorcp ARM Integrator/CP (ARM926EJ-S)
sx1-v1 Siemens SX1 (OMAP310) V1
kzm ARM KZM Emulation Baseboard (ARM1136)
highbank Calxeda Highbank (ECX-1000)
n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
collie Collie PDA (SA-1110)
realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
vexpress-a15 ARM Versatile Express for Cortex-A15
none empty machine
cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
tosa Tosa PDA (PXA255)
midway Calxeda Midway (ECX-2000)
virt ARM Virtual Machine
borzoi Borzoi PDA (PXA270)
熱身試驗
root@laikc-virtual-machine:~# cd arm-test/
root@laikc-virtual-machine:~/arm-test#
root@laikc-virtual-machine:~/arm-test# /usr/local/bin/qemu-system-arm
-machine integratorcp -kernel zImage.integrator -initrd arm_root.img -nographic
Uncompressing Linux.......................................................................... done, booting the kernel.
This root FS contains most basic linux utilities (implemented with busybox)
and the Lynx web browser.
Kernel config is available through /proc/config.gz
Log in as root with no password.
qemu login: root
BusyBox v1.1.2 (2006.05.04-15:30+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
-----------------------------------------------------------------------------------
恭喜成功
其餘功能用類似的方法加吧, configure 去 enable 功能, 缺 lib 就加, 沒 apt-get 就用 source 自己來吧
也可再 Ubuntu 13.04 中執行
————————————————
版权声明:本文为CSDN博主「weimingyu945」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weimingyu945/article/details/50013251
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。