Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1378739
  • 博文数量: 370
  • 博客积分: 10654
  • 博客等级: 中将
  • 技术积分: 4396
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-07 15:44
文章分类

全部博文(370)

文章存档

2012年(36)

2011年(195)

2010年(139)

分类: 服务器与存储

2011-04-08 22:20:25

xen虚拟机和dom0内核编译

 

以下是硬件信息:(更详细的见最后附录一)

CPU

################## CPU ###################

Architecture:          i686

CPU op-mode(s):        32-bit, 64-bit

CPU(s):                2

Thread(s) per core:    1

Core(s) per socket:    2

CPU socket(s):         1

Vendor ID:             GenuineIntel

CPU family:            6

Model:                 23

Stepping:              10

CPU MHz:               1800.000

L1d cache:             32K

L1i cache:             32K

L2 cache:              1024K

################# CPU ####################

Memory

################ Memory ###################

MemTotal:        2050572 kB

 

             total       used       free     shared    buffers     cached

Mem:       2050572     554700    1495872          0      59564     276796

-/+ buffers/cache:     218340    1832232

Swap:      5425148          0    5425148

################# Memory ##################

VT

################ VT #####################

 X_X This machine doesn't support VT  X__X 

################# VT #####################

Hard Disk

################# Hard Disk ###############

Model: ATA ST3250318AS (scsi)

Disk /dev/sda: 250GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

 

Number  Start   End     Size    Type      File system     Flags

 1      32.3kB  32.2GB  32.2GB  primary   ntfs            boot

 2      32.2GB  250GB   218GB   extended                  lba

 5      32.2GB  85.9GB  53.7GB  logical   ntfs

 6      85.9GB  140GB   53.7GB  logical   ntfs

 7      140GB   167GB   26.9GB  logical   ntfs

 8      167GB   193GB   26.8GB  logical   ntfs

 9      193GB   245GB   51.2GB  logical   ext4

10      245GB   250GB   5555MB  logical   linux-swap(v1)

################# Hard Disk ###############

PCI Device

################# PCI Device ###############

00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 10)

00:02.0 VGA compatible controller: Intel Corporation 82G33/G31 Express Integrated Graphics Controller (rev 10)

00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition Audio Controller (rev 01)

00:1c.0 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 1 (rev 01)

00:1c.1 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 2 (rev 01)

00:1d.0 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #1 (rev 01)

00:1d.1 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #2 (rev 01)

00:1d.2 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #3 (rev 01)

00:1d.3 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #4 (rev 01)

00:1d.7 USB Controller: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller (rev 01)

00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)

00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)

00:1f.2 IDE interface: Intel Corporation N10/ICH7 Family SATA IDE Controller (rev 01)

00:1f.3 SMBus: Intel Corporation N10/ICH 7 Family SMBus Controller (rev 01)

02:00.0 Ethernet controller: Atheros Communications AR8132 Fast Ethernet (rev c0)

################# PCI Device ###############

Ethernet Card

################ Ethernet Card #############

eth0      Link encap:Ethernet  HWaddr 00:24:1d:9d:76:b1 

          inet addr:192.168.111.102  Bcast:192.168.111.255  Mask:255.255.255.0

          inet6 addr: fe80::224:1dff:fe9d:76b1/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:37 errors:0 dropped:0 overruns:0 frame:0

          TX packets:73 errors:0 dropped:0 overruns:0 carrier:1

          collisions:0 txqueuelen:1000

          RX bytes:5560 (5.5 KB)  TX bytes:10012 (10.0 KB)

          Interrupt:43

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 

 

eth0      Link encap:Ethernet  HWaddr 00:24:1d:9d:76:b1 

lo        Link encap:Local Loopback 

################# Ethernet Card #############

CPU详细信息

################# Detail of CPU ############

processor      : 0

vendor_id       : GenuineIntel

cpu family      : 6

model            : 23

model name   : Pentium(R) Dual-Core  CPU      E2210  @ 2.20GHz

stepping : 10

cpu MHz        : 1800.000

cache size      : 1024 KB

physical id      : 0

siblings   : 2

core id           : 0

cpu cores       : 2

apicid            : 0

initial apicid    : 0

fdiv_bug  : no

hlt_bug          : no

f00f_bug  : no

coma_bug      : no

fpu         : yes

fpu_exception : yes

cpuid level      : 13

wp          : yes

flags              : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm

