How to create a PV image for XEN

4 篇文章 0 订阅
2 篇文章 0 订阅

*********

    PV image means the guest OS should be modified in XEN. The following are the steps of how to create a PV image which support vtpm for XEN.  BTW, you should have following  prerequisites if you want to use vtpm feature.


Prerequisites:

--------------

  • You must have an x86 machine with a TPM on the motherboard.
  • Compile and install the Xen tree as usual; be sure that the vTPM domains are  enabled when you run configure.
  • Compiling the LINUX dom0 kernel without  TPM driver or  blacklisting the module

--------------    


    Then I will use the easiest type of guest OS (ubuntu 12.10) to make as an example :

   Step 1  create file system

      1.  Create an empty file to hold the PV image.

        #dd if=/dev/zero of=ubt-pv.img bs=1 count=1 seek=10G
    2.  Formatting the newly created file.
        #mkfs.ext4   ubt-pv.img
           you may format the file to be other file system types.

       3.   Mount the file as a loop device
        #mount –o loop ubt-pv.img      /mnt/

     4.  We can use debootstrap command to generate system files.

      debootstrap wheezy  /mnt/  http://http.debian.net/debian/

     or you can create a clean operation system on your host ,then copy the "/" contents to /mnt


    Step 2  Build PV kernel

    The domU kernel used by domains with vtpms must include the xen-tpmfront.ko  driver. It can be built directly into the kernel or as a module. And the kernel  patches you can find at  

     git clone  https://github.com/trust2virt/domuKernel.git

 

     1.  #make menuconfig

    processor type and feathers –> pavavirtualized guest support
    device drivers ---> network device support---> xen network device frontend driver    --    built-in
    device drivers ---> character devices ---> TPM Hardware Support ----> XEN TPM interface  --- built-in
    
    check the .config, make sure the following CONFIGs are set to y:
    CONFIG_XEN
    CONFIG_PARAVIRT
    CONFIG_PARAVIRT_GUEST
    CONFIG_XEN_BLKDEV_FRONTEND
    CONFIG_XEN_NETDEV_FRONTEND
    CONFIG_HVC_XEN
    CONFIG_HVC_XEN_FRONTEND
    CONFIG_TCG_TPM
    CONFIG_TCG_XEN

    2.  build  
    #make

    3.   install
     #make modules_install INSTALL_MOD_PATH=/mnt/
     #make install INSTALL_PATH=/mnt/boot

    4.   create grub.cfg file   
    #mkdir /mnt/boot/grub 
    #cd /mnt/boot/grub
    #touch grub.cfg

    file content as below:
    default 0
    timeout 5
     title ubt-pv
        root    (hd0) 
        kernel /boot/vmlinuz-version root=/dev/xvda1 ro  
        initrd /boot/initrd-version.img

    5. #umount /mnt
     then the ubu-pv.img is DONE!

    6. create PV configure file 

    kernel="/usr/local/lib/xen/boot/pv-grub-x86_64.gz"
    extra="(hd0)/boot/grub/grub.conf"
    vcpus = 1
    memory = 1024
    name = "ubtPV-2"
    vif = [ 'bridge=xenbr0' ]
    disk = [ 'file:/opt/pv-image/ubtpv.img,xvda1,w']
    vtpm=["backend=vtpm2"]         // vtpm2 is the backend device of PV
 
    7. #xl create
    # xl list


    DONE!

 




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值