• Use virtual machine manager to run JOS - [康朴塔散思]

    2009-09-22

    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
    http://damocles.blogbus.com/logs/46949321.html

    1. Create a new virtual machine and choose its hypervisor as qemu.

    2. Name it "JOS"

    3. Configure the hard disk and memory

    4. virsh dumpxml JOS > jos.xml

    5. Edit the jos.xml like below

     1 <domain type='qemu'>
     2   <name>JOS</name>
     3   <uuid>8e7bb147-9da1-49e0-90b7-5011c54ae9a6</uuid>
     4   <memory>262144</memory>
     5   <currentMemory>262144</currentMemory>
     6   <vcpu>1</vcpu>
     7   <os>
     8     <type arch='i686' machine='pc'>hvm</type>
     9     <boot dev='hd'/>
    10   </os>
    11   <features>
    12     <acpi/>
    13     <apic/>
    14     <pae/>
    15   </features>
    16   <clock offset='utc'/>
    17   <on_poweroff>destroy</on_poweroff>
    18   <on_reboot>restart</on_reboot>
    19   <on_crash>restart</on_crash>
    20   <devices>
    21     <emulator>/home/guzhongshu/Project/Jos/qemu_wrapper.sh</emulator>
    22     <disk type='file' device='disk'>
    23       <source file='/home/guzhongshu/Project/Jos/obj/kern/bochs.img'/>
    24       <target dev='hda' bus='ide'/>
    25     </disk>
    26     <disk type='file' device='disk'>
    27       <source file='/home/guzhongshu/Project/Jos/obj/fs/fs.img'/>
    28       <target dev='hdb' bus='ide'/>
    29     </disk>
    30     <interface type='user'>
    31         <mac address='52:54:00:12:34:56'/>
    32         <model type='i82559er'/>
    33     </interface>
    34     <parallel type='stdio'>
    35       <target port='0'/>
    36     </parallel>
    37     <serial type='pty'>
    38       <target port='0'/>
    39     </serial>
    40     <console type='pty'>
    41       <target port='0'/>
    42     </console>
    43     <input type='mouse' bus='ps2'/>
    44     <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
    45   </devices>
    46 </domain>


    6. virsh define jos.xml

    7. Add file qemu_wrapper.sh because some arguments can not be added in the xml. We need to use some trick.

    #!/bin/sh
      exec /usr/local/bin/qemu -redir tcp:8080::80 -redir tcp:4242::10000 "$@" -debug-e100 -pcap slirp.cap



    收藏到:Del.icio.us




    评论

  • 我刚开始准备把网络的给做掉。