2014年11月4日 星期二

一些build new kernel的東東

http://people.cs.nctu.edu.tw/~chenwj/dokuwiki/doku.php?id=ubuntu

其中在ubuntu 12.04,若有改boot options,在/boot/grub/grub.cfg

改完要update-grub

2014年11月3日 星期一

virtGL筆記

with apt-get:

freeglut3.dev
pkg-config
libpixman-1-dev
libasound2-dev
libssl-dev
libxrandr-dev
libxfixes-dev 
libxrender-dev 
x11proto-core-dev
libjpeg62-dev  
libsasl2-dev 
libglib2.0-dev
libgl1-mesa-dev
libnss3-dev
g++

apt-get install build-essential
apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
apt-get install vncviewer


wget https://launchpad.net/~dev-zero/+archive/ubuntu/spice/+files/libcelt051_0.5.1.3-2_amd64.deb
wget https://launchpad.net/~dev-zero/+archive/ubuntu/spice/+files/libcelt051-dev_0.5.1.3-2_amd64.deb
wget http://www.spice-space.org/download/libcacard/libcacard-0.1.2.tar.gz
wget https://launchpad.net/ubuntu/+archive/primary/+files/python-pyparsing_2.0.3%2Bdfsg1-1_all.deb


dpkg -i libcelt051_0.5.1.3-2_amd64.deb
dpkg -i libcelt051-dev_0.5.1.3-2_amd64.deb
dpkg -i python-pyparsing_2.0.3+dfsg1-1_all.deb 


tar zxvf libcacard-0.1.2.tar.gz

cd libcacard-0.1.2

./configure

make

make install
======

////////////////////
at spice/git/spice

chmod 777 configure
./configure
make
make install
////////////////////

////////////////////
at spice/git/spice/spice-protocol
chmod 777 configure
./configure
make
make install
////////////////////

//////////////////
at spice/git/spice/spice-common
./configure
make
make install
//////////////////



at spice/git/qemu/

git checkout hw/{qxl,qxl-logger,qxl-render}.c

chmod 777 configure

./configure --target-list=x86_64-softmmu --enable-opengl --enable-spice --extra-ldflags="-lm -lrt -lX11" --disable-docs --disable-werror --disable-libiscsi


modify Makefile.target : LIBS+=-lm -> LIBS+=-lm -lGL -lGLU -lglut -lX11

make clean

make 

make install

============

crete vm:

qemu-img create -f qcow2 ex.qcow2 10G

edit: /etc/bash.bashrc
export LD_LIBRARY_PATH=/usr/local/lib

wget http://old-releases.ubuntu.com/releases/11.10/ubuntu-11.10-alternate-amd64.iso


=================
執行了:

qemu-system-x86_64 -drive file=ex.qcow2,if=ide -soundhw ac97 -cdrom ubuntu-11.10-alternate-amd64.iso -boot d -vga qxl -spice port=5901,disable-ticketing -enable-kvm -m 1024 -device virtio-opengl-pci -chardev spicevmc,id=vdagent,name=vdagent 

connect:
spicec -h 127.0.0.1 -p 5901

spice連太慢的話改這個:

qemu-system-x86_64 -drive file=ex.qcow2,if=ide -soundhw ac97 -cdrom ubuntu-11.10-alternate-amd64.iso -boot d -vga qxl -vnc :5,disable-ticketing -enable-kvm -m 1024 -device virtio-opengl-pci -chardev spicevmc,id=vdagent,name=vdagent 

connect:

vncviewer :5905




=====================
開guest:
/home/sslab719/virtgl/spice/git/qemu/x86_64-softmmu/qemu-system-x86_64 -drive file=ex.qcow2,if=ide -soundhw ac97 -boot d -vga qxl -spice port=5901,disable-ticketing -enable-kvm -m 1024 -device virtio-opengl-pci -chardev spicevmc,id=vdagent,name=vdagent -net user,hostfwd=tcp::10022-:22 -net nic


replace /etc/apt/sources.list:

deb http://old-releases.ubuntu.com/ubuntu/ oneiric main
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric main
deb http://old-releases.ubuntu.com/ubuntu/ oneiric-updates main
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric-updates main
deb http://old-releases.ubuntu.com/ubuntu/ oneiric universe
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric universe
deb http://old-releases.ubuntu.com/ubuntu/ oneiric-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/ 
————————————
sudo apt-get update
sudo apt-get upgrade
————————————

Guest:
kernel 3.0.0.12 (ex. ubuntu 11.10)

package:
officail spice protocol :http://www.spice-space.org/download.html
apt-get 
xserver-xorg-video-qxl
freeglut3.dev
xorg-dev

/virtgl/guest/virtio/virtio-gl.c 
add #define VIRTIO_ID_OPENGL 10

/virtgl/guest/virtio/ 
make
make install
use dmesg check virtio-gl module major id 
modify makefile to fit the nod id into virtio-gl's major id
make nod
virtgl/guest/gl
make 


make run                  #test glxgears

2014年10月30日 星期四

qemu 只要x86

./configure --target-list=x86_64-softmmu

ubuntu 12.04 安裝cuda 6.5


sh cuda_6.5.14_linux_64.run

vim /etc/bash.bashrc

export CUDA_HOME=/usr/local/cuda-6.5
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64

PATH=${CUDA_HOME}/bin:${PATH}
export PATH

2014年10月21日 星期二

CentOS 出現Device eth0 does not seem to be present

在clone VM後有時候vm裡出現這樣的東東:
Device eth0 does not seem to be present


解法:

http://wolfword.blog.51cto.com/4892126/1304000

2014年9月28日 星期日

XenServer 安裝vim

yum repolist enabled


 yum --enablerepo=base --disablerepo=citrix install vim-enhanced

2014年9月4日 星期四

CentOS ssh 連不到

剛灌好ssh 連不到

有些版本要改sshd_config

reference here:

[root@host ~]$ vim /etc/ssh/sshd_config
Protocol 2
ServerKeyBits 1024
PermitRootLogin no  /* 禁止root登錄 */

/* 以下三行沒什麼要改的,把默認的#註釋去掉就行了 */
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

PasswordAuthentication no /* KEY與密碼一定要選一個 */
PermitEmptyPasswords no /* 禁止使用空密碼登入 */

2014年8月12日 星期二

dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib Referenced from: /usr/local/lib/libcairo.2.dylib Reason: image not found

MAC OS  裡遇到
dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
  Referenced from: /usr/local/lib/libcairo.2.dylib


  Reason: image not found


my sol)

brew upgrade

2014年8月6日 星期三

linux RAR 安裝壓縮加密

http://dicatatdl.com/2013/06/how-to-install-rarunrar-on-centos-5.html

http://argansos.blogspot.tw/2012/05/linux.html

MAC OS 出現fatal error: 'gtk/gtk.h' file not found


參考link:


1.a) Installation of GTK+ 2.x:
brew install gtk+
1.b) Installation of GTK+ 3.x:
You can install gtk+ 3.x via home brew too if you need that, but the 2.x version is enough for my purposes. The command would be:
brew install gtk+3
2.) But after the installation I had the problem, that cairo could not be found. So i solved it this way:
export PKG_CONFIG_PATH=/usr/local/Cellar/cairo/1.12.16/lib/pkgconfig/
3.) Then the compiler said it could not find the package 'xcb-shm', required by 'cairo'. This can be solved this way:
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig
After this command the compiler worked as expected.


make 有問題的話再加:

 export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

2014年7月16日 星期三

2014年7月14日 星期一

perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_GB:en", LC_ALL = (unset), LANG = "en_GB" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = "en_GB:en",
 LC_ALL = (unset),
 LANG = "en_GB"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").


solve:

LC_ALL="en_GB.utf8"

修改/etc/environment and rebooting


2014年6月25日 星期三

centos install phpMyAdmin

快速:

http://www.krizna.com/centos/how-install-phpmyadmin-centos-6/

Configure phpMyAdmin:
http://tecadmin.net/how-to-install-phpmyadmin-on-centos-using-yum/#

2014年6月8日 星期日

virtio 舊版轉新版

ex:

virtqueue_add_buf(vq, sg, 3, 1, vml)
==>

(vq->vq_ops->add_buf(vq, sg, 3, 0, vml)


    vml = vq->vq_ops->get_buf(vq, &len);

==>    
vml = virtqueue_get_buf(vq, &len);


    vq->vq_ops->kick(vq);
==>
    virtqueue_kick(vq);

2014年5月12日 星期一

Build new linux kernel

build linux kernel

yum install kernel-devel
yum install make
yum install gcc
yum install ncurses-devel

make menuconfig

 make bzImage

make modules

 make modules_install

make install


vim /etc/grub.conf 

新的kernel 在gurb裡變成了第一個,因此將default 設成0

default=0

reboot


uname -a 就會看build kernel之前的不同

2014年5月10日 星期六

qemu+kvm create VM

qemu-img create -f qcow2 image0 20G

qemu-system-x86_64 --enable-kvm image0 -m 2048 -smp 2 -netdev tap,id=mynet0 -device virtio-net-pci,netdev=mynet0 -cdrom /home/qemutest/CentOS-6.4-x86_64-minimal.iso -boot d


vncviewer :5900


qemu-system-x86_64 --enable-kvm image0 -m 2048 -smp 2 -netdev tap,id=mynet0 -device virtio-net-pci,netdev=mynet0

make kernel 出現問題: /root/linux-2.6.32.61/usr/include/asm/ptrace.h:5: included file 'linux/linkage.h' is not exported make[2]: *** [/root/linux-2.6.32.61/usr/include/asm/.check] Error 123 make[1]: *** [headers_check] Error 2 make: *** [vmlinux] Error 2

解決方法: vim ./arch/x86/include/asm/ptrace.h 改

//#include <linux/linkage.h>    /* For asmregparm */


//extern asmregparm long syscall_trace_enter(struct pt_regs *);
//extern asmregparm void syscall_trace_leave(struct pt_regs *);
extern long syscall_trace_enter(struct pt_regs *);
extern void syscall_trace_leave(struct pt_regs *);

2014年5月9日 星期五

修改QEMU virtio記錄

修改版本為1.7.1

目前在

hw/virtio


新增 virtio-mydevice.h, virtio-mydevice.c


include/hw/virtio/virtio-mydevice.h
新增


typedef struct VirtIOmydevice {
    VirtIODevice parent_obj;
    //VirtQueue *ivq, *dvq, *svq;
    VirtQueue *vq[2];  //new
    uint32_t num_pages;
    uint32_t actual;
    uint64_t stats[VIRTIO_MYDEVICE_S_NR];
    VirtQueueElement stats_vq_elem;
    size_t stats_vq_offset;
    QEMUTimer *stats_timer;
    int64_t stats_last_update;
    int64_t stats_poll_interval;
    int status; //new

} VirtIOmydevice;

hw/virtio/virtio-mydevice.c 的 virtio_mydevice_device_init() 裡面去add virtio queue:
s->vq[0] = virtio_add_queue(vdev, 1024, virtio_mydevice_handle_output); 
s->vq[1] = virtio_add_queue(vdev, 1024, virtio_mydevice_handle_output); 
然後在virtio_mydevice_handle_output裡面去virtqueue_pop, virtqueue_push

CUDA程式執行流程(CUDA Programming Flow)

在上一篇簡單介紹了CUDA是什麼之後,我們來講講CUDA基本的programming flow,

圖一:CUDA Programming Flow
如圖一流程:

1. 先在CPU端準備好data
2. 把data從GPU端傳送到GPU端
3. 呼叫GPU function運算
4. GPU執行程式
5. 把data從GPU傳送到CPU


簡單的來說就是我GPU需要你CPU先給我資料,GPU運算完後再把資料丟給你CPU,圖二我們搭配其CUDA 常用的API來對這流程作說明:

圖二:CUDA Programming Flow - API

一、配置Device Memory
  • Device為GPU端
  • 使用cudaMalloc API


二、將Host端資料Copy至Device端的Memory
  • Host端CPU端
  • 使用cudaMemcpy API
  • 參數設定:cudaMemcpyHostToDevice


三、執行Kernel
  • 可執行多個Kernel
  • Kernel所指為GPU所處理的函式

四、將Device端運算完之資料Copy回Host端
  • 使用cudaMemcpy API
  • 參數設定:cudaMemcpyDeviceToHost

五、釋放所分配之記憶體
  • 使用cudaFree API

以上是CUDA程式運算流程以及常用的API,下一篇我們再來仔細討論如何使用這些API,並撰寫簡單的code


什麼是CUDA?

CUDA簡寫為(Compute Unified Device Architecture,統一計算架構),以下為wiki上的解釋:

由NVIDIA所推出的一種整合技術,是該公司對於GPGPU的正式名稱。透過這個技術,使用者可利用NVIDIA的GeForce 8以後的GPU和較新的Quadro GPU進行計算。亦是首次可以利用GPU作為C-編譯器的開發環境。NVIDIA行銷的時候,往往將編譯器與架構混合推廣,造成混亂。實際上,CUDA可以相容OpenCL或者自家的C-編譯器。無論是CUDA C-語言或是OpenCL,指令最終都會被驅動程式轉換成PTX代碼,交由顯示核心計算。
簡單來講,我習慣把CUDA就看成與OpenCL一樣的地位,基本上CUDA就是個C/C++的extend語法,使用者可以使用一些run time API去直接對GPU做操作,真正底層由nvcc compiler 把CUDA code轉成PTX code, 再由GPU driver將PTX 轉成binary code到GPU 硬體運算單元去執行,因此上面這段wiki最後面有點小錯誤,應該是compiler 轉成PTX code再讓driver去handle底層binary code,因為PTX code只是個pseudo-assembly language噢~

圖一: CUDA Software Stack




C qsort() using struct

#include <stdio.h>
#include <stdlib.h>

struct mytype
{
    struct mytype *next;
    int key;
};

struct mytype *mysort;


int cmpfunc (const void * a, const void * b)
{
    struct mytype* aa = (struct mytype*)a; 
    struct mytype* bb = (struct mytype*)b; 
   
    return (aa->key - bb->key);
}

int main()
{
    mysort = (struct mytype*)malloc(sizeof(struct mytype*)*10);
    int i;
    for( i = 0; i < 10; i++)
    {   
        mysort[i].key = 10-i;
    }   
   printf("before sorting\n");

    for( i = 0; i < 10; i++)
        printf("%d ", mysort[i].key);
    printf("\n");

    qsort(mysort, 10, sizeof(struct mytype), cmpfunc);

    printf("after sorting\n");
    for( i = 0; i < 10; i++)
        printf("%d ", mysort[i].key);
    printf("\n");


    return 0;
}

2014年5月8日 星期四

在GPU kernel function裡exit()

在CPU寫code我們可以用exit(1); 跳出 如果在GPU kernel function裡可以用asm("trap;");

blog如何嵌入程式碼

在HTML前面加這個:

<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>

把程式碼貼到: http://formatmysourcecode.blogspot.tw/ 格式轉完後貼到HTML裡 然後要加的tag這裡有寫: http://google-code-prettify.googlecode.com/svn/trunk/README.html

如何掛載Linux Module

hello module example
#include <linux/module.h> 
#include <linux/init.h> 
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void) 
{ 
    printk(KERN_ALERT "Hello, world/n"); 
    return 0;  
} 
static void hello_exit(void) 
{ 
    printk(KERN_ALERT "Goodbye, cruel world/n"); 
} 
module_init(hello_init); 
module_exit(hello_exit);


Makefile:
KVER = /lib/modules/`uname -r`/build
CURDIR = $(shell pwd)
# Kernel modules
obj-m := hello.o
build: kernel_modules
kernel_modules:
    $(MAKE) -C $(KVER) M=$(CURDIR) modules
clean:

    $(MAKE) -C $(KVER) M=$(CURDIR) clean




掛載:

# insmod hello.ko

查看是否有掛起來:
# lsmod |grep hello

卸載
# rmmod hello.ko






yum update出現 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

[root@guest0 ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: base
解決方法

vi /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 127.0.0.1

重啟網路就ok

QEMU網路問題解決

解決之前網路guest連不到host問題,

可設定開機啟動以下指令:
ip addr add 10.222.112.1 dev br0

ip route add 10.222.112.0/24 dev br0

修改iptables:

iptables -t nat -A POSTROUTING -o br0 -s 10.222.112.0/24 -j MASQUERADE

iptables -I INPUT -i br0 -p icmp -s 10.222.112.0/255.255.255.0 -j ACCEPT

修改:

/etc/qemu-ifup

#!/bin/sh
bridge=br0ifconfig $1 0.0.0.0 promisc up
brctl addif $bridge $1

/etc/qemu-ifdown

#!/bin/sh
bridge=br0
brctl delif $bridge $1 || true
ifconfig $1 down

指令:
qemu-system-x86_64 --enable-kvm image_file -m 2048 -smp 2 -netdev tap,id=mynet0 -device virtio-net-pci,netdev=mynet0

在guest內:



 vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
HWADDR=52:54:00:12:34:56
IPADDR=10.222.112.2
GATEWAY=10.222.112.1
NETMASK=255.255.255.0
TYPE=Ethernet
UUID=3f979381-18b8-4a3e-8221-2f8379c8b79a
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none



2014年4月28日 星期一

Linux kernel編譯問題

kernel make 時出現這鬼錯:


/home/qemutest/linux-2.6.32.61/usr/include/asm/ptrace.h:5: included file 'linux/linkage.h' is not exported
make[2]: *** [/home/qemutest/linux-2.6.32.61/usr/include/asm/.check] Error 123
make[1]: *** [headers_check] Error 2

make: *** [vmlinux] Error 2

解決辦法:

vim arch/x86/include/asm/ptrace.h
註釋掉
#include

146行的
extern asmregparm long syscall_trace_enter(struct pt_regs *);
extern asmregparm void syscall_trace_leave(struct pt_regs *);
再新增下面兩行
extern long syscall_trace_enter(struct pt_regs *);
extern void syscall_trace_leave(struct pt_regs *);  


改好後再來make


2014年4月23日 星期三

改qemu記錄

/home/qemutest/qemu-1.7.1/include/hw/pci
#define PCI_DEVICE_ID_VIRTIO_MYDEVICE    0x1006 //cocotion modify


virtio-pci.c 有改  ==> 現在再改

./hw/virtio/virtio-pci.h 有改



/home/qemutest/qemu-1.7.1/hw/virtio/virtio-pci.c

改了這些:

mydevice_pci_stats_get_all
mydevice_pci_stats_get_poll_interval
mydevice_pci_stats_set_poll_interval
 Property virtio_mydevice_pci_properties[]
virtio_mydevice_pci_init
virtio_mydevice_pci_class_init
virtio_mydevice_pci_instance_init
TypeInfo virtio_mydevice_pci_info 

新增
/home/qemutest/qemu-1.7.1/hw/virtio/virtio-mydevice.c
此檔為balloon的copy, 之後開始來trace他
===========================================

改./include/hw/virtio/virtio-mydevice.h


typedef struct VirtIOmydevice {
    VirtIODevice parent_obj;
    VirtQueue *ivq, *dvq, *svq;
    uint32_t num_pages;
    uint32_t actual;
    uint64_t stats[VIRTIO_MYDEVICE_S_NR];
    VirtQueueElement stats_vq_elem;
    size_t stats_vq_offset;
    QEMUTimer *stats_timer;
    int64_t stats_last_update;
    int64_t stats_poll_interval;

} VirtIOmydevice;


原本的VirtIODevice 放在./include/hw/virtio/virtio.h


struct VirtIODevice
{
    DeviceState parent_obj;
    const char *name;
    uint8_t status;
    uint8_t isr;
    uint16_t queue_sel;
    uint32_t guest_features;
    size_t config_len;
    void *config;
    uint16_t config_vector;
    int nvectors;
    VirtQueue *vq;
    uint16_t device_id;
    bool vm_running;
    VMChangeStateEntry *vmstate;
    char *bus_name;

};

以及operation:

typedef struct VirtioDeviceClass {
    /* This is what a VirtioDevice must implement */
    DeviceClass parent;
    int (*init)(VirtIODevice *vdev);
    void (*exit)(VirtIODevice *vdev);
    uint32_t (*get_features)(VirtIODevice *vdev, uint32_t requested_features);
    uint32_t (*bad_features)(VirtIODevice *vdev);
    void (*set_features)(VirtIODevice *vdev, uint32_t val);
    void (*get_config)(VirtIODevice *vdev, uint8_t *config);
    void (*set_config)(VirtIODevice *vdev, const uint8_t *config);
    void (*reset)(VirtIODevice *vdev);
    void (*set_status)(VirtIODevice *vdev, uint8_t val);
    /* Test and clear event pending status.
     * Should be called after unmask to avoid losing events.
     * If backend does not support masking,
     * must check in frontend instead.
     */
    bool (*guest_notifier_pending)(VirtIODevice *vdev, int n); 
    /* Mask/unmask events from this vq. Any events reported
     * while masked will become pending.
     * If backend does not support masking,
     * must mask in frontend instead.
     */
    void (*guest_notifier_mask)(VirtIODevice *vdev, int n, bool mask);

} VirtioDeviceClass;


VIRTIOQUEUE 相關:


typedef struct VirtQueueElement
{
    unsigned int index;
    unsigned int out_num;
    unsigned int in_num;
    hwaddr in_addr[VIRTQUEUE_MAX_SIZE];
    hwaddr out_addr[VIRTQUEUE_MAX_SIZE];
    struct iovec in_sg[VIRTQUEUE_MAX_SIZE];
    struct iovec out_sg[VIRTQUEUE_MAX_SIZE];

} VirtQueueElement;





之後在./hw/virtio/virtio-mydevice.c

讓自己產生的device operation指向VirtioDeviceClass 以及相關class, 像是繼承:


static void virtio_mydevice_class_init(ObjectClass *klass, void *data)
{
    DeviceClass *dc = DEVICE_CLASS(klass);
    VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
    dc->props = virtio_mydevice_properties;
    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
    vdc->init = virtio_mydevice_device_init;
    vdc->exit = virtio_mydevice_device_exit;
    vdc->get_config = virtio_mydevice_get_config;
    vdc->set_config = virtio_mydevice_set_config;
    vdc->get_features = virtio_mydevice_get_features;
}



另外在./include/hw/virtio/virtio-mydevice.h改了virtio_mydevice_config:


struct virtio_mydevice_config
{
    int config; //cocotion test
    /* Number of pages host wants Guest to give up. */
    uint32_t num_pages;
    /* Number of pages we've actually got in balloon. */
    uint32_t actual;

};











2014年4月20日 星期日

QEMU TAP 網路



TAP 網路

qemu-ifup:

#!/bin/sh  
/sbin/ifconfig $1 192.168.1.1 netmask 255.255.255.0 up  
sleep 2 

qemu-ifdown:

#!/bin/sh  
/sbin/ifconfig $1 down 
sleep 2

以上這兩個權限記得改


# qemu-system-x86_64 --enable-kvm image_file -m 2048 -smp 2  -net nic,model=virtio,macaddr=52:54:00:12:34:57 -net tap,ifname=tap0,script=/home/qemutest/qemu-1.7.1/qemu-ifup,downscript=/home/qemutest/qemu-1.7.1/qemu-ifdown

#vncviewer :5900

quest裏面:
# ifconfig eth1 192.168.1.10


之後發現host(192.168.1.1)可以連quest(102.168.1.10),但反之卻有問題,尚未解決

2014年4月14日 星期一

安裝QEMU

download: http://wiki.qemu.org/Download

Environment: CentOS 6

before install:

# yum install glib2-devel
# yum install autoconf
# yum install automake
# yum install bison
# yum install libtool
# yum install zlib-devel


install:

# ./configure

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
Trace output file trace-
spice support     no
rbd support       no
xfsctl support    no
nss used          no
libusb            no
usb net redir     no
GLX support       no
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

# make -j 8
# make install