2012年9月26日 星期三
qemu 下載與安裝
1. 下載:
Qemu 下載網頁 - http://wiki.qemu.org/Download
2. 解壓縮:
tar xfva qemu-2.5.0.tar.bz2
解開後會出現 qemu-2.5.0 目錄
3. 設定前安裝套件:
libtool
zlib1g-dev
pkg-config
libsdl1.2-dev
libcurl4-openssl-dev
libsasl2-dev
libaio-dev
libvde-dev
libvdeplug2-dev
uuid-dev
libcap-ng-dev
4. 設定:
在 qemu-2.5.0 目錄下執行:
./configure
請注意底下兩個參數一定要設定成功:
SDL support yes
KVM support yes
如果有類似底下訊息時:
lzo support no
bzip2 support no
我們可以編輯 configure 這個檔案,搜尋 bzip2 與 lzo 這兩個關鍵字,此時會發現有底下片段,分別是:
if test "$bzip2" = "yes"; then
feature_not_found "libbzip2" "Install libbzip2 devel"
fi
以及
if test "$lzo" = "yes"; then
feature_not_found "liblzo2" "Install liblzo2 devel"
fi
這表示我們的系統中沒有安裝 bzip2 devel 以及 lzo devel 套件,在 Debian 底下,此兩個套件的名稱為:
libbz2-dev
liblzo2-dev
將上述兩個套件安裝,再執行 ./configure 後會發現 lzo 及 bzip2 都已支援,其訊息如下:
lzo support yes
bzip2 support yes
其它找不到套件的訊息依此類推來解決,理論上可以作到的訊息如下:
./configure
Disabling libtool due to broken toolchain support
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 /home/herman/tmp/qemu/qemu-2.5.0
C compiler cc
Host C compiler cc
C++ compiler c++
Objective-C compiler cc
ARFLAGS rv
CFLAGS -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g
QEMU_CFLAGS -I/usr/include/pixman-1 -fPIE -DPIE -m64 -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-strong -I/usr/include/libpng12 -I/usr/local/include/spice-server -I/usr/local/include/cacard -I/usr/local/include -I/usr/local/include/spice-1 -I/usr/include/nss -I/usr/include/nspr -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/local/include/cacard -I/usr/include/nss -I/usr/include/nspr -I/usr/local/include/libusb-1.0 -I/usr/local/include
LDFLAGS -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g
make make
install install
python python -B
smbd /usr/sbin/smbd
module support no
host CPU x86_64
host big endian no
target list 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 tricore-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 ppc64le-linux-user s390x-linux-user sh4-linux-user sh4eb-linux-user sparc-linux-user sparc32plus-linux-user sparc64-linux-user tilegx-linux-user unicore32-linux-user x86_64-linux-user
tcg debug enabled no
gprof enabled no
sparse enabled no
strip binaries yes
profiler no
static build no
pixman system
SDL support yes
GTK support yes
GTK GL support no
GNUTLS support no
GNUTLS hash no
libgcrypt yes
nettle no ()
libtasn1 yes
VTE support yes
curses support yes
virgl support no
curl support yes
mingw32 support no
Audio drivers oss
Block whitelist (rw)
Block whitelist (ro)
VirtFS support no
VNC support yes
VNC SASL support yes
VNC JPEG support yes
VNC PNG support yes
xen support no
brlapi support yes
bluez support yes
Documentation yes
PIE yes
vde support yes
netmap support no
Linux AIO support yes
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 yes
libcap-ng support yes
vhost-net support yes
vhost-scsi support yes
Trace backends nop
spice support yes (0.12.7/0.12.5)
rbd support yes
xfsctl support yes
smartcard support yes
libusb yes
usb net redir yes
OpenGL support no
libiscsi support yes
libnfs support no
build guest agent yes
QGA VSS support no
QGA w32 disk info no
QGA MSI support no
seccomp support yes
coroutine backend ucontext
coroutine pool yes
GlusterFS support no
Archipelago support no
gcov gcov
gcov enabled no
TPM support yes
libssh2 support yes
TPM passthrough yes
QOM debugging yes
vhdx yes
lzo support yes
snappy support no
bzip2 support yes
NUMA host support no
tcmalloc support no
jemalloc support no
5. 編譯 qemu
請在設定完成後執行:
make -j 8 (8 核)
6. 安裝
請以 root 權限執行底下指令:
make install
將 qemu 安裝在 /usr/local/bin 目錄下
7. 測試
X86 版本:
請執行底下指令:
$ qemu-system-x86_64 -version
qemu-system-x86_64: error while loading shared libraries: libiscsi.so.1: cannot open shared object file: No such file or directory
我們會看到 qemu-system-x86_64 抱怨找不到 libiscsi.so.1,這最主要的原因目前的 libiscsi 這個動態連結函式庫的檔名已經是 libiscsi.so.2 了,所以 qemu 找不到 libiscsi.so.1,要解決此問題,我們要手動新增這個檔案,請以 root 權限切換至 /usr/lib/x86_64-linux-gnu 目錄,執行:
/usr/lib/x86_64-linux-gnu# ls -l libiscsi.so*
lrwxrwxrwx 1 root root 18 Jul 31 2014 libiscsi.so -> libiscsi.so.2.1.12
lrwxrwxrwx 1 root root 18 Jul 31 2014 libiscsi.so.2 -> libiscsi.so.2.1.12
-rw-r--r-- 1 root root 143344 Jul 31 2014 libiscsi.so.2.1.12
可以看到目前只有 libiscsi.so.2 這個檔案,在此目錄中要再新增 libiscsi.so.1 連結檔,指令如下:
/usr/lib/x86_64-linux-gnu# ln -s libiscsi.so.2.1.12 libiscsi.so.1
之後可以再執行 ls 確認一下連結檔是否已建立成功:
/usr/lib/x86_64-linux-gnu# ls -l libiscsi*
-rw-r--r-- 1 root root 223084 Jul 31 2014 libiscsi.a
lrwxrwxrwx 1 root root 18 Jul 31 2014 libiscsi.so -> libiscsi.so.2.1.12
lrwxrwxrwx 1 root root 18 Mar 25 10:43 libiscsi.so.1 -> libiscsi.so.2.1.12
lrwxrwxrwx 1 root root 18 Jul 31 2014 libiscsi.so.2 -> libiscsi.so.2.1.12
-rw-r--r-- 1 root root 143344 Jul 31 2014 libiscsi.so.2.1.12
此時再執行 qemu 即沒有問題:
$ qemu-system-x86_64 -version
QEMU emulator version 2.5.0, Copyright (c) 2003-2008 Fabrice Bellard
qemu-system-arm -M ?
可以看到 qemu arm 模擬器的資訊
qemu-system-arm -version
可以看到 qemu 模擬器版本資訊
QEMU emulator version 1.2.0, Copyright (c) 2003-2008 Fabrice Bellard
訂閱:
文章 (Atom)