XendBootLoader.py:
判读bootloader是否存在
Linux:/usr/bin/pygrub
Windows: /usr/lib/xen/boot/hvmloade
判断 启动设备是否存在,不存在返回:Disk isn't accessible
打开一个管道,用于两个pty进程间通信:/var/run/xend/boot/xenbl.%s
构造命令并在pty子进程中执行:
/usr/bin/pygrub [ --kernel=%s --ramdisk=%s --args=%s --output=%s -q ] path-to-disk
如果子进程(执行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=]
grub文件路径为:/boot/grub/menu.lst", "/boot/grub/grub.conf" 或 "/grub/menu.lst", "/grub/grub.conf"
使用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中,有待继续研究。
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com