bogomips      : 4400.16

clflush size      : 64

cache_alignment    : 64

address sizes : 36 bits physical, 48 bits virtual

power management:

################# Detail of CPU ############

 

软件信息:

 

OS: Centos-5.4 64 DVD.iso { [CentOS.5.4.].CentOS-5.4-x86_64-bin-DVD.iso }

Xen版本xen-4.0.1.tar.gz 

下载地址:  (xen-4.0.1.tar.gz)

 

编译内核版本2.6.34.8

Xen-patch下载地址:

 

 

 

第一周任务具体步骤如下:

 

1.     首先安装系统,在安装过程中设置root密码cloudisgood 新建cloud用户,密码cloudisgood

网络方式选择DHCP,自动获取到222.24.10.0/24网段的IP地址

硬盘分区情况如下:

250GB硬盘

        200MB -à /boot

        248GB à /  (为了简单先可以这样,等一切OK,就可以专门留出一个200GB分区存放虚拟机)

        2GB à swap

安装过程中需要自定义安装哪些软件包..有些是必须的,有些则可以去掉,以节省硬盘空间;

以下软件包选择原则:

               桌面环境选择->gnome 桌面环境

               应用程序选择-> 图形,图形化互联网,编辑器

               开发 -> 开发库,开发工具,Ruby

               服务器-> 网络服务器

               基本系统-> X窗口系统,基本,管理工具,系统工具

               虚拟化->不选

               集群-> 集群

               集群存储->集群存储

               语言->中文支持

2.     安装完系统以后就可以先使用系统自带的内核2.6.18-(164|195|***)进入系统,把准备好的xen-4.0.1.tar.gzlinux-2.6.34.8.tar.bz2的内核源码包,还有xen-patch-2.6.34.tar.gz的内核xen补丁包也一起放在/usr/src/目录下

3.     下面就使用命令来说明

tar xvf linux-2.6.34.8.tar.bz2

tar xvf xen-4.0.1.tar.gz

mkdir patch

tar xvf xen-patch-2.6.34.tar.gz –C ./patch

ln –s linux-2.6.34.8 linux

cd linux

make clean

make mrproper

接下来用一个小脚本将xen内核补丁打上,如下:

              for i in `ls ../patch/*

do

patch –p1 < ../patch/$i

                            done

              然后可以使用find . –name *.rej看看有没有被reject没打上的补丁,有时候会有。

现在需要一个.config文件,直接使用我已经配置好的拷贝过来,放在此目录下/usr/src/linux/.config

然后还需要make menuconfig看看内核配置选项的一些情况,有可能需要再调整一些,在这里配置这个内核选项是详单花费时间和精力的,大部分默认即可,有些很清楚的可以自己调整。

make menuconfig如下图:

配置xen相关信息:

配置完以后可以看看相关的XEN的配置信息,如下图:

 

配置基本可以OK了,但是需要修改一点点代码才能一直顺畅的编完整个过程,修改代码如下:

a)      ./arch/x86/kernel/cpu/cpu.h 36行需要改成如下

b)      vim arch/x86/kernel/cpu/common-xen.c 将其中576-615行对get_cpu_cap函数的实现放在  vim arch/x86/kernel/cpu/intel.c 的前面,如下效果:

其实也就是说,必须在intel.c代码中队get_cpu_cap函数的具体实现进行定义,否则会出现错误终端编译过程;

 

 

到了这一步基本就可以开始make了,但是为了加快速度,可以让他多线程的跑着;

make –j4  四线程

make –j2  双线程

在编译过程中最好的就是什么问题都不要出现,内核编完就可以

make –j4 (-j2) modules编译模块了

两部都没有问题就可以make modules_install安装模块,再接着make install安装内核了(这一步必须得先安装模块,在暗转内核,我碰到了这个问题)

4.     编完了内核就可以开始编译xen了,当然也可以先编译xen,在编译内核,都是可以的,我们选择了先编译xen。在编译xen的过程中会遇到一些包依赖的问题,有些可以yum安装,有些需要源码安装,有些也可以rpm包安装。

所以最好在编译xen之前就先解决这些依赖关系:

以下是xen源码包里面README.txt里面提出的requirements,除此之外还有一些需求,可以在以后继续补充。

编译xen的命令如下:

       make xen

       make tools

       make stubdom (在编译这个的过程中会需要联互联网,所以必须在这之前保证网络通畅)

       安装时需要注意make install-tools 后面的参数

       make install- xen

       make install-tools PYTHON_PREFIX_ARG=

       make install- stubdom

如果没有问题,那么就算把xen安装完了。

5.     现在把xen和内核都安装好了,再修改一下grub.conf配置文件,添加如下信息即可:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

参考文档列表:

 

 

 

 

 

 

 

附录一

 

################ Detail of The Machine ######

ubuntu

    description: Desktop Computer

    product: G31M-ES2C

    vendor: Gigabyte Technology Co., Ltd.

    width: 32 bits

    capabilities: smbios-2.4 dmi-2.4 smp-1.4 smp

    configuration: boot=normal chassis=desktop cpus=2 uuid=00000000-0000-0000-0000-00241D9D76B1

  *-core

       description: Motherboard

       product: G31M-ES2C

       vendor: Gigabyte Technology Co., Ltd.

       physical id: 0

     *-firmware

          description: BIOS

          vendor: Award Software International, Inc.

          physical id: 0

          version: FB (05/14/2009)

          size: 128KiB

          capacity: 448KiB

          capabilities: pci pnp apm upgrade shadowing cdboot bootselect edd int13floppy360 int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer int10video acpi usb ls120boot zipboot biosbootspecification

     *-cpu:0

          description: CPU

          product: Pentium(R) Dual-Core  CPU      E2210  @ 2.20GHz

          vendor: Intel Corp.

          physical id: 4

          bus info: cpu@0

          version: 6.7.10

          serial: 0001-067A-0000-0000-0000-0000

          slot: Socket 775

          size: 1800MHz

          capacity: 4GHz

          width: 64 bits

          clock: 200MHz

          capabilities: boot fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx x86-64 constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm cpufreq

          configuration: id=1

        *-cache:0

             description: L1 cache

             physical id: 8

             slot: Internal Cache

             size: 64KiB

             capacity: 64KiB

             capabilities: synchronous internal write-back

        *-cache:1

             description: L2 cache

             physical id: 9

             slot: External Cache

             size: 1MiB

             capacity: 2MiB

             capabilities: synchronous internal write-back

        *-logicalcpu:0

             description: Logical CPU

             physical id: 1.1

             width: 64 bits

             capabilities: logical

        *-logicalcpu:1

             description: Logical CPU

             physical id: 1.2

             width: 64 bits

             capabilities: logical

     *-memory

          description: System Memory

          physical id: 19

          slot: System board or motherboard

          size: 2GiB

          capacity: 2GiB

        *-bank:0

             description: DIMM 800 MHz (1.2 ns)

             physical id: 0

             slot: A0

             size: 2GiB

             width: 64 bits

             clock: 800MHz (1.2ns)

        *-bank:1

             description: DIMM [empty]

             physical id: 1

             slot: A1

     *-cpu:1

          physical id: 1

          bus info: cpu@1

          version: 6.7.10

          serial: 0001-067A-0000-0000-0000-0000

          size: 1800MHz

          capacity: 1800MHz

          capabilities: ht cpufreq

          configuration: id=1

        *-logicalcpu:0

             description: Logical CPU

             physical id: 1.1

             capabilities: logical

        *-logicalcpu:1

             description: Logical CPU

             physical id: 1.2

             capabilities: logical

     *-pci

          description: Host bridge

          product: 82G33/G31/P35/P31 Express DRAM Controller

          vendor: Intel Corporation

          physical id: 100

          bus info: pci@0000:00:00.0

          version: 10

          width: 32 bits

          clock: 33MHz

          configuration: driver=agpgart-intel

          resources: irq:0

        *-display

             description: VGA compatible controller

             product: 82G33/G31 Express Integrated Graphics Controller

             vendor: Intel Corporation

             physical id: 2

             bus info: pci@0000:00:02.0

             version: 10

             width: 32 bits

             clock: 33MHz

             capabilities: msi pm vga_controller bus_master cap_list rom

             configuration: driver=i915 latency=0

             resources: irq:42 memory:f0200000-f027ffff ioport:e000(size=8) memory:e0000000-efffffff memory:f0000000-f00fffff

        *-multimedia

             description: Audio device

             product: N10/ICH 7 Family High Definition Audio Controller

             vendor: Intel Corporation

             physical id: 1b

             bus info: pci@0000:00:1b.0

             version: 01

             width: 64 bits

             clock: 33MHz

             capabilities: pm msi pciexpress bus_master cap_list

             configuration: driver=HDA Intel latency=0

             resources: irq:44 memory:f0280000-f0283fff

        *-pci:0

             description: PCI bridge

             product: N10/ICH 7 Family PCI Express Port 1

             vendor: Intel Corporation

             physical id: 1c

             bus info: pci@0000:00:1c.0

             version: 01

             width: 32 bits

             clock: 33MHz

             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list

             configuration: driver=pcieport

             resources: irq:40 ioport:c000(size=4096) memory:7f600000-7f7fffff ioport:7f800000(size=2097152)

        *-pci:1

             description: PCI bridge

             product: N10/ICH 7 Family PCI Express Port 2

             vendor: Intel Corporation

             physical id: 1c.1

             bus info: pci@0000:00:1c.1

             version: 01

             width: 32 bits

             clock: 33MHz

             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list

             configuration: driver=pcieport

             resources: irq:41 ioport:d000(size=4096) memory:f0100000-f01fffff ioport:7fa00000(size=2097152)

           *-network

                description: Ethernet interface

                product: AR8132 Fast Ethernet

                vendor: Atheros Communications

                physical id: 0

                bus info: pci@0000:02:00.0

                logical name: eth0

                version: c0

                serial: 00:24:1d:9d:76:b1

                size: 100MB/s

                capacity: 100MB/s

                width: 64 bits

                clock: 33MHz

                capabilities: pm msi pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd autonegotiation

                configuration: autonegotiation=on broadcast=yes driver=atl1c driverversion=1.0.0.2-NAPI duplex=full firmware=N/A ip=192.168.111.102 latency=0 link=yes multicast=yes port=twisted pair speed=100MB/s

                resources: irq:43 memory:f0100000-f013ffff ioport:d000(size=128)

        *-usb:0

             description: USB Controller

             product: N10/ICH 7 Family USB UHCI Controller #1

             vendor: Intel Corporation

             physical id: 1d

             bus info: pci@0000:00:1d.0

             version: 01

             width: 32 bits

             clock: 33MHz

             capabilities: uhci bus_master

             configuration: driver=uhci_hcd latency=0

             resources: irq:23 ioport:e100(size=32)

        *-usb:1

             description: USB Controller

             product: N10/ICH 7 Family USB UHCI Controller #2

             vendor: Intel Corporation

             physical id: 1d.1

             bus info: pci@0000:00:1d.1

             version: 01

             width: 32 bits

             clock: 33MHz

             capabilities: uhci bus_master

             configuration: driver=uhci_hcd latency=0

             resources: irq:19 ioport:e200(size=32)

        *-usb:2

             description: USB Controller

             product: N10/ICH 7 Family USB UHCI Controller #3

             vendor: Intel Corporation

             physical id: 1d.2

             bus info: pci@0000:00:1d.2

             version: 01

             width: 32 bits

             clock: 33MHz

             capabilities: uhci bus_master

             configuration: driver=uhci_hcd latency=0

             resources: irq:18 ioport:e300(size=32)

        *-usb:3

             description: USB Controller

             product: N10/ICH 7 Family USB UHCI Controller #4

             vendor: Intel Corporation

             physical id: 1d.3

             bus info: pci@0000:00:1d.3

             version: 01

             width: 32 bits

             clock: 33MHz

             capabilities: uhci bus_master

             configuration: driver=uhci_hcd latency=0

             resources: irq:16 ioport:e400(size=32)

        *-usb:4

             description: USB Controller

             product: N10/ICH 7 Family USB2 EHCI Controller

             vendor: Intel Corporation

             physical id: 1d.7

             bus info: pci@0000:00:1d.7

             version: 01

             width: 32 bits

             clock: 33MHz

             capabilities: pm ehci bus_master cap_list

             configuration: driver=ehci_hcd latency=0

             resources: irq:23 memory:f0284000-f02843ff

        *-pci:2

             description: PCI bridge

             product: 82801 PCI Bridge

             vendor: Intel Corporation

             physical id: 1e

             bus info: pci@0000:00:1e.0

             version: e1

             width: 32 bits

             clock: 33MHz

             capabilities: pci subtractive_decode bus_master cap_list

             resources: ioport:b000(size=4096)

        *-isa

             description: ISA bridge

             product: 82801GB/GR (ICH7 Family) LPC Interface Bridge

             vendor: Intel Corporation

             physical id: 1f

             bus info: pci@0000:00:1f.0

             version: 01

             width: 32 bits

             clock: 33MHz

             capabilities: isa bus_master cap_list

             configuration: latency=0

        *-ide

             description: IDE interface

             product: N10/ICH7 Family SATA IDE Controller

             vendor: Intel Corporation

             physical id: 1f.2

             bus info: pci@0000:00:1f.2

             logical name: scsi1

             version: 01

             width: 32 bits

             clock: 66MHz

             capabilities: ide pm bus_master cap_list emulated

             configuration: driver=ata_piix latency=0

             resources: irq:19 ioport:1f0(size=8) ioport:3f6 ioport:170(size=8) ioport:376 ioport:f000(size=16)

           *-disk

                description: ATA Disk

                product: ST3250318AS

                vendor: Seagate

                physical id: 0.0.0

                bus info: scsi@1:0.0.0

                logical name: /dev/sda

                version: CC35

                serial: 9VM2XSC5

                size: 232GiB (250GB)

                capabilities: partitioned partitioned:dos

                configuration: ansiversion=5 signature=00000001

              *-volume:0

                   description: Windows NTFS volume

                   physical id: 1

                   bus info: scsi@1:0.0.0,1

                   logical name: /dev/sda1

                   version: 3.1

                   serial: d6d9bd05-5ad3-8643-859b-b31e276a89c1

                   size: 30GiB

                   capacity: 30GiB

                   capabilities: primary bootable ntfs initialized

                   configuration: clustersize=4096 created=2010-09-04 00:06:57 filesystem=ntfs state=clean

              *-volume:1

                   description: Extended partition

                   physical id: 2

                   bus info: scsi@1:0.0.0,2

                   logical name: /dev/sda2

                   size: 202GiB

                   capacity: 202GiB

                   capabilities: primary extended partitioned partitioned:extended

                 *-logicalvolume:0

                      description: HPFS/NTFS partition

                      physical id: 5

                      logical name: /dev/sda5

                      capacity: 50GiB

                 *-logicalvolume:1

                      description: HPFS/NTFS partition

                      physical id: 6

                      logical name: /dev/sda6

                      capacity: 50GiB

                 *-logicalvolume:2

                      description: HPFS/NTFS partition

                      physical id: 7

                      logical name: /dev/sda7

                      capacity: 25GiB

                 *-logicalvolume:3

                      description: HPFS/NTFS partition

                      physical id: 8

                      logical name: /dev/sda8

                      capacity: 24GiB

                 *-logicalvolume:4

                      description: Linux filesystem partition

                      physical id: 9

                      logical name: /dev/sda9

                      capacity: 47GiB

                 *-logicalvolume:5

                      description: Linux swap / Solaris partition

                      physical id: a

                      logical name: /dev/sda10

                      capacity: 5298MiB

                      capabilities: nofs

        *-serial UNCLAIMED

             description: SMBus

             product: N10/ICH 7 Family SMBus Controller

             vendor: Intel Corporation

             physical id: 1f.3

             bus info: pci@0000:00:1f.3

             version: 01

             width: 32 bits

             clock: 33MHz

             configuration: latency=0

             resources: ioport:500(size=32)

     *-scsi

          physical id: 2

          bus info: usb@1:2

          logical name: scsi2

          capabilities: emulated scsi-host

          configuration: driver=usb-storage

        *-disk

             description: SCSI Disk

             physical id: 0.0.0

             bus info: scsi@2:0.0.0

             logical name: /dev/sdb

             size: 4013MiB (4208MB)

             capabilities: partitioned partitioned:dos

             configuration: signature=0006fac8

           *-volume

                description: Windows FAT volume

                vendor: mkdosfs

                physical id: 1

                bus info: scsi@2:0.0.0,1

                logical name: /dev/sdb1

                logical name: /cdrom

                logical name: /casper-rw-backing

                version: FAT32

                serial: fc14-9771

                size: 4010MiB

                capacity: 4010MiB

                capabilities: primary bootable fat initialized

                configuration: FATs=2 filesystem=fat mount.fstype=vfat mount.options=rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro state=mounted

################# Detail of the Machine ####

阅读(1907) | 评论(0) | 转发(0) |
0

上一篇:强力卸载 umount -f

下一篇:libvirt相关

给主人留下些什么吧!~~