2014年6月18日 星期三

自行編譯「完整版 Linaro Qemu」

Linaro Qemu 是 Linaro 基金會所支援的 Qemu,它較官方的 Qemu 支援更多 ARM 硬體,因此十分適合用在嵌入式系統開發上面。qemu linaro 有一項特異功能是使用 usb redir net 以使用網路傳遞 usb 通訊協定, 但是 debian wheezy 的函式庫過於老舊以致於無法將 qemu linaro 的這項功能啟動,在此介紹如何自行外加新版的函式庫以啟動此功能。

假設在 qemu linaro 目錄下執行 ./configure 出現:


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

其解決方式如下:

apt-get install libpixman-1-dev

若是 ./configure 出現問題:

ERROR: DTC not present. Your options:
         (1) Preferred: Install the DTC devel package
         (2) Fetch the DTC submodule, using:
             git submodule update --init dtc

其解決方式為:

apt-get install libfdt-dev

之後有可能出現的錯誤訊息是:

GTK support       no

的訊息,我們可以檢視 configure 檔案,裡面有底下段落:

##########################################
# GTK probe

if test "$gtk" != "no"; then
    gtkpackage="gtk+-$gtkabi"
    if test "$gtkabi" = "3.0" ; then
      gtkversion="3.0.0"
      vtepackage="vte-2.90"
      vteversion="0.32.0"
    else
      gtkversion="2.18.0"
      vtepackage="vte"
      vteversion="0.24.0"

.. (中略)

    elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
        if test "$gtk" = "yes" ; then
            error_exit "libvte not found (required for gtk support)"

.. (下略)

我們可以看到上面有一行:

error_exit "libvte not found (required for gtk support)"

此訊息表示 libvte-dev 之類名稱的套件沒有安裝,我們可以利用 aptitude 安裝 libvte-dev 套件,再執行 ./configure 看看。


seccomp support   no

這表示我們沒有安裝 libseccomp-dev 套件,但是此套件目前在 Wheezy 底下並沒有出現,必須設定 Debian backports 才可以安裝,設定方式請在 /etc/apt/sources.list 中加入底下內容:

#Wheezy Backports
deb http://ftp.tw.debian.org/debian wheezy-backports main

接著執行 apt-get update; apt-get install libseccomp-dev 即可安裝。安裝完畢後我們再執行

./configure

其狀態如下:

seccomp support   yes


1. 下載必要函式庫


apt-get install

libnss3-dev
libudev-dev
libpng12-dev
libghc6-zlib-dev
libogg-dev
libglobus-openssl-dev
libxrandr-dev
libxfixes-dev
libjpeg8-dev
libsasl2-dev
libiscsi-dev
librbd-dev
xfslibs-dev
libbrlapi-dev
libbluetooth-dev
libxen-dev


spice - http://spice-space.org/download.html

http://www.spice-space.org/download/releases/spice-0.12.5.tar.bz2
http://www.spice-space.org/download/releases/spice-protocol-0.12.7.tar.bz2

http://www.spice-space.org/download/usbredir/usbredir-0.7.tar.bz2
https://alioth.debian.org/frs/download.php/3842/pcsc-lite-1.8.7.tar.bz2
#https://alioth.debian.org/frs/download.php/3757/pcsc-lite-1.8.6.tar.bz2


http://jaist.dl.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.19/libusb-1.0.19.tar.bz2



但是在編 spice 時會說 pixman 版本太舊,因此我們還要自行安裝新版 pixman。

pixman - http://cgit.freedesktop.org/pixman/
http://cgit.freedesktop.org/pixman/snapshot/pixman-0.28.2.tar.gz

libcacard - http://spice-space.org/download/libcacard/

http://spice-space.org/download/libcacard/libcacard-0.1.2.tar.bz2


2. 安裝

pcsc-lite-1.8.7 安裝步驟:

tar xfva pcsc-lite-1.8.7.tar.bz2
cd pcsc-lite-1.8.7
./configure
make
# make install



libcacard 安裝步驟:

tar xfva libcacard-0.1.2.tar.bz2
./configure

錯誤訊息:

checking for NSS... no
configure: error: Package requirements (nss) were not met:

No package 'nss' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables NSS_CFLAGS
and NSS_LIBS to avoid the need to call pkg-config.

請安裝

libnss3-dev

即可。

make -j N

make install

libusb-1.0.18 安裝步驟:

tar xfva libusb-1.0.18.tar.bz2

cd libusb-1.0.18

./configure

make -j N

#make install

usbredir-0.7 安裝步驟:

tar xfva usbredir-0.7.tar.bz2
cd usbredir-0.7
./configure
make -j N
#make install


spice-protocol-0.12.7 安裝

tar xfva spice-protocol-0.12.7.tar.bz2
cd spice-protocol-0.12.7
./configure
make -j N
#make install

#cp /usr/local/share/pkgconfig/spice-protocol.pc /usr/lib/pkgconfig/

pixman 安裝步驟:

tar xfva pixman-0.28.2.tar.gz
cd pixman-0.28.2
./autogen
./configure
make -j N

# make install

celt 安裝步驟:

請注意 SPICE 只接受 CELT 0.51 版,因此不要安裝比此新的版本:

wget http://downloads.us.xiph.org/releases/celt/celt-0.5.1.3.tar.gz
tar xfv celt-0.5.1.3.tar.gz
cd celt-0.5.1.3
./configure
make -j N
#make install
cd /usr/local/lib/pkgconfig
/usr/local/lib/pkgconfig# ln -s celt.pc celt051.pc

spice

spice 安裝步驟:

tar xfva spice-0.12.5.tar.bz2
cd spice-0.12.5

./configure --enable-smartcard

但是執行此指令不一定能順利執行,大多數的情況下會有錯誤,我們要一一處理,例如:


錯誤訊息:

checking for CELT051... no
configure: error: Package requirements (celt051 >= 0.5.1.1) were not met:

No package 'celt051' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables CELT051_CFLAGS
and CELT051_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.


如果遇上以上錯誤訊息的話請先安裝先前所提到的 celt 0.51 套件:

錯誤訊息:

checking for pyparsing python module... not found
configure: error: pyparsing python module is required to compile this package

請安裝底下套件:

python-pyparsing

即可。

錯誤訊息:

checking sasl/sasl.h usability... no
checking sasl/sasl.h presence... no
checking for sasl/sasl.h... no
checking for sasl_client_init in -lsasl2... no
checking for sasl_client_init in -lsasl... no
configure: error: Missing required Cyrus SASL development package

請安裝底下套件:

libsasl2-dev

即可


錯誤訊息:

checking for SMARTCARD... no
configure: error: Package requirements (libcacard >= 0.1.2) were not met:

No package 'libcacard' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables SMARTCARD_CFLAGS
and SMARTCARD_LIBS to avoid the need to call pkg-config.

請依先前步驟安裝 libcacard 0.1.2 即可。

qemu
tar xfva qemu-linaro-1.7.0-2014.01.tar.gz
cd qemu-linaro-1.7.0-2014.01
./configure

time make -j 4

su

# make install


 安裝完畢後可以執行底下指令來看看 qemu-linaro 版是否能正確執行:

qemu-system-arm -version




如果出現底下錯誤訊息的話,表示動態連結函式庫沒設定好:

qemu-system-arm: error while loading shared libraries: libspice-server.so.1: cannot open shared object file: No such file or directory



請以 root 權限執行:

# ldconfig


再回到一般使用者權限即可執行:

$ qemu-system-arm -version
QEMU emulator version 1.7.0 (qemu-linaro 2014.01), Copyright (c) 2003-2008 Fabrice Bellard

沒有留言:

張貼留言