zoukankan      html  css  js  c++  java
  • xen bootloader

    XendBootLoader.py:

    1. 判读bootloader是否存在
      •    Linux:/usr/bin/pygrub
      •    Windows: /usr/lib/xen/boot/hvmloade
    2. 判断 启动设备是否存在,不存在返回:Disk isn't accessible
    3. 打开一个管道,用于两个pty进程间通信:/var/run/xend/boot/xenbl.%s 
    4. 构造命令并在pty子进程中执行:
      • /usr/bin/pygrub [ --kernel=%s --ramdisk=%s --args=%s  --output=%s -q ] path-to-disk
    5. 如果子进程(执行bootloader)执行失败,或没有任何输出,则raise VmError, msg,否则返回sxp格式的结果。
       
    源码中的注释:
        # We need to present the bootloader's tty as a pty slave that xenconsole
        # can access.  Since the bootloader itself needs a pty slave,
        # we end up with a connection like this:
        #
        # xenconsole -- (slave pty1 master) <-通过管道复制数据-> (master pty2 slave) -- bootloader
        #
        # where we copy characters between the two master fds, as well as
        # listening on the bootloader's fifo for the results.
        # filedescriptors:
        #   r - input from the bootloader (bootstring output)
        #   m1 - input/output from/to xenconsole
        #   m2 - input/output from/to pty that controls the bootloader
     
     
    /usr/bin/pygrub

    pygrub解析传入的分区的结构,如果是一个disk,那么就从disk找到active的分区,如果是分区,那就直接解析分区,然后引导启动。
    Usage: /usr/bin/pygrub [-q|--quiet] [-i|--interactive] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] <image>
    1.  grub文件路径为:/boot/grub/menu.lst", "/boot/grub/grub.conf" 或 "/grub/menu.lst", "/grub/grub.conf"
    2. 使用pygrub,启动分区要放在第一个位置。
     
    手动执行的结果是:
    linux (kernel /var/run/xend/boot/boot_kernel.L_jphs)(ramdisk /var/run/xend/boot/boot_ramdisk.9Ed02z)(args "ro root=/dev/sda2 ")
     
    PV-GRUB被认为是pygrub的取代:
     

    PV-GRUB replaces PyGrub to boot domU images safely: it runs the regular grub inside the created domain itself and uses regular domU facilities to read the disk / fetch files from network etc.; it eventually loads the PV kernel and chain-boots it.

    kernel = "/usr/lib/xen/boot/pv-grub-x86_32.gz"
    
    extra = "(hd0,0)/grub/menu.lst"
    
     
    /usr/lib/xen/boot/hvmloader

    源码在hvmloader.c中,有待继续研究。
  • 相关阅读:
    在DOS的常用命令
    HTML中USEMAP的用法
    asp.net2.0角色管理,详细步骤
    利用ASP.NET动态生成HTML文件
    PetShop 4.0 详解之五(PetShop之业务逻辑层设计)
    使用成员资格和用户登录创建网站 (Visual Studio)
    Windows 找不到文件'(null)'.请确定文件名是否正确后,再试一下.要搜索文件,请单击[开始]按钮,然后单击"搜索"
    在ashx文件中读写session
    asp.net图片滚动+JAVASCRIPT(向右)
    动态编辑程序配置文件
  • 原文地址:https://www.cnblogs.com/feisky/p/2325022.html
Copyright © 2011-2022 走看看