xen-devel
[Xen-devel] [PATCH] pygrub: parse xen module option in grub
Add function for GrubConf to parse xen module option in grub. Pygrub should pass args as domUloader did.
Signed-off-by: Wei Kong <weikong.cn@gmail.com>
diff -uNrp a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py --- a/tools/pygrub/src/GrubConf.py 2009-02-20 09:59:40.000000000 +0800 +++ b/tools/pygrub/src/GrubConf.py 2009-02-20 10:11:30.000000000 +0800
@@ -12,7 +12,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -import os, sys +import os, sys, re import logging def grub_split(s, maxsplit = -1): @@ -91,7 +91,7 @@ class GrubImage(object):
self.args, self.initrd)) def reset(self, lines): - self._root = self._initrd = self._kernel = self._args = None + self._root = self._initrd = self._kernel = self._args = self._xen = None
self.title = "" self.lines = [] map(self.set_from_line, lines) @@ -120,7 +120,22 @@ class GrubImage(object): return self._root root = property(get_root, set_root)
+ def set_module(self, val): + if not self._xen: + return + if (val.find('vmlinuz') != -1): + (kernel, args) = val.split(None, 1) + self._kernel = get_path(kernel)
+ self._args = args + if (val.find('initrd') != -1): + self._initrd = get_path(val) + module = property(None, set_module) + def set_kernel(self, val): + xengz=re.compile(".*xen[\-.0-9]+gz$", re.UNICODE)
+ if xengz.match(val): + self._xen = True + return if val.find(" ") == -1: self._kernel = get_path(val) self._args = None @@ -147,8 +162,9 @@ class GrubImage(object):
"rootnoverify": "root", "kernel": "kernel", "initrd": "initrd", + "module": "module",
"chainloader": None, - "module": None} + } class GrubConfigFile(object): diff -uNrp a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub 2009-02-20 09:59:40.000000000 +0800 +++ b/tools/pygrub/src/pygrub 2009-02-20 10:13:54.000000000 +0800 @@ -682,7 +682,7 @@ if __name__ == "__main__": if chosencfg["args"]:
zfsinfo = fsimage.getbootstring(fs) if zfsinfo is None: - sxp += "(args \"%s\")" % chosencfg["args"] + sxp += "(args \"%s %s\")" % (chosencfg["args"], incfg["args"])
else: e = re.compile("zfs-bootfs=[\w\-\.\:@/]+" ) (chosencfg["args"],count) = e.subn(zfsinfo, chosencfg["args"])
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [PATCH] pygrub: parse xen module option in grub,
Wei Kong <=
|
|
|