1. 安裝環境
操作系統:ubuntu14.04
xen版本:xen4.4
2. 依賴包的安裝
在安裝xen之前先進行依賴包的安裝,在不停得嘗試之后,總結出以下需要安裝的依賴包。
sudo apt-get install gcc make binutils zlib1g-dev python-dev
sudo apt-get install libncurses5-dev libcurl4-openssl-dev libx11-dev
sudo apt-get install uuid-dev libyajl-dev libaio-dev libglib2.0-dev libpixman-1-dev
sudo apt-get install pkg-config bridge-utils iproute udev bison flex gettext
sudo apt-get install bin86 bcc iasl ocaml-nox ocaml-findlib cmake markdown figlet git libc6-dev-i386
sudo apt-get install texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra
sudo apt-get install texlive-fonts-recommended pciutils-dev mercurial
以上的依賴包主要是為了能夠成功的編譯安裝xen4.4
3. xen源文件下載
xen4.4源文件地址http://www.xenproject.org/downloads-list/xen-archives/xen-44-series/xen-440.html
源文件下載后是一個tar包,該包可以先下到windows下然后用winscp拷貝到虛擬機中,也可以直接在虛擬機中進行下載。
注意:tar包的解壓一定要在ubuntu中進行,如果是在windows中解壓之后再拷貝到ubuntu中的話,其中文件的執行級別就被修改了,會導致編譯出錯。
4. xen源文件編譯
源文件解壓到某個目錄下之后,cd到源文件所在目錄,執行步驟按照源文件中README里面描述的步驟來執行。
# ./configure
# make world
# make install
但是在執行make world執行完之后,會發現提示一個如下所示的錯誤:
tpmback.c: In function ‘tpmif_change_state’:
tpmback.c:350:4: error: format ‘%d’ expects argument of type ‘int *’, but argument 3 has type ‘enum xenbus_state *’ [-Werror=format=]
if(sscanf(value, "%d", &readst) != 1) {
在出現這個錯誤之后,源文件的編譯后面無法執行了,在查找相關的資料之后,發現一段討論:
From: Dushyant Behl <myselfdushyantbehl <at> gmail.com> Subject: Re: Compilation Error in extras/mini-os/tpmback.c Newsgroups: gmane.comp.emulators.xen.devel Date: 2014-07-18 10:01:50 GMT (2 weeks, 3 days, 2 hours and 27 minutes ago)
Sure, I'll be happy to do it.
On Fri, Jul 18, 2014 at 3:25 PM, Ian Campbell <Ian.Campbell <at> citrix.com> wrote:
> On Thu, 2014-07-17 at 20:21 +0200, Samuel Thibault wrote:
>> Ian Campbell, le Wed 16 Jul 2014 10:13:31 +0100, a écrit :
>> > On Wed, 2014-07-16 at 11:25 +0530, Dushyant Behl wrote:
>> > > I'm trying to compile xen from the source and i'm getting this
>> > > compilation error while running a make world.
>> > >
>> > > tpmback.c: In function ‘tpmif_change_state’:
>> > > tpmback.c:350:4: error: format ‘%d’ expects argument of type ‘int *’,
>> > > but argument 3 has type ‘enum xenbus_state *’ [-Werror=format=]
>> > > if(sscanf(value, "%d", &readst) != 1) {
>> > > ^
>> > > cc1: all warnings being treated as errors
>> > > make[3]: *** [/home/corvo/gsoc/code/xen/stubdom/mini-os-x86_64-vtpm/tpmback.o]
>> > > Error 1
>> > >
>> > > Could anyone explain that if this is just problem on my side or this
>> > > is not fixed in the git tree.
>> >
>> > It looks like a legitimate issue to me. I expect you are just the first
>> > person to use a compiler which picks up in this particular issue.
>> >
>> > I'm not sure what the correct fix is since C doesn't mandate very much
>> > about the storage size of an enum, so casting is probably not the right
>> > answer.
>>
>> Indeed, C99 apparently says “The choice of type is
>> implementation-defined”, so
>>
>> > Probably the value needs to be read into an actual int variable and then
>> > assigned to the enum.
>>
>> that seems like the proper solution.
>
> Great. Dushyant, are you able to rustle up a patch?
>
> http://wiki.xen.org/wiki/Submitting_Xen_Patches has some guidance on the
> procedure.
>
> Ian.
>
該討論的地址為:http://thread.gmane.org/gmane.comp.emulators.xen.devel/207530/focus=207948
討論的結果看起來應該是說這里是一個bug,需要加一個補丁。
Ian 這個人查了一下,應該是Hypervisor Project Team里面的一個成員。
5. 總結
至此,xen4.4版本的安裝block住了,ubuntu下的安裝應該是可以找到方法的,后面會繼續進行測試。