All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix pygrub --isconfig
@ 2011-01-20 15:52 John Haxby
  2011-01-20 16:40 ` Ian Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: John Haxby @ 2011-01-20 15:52 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

Recentlly, when trying to get to the bottom of some strange booting
problem, I discovered that

    pyrgub --isconfig <image file>

usefully reports the kernel, initrd (ramdisk) and arguments that would
be used to boot a kernel.  Well, actually, what it reported was an
error.  This patch makes it work (and jolly useful it is too).  The
patch also removes a spurious "print >>sys.stderr" that seems to have
been left in from some previous debugging.

jch

[-- Attachment #2: pygrub.patch --]
[-- Type: text/x-patch, Size: 1541 bytes --]

diff -r f47b924f74af tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Tue Jan 18 12:25:54 2011 +0000
+++ b/tools/pygrub/src/pygrub	Thu Jan 20 15:46:33 2011 +0000
@@ -400,7 +400,6 @@
 
         for f,parser in cfg_list:
             if fs.file_exists(f):
-                print >>sys.stderr, "Using %s to parse %s" % (parser,f)
                 self.cf = parser()
                 self.cf.filename = f
                 break
@@ -687,14 +686,6 @@
     else:
         fd = os.open(output, os.O_WRONLY)
 
-    # debug
-    if isconfig:
-        chosencfg = run_grub(file, entry, fs, incfg["args"])
-        print "  kernel: %s" % chosencfg["kernel"]
-        if chosencfg["ramdisk"]:
-            print "  initrd: %s" % chosencfg["ramdisk"]
-        print "  args: %s" % chosencfg["args"]
-        sys.exit(0)
 
     # if boot filesystem is set then pass to fsimage.open
     bootfsargs = '"%s"' % incfg["args"]
@@ -704,6 +695,19 @@
     else:
         fs = fsimage.open(file, get_fs_offset(file))
 
+    # debug
+    if isconfig:
+        chosencfg = run_grub(file, entry, fs, incfg["args"])
+        if chosencfg.has_key("kernel"):
+            print "  kernel: %s" % chosencfg["kernel"]
+        if chosencfg.has_key("ramdisk"):
+            print "  initrd: %s" % chosencfg["ramdisk"]
+        if chosencfg.has_key("args"):
+            print "  args: %s" % chosencfg["args"]
+        if not chosencfg:
+            print "  no config"
+        sys.exit(0)
+
     chosencfg = sniff_solaris(fs, incfg)
 
     if not chosencfg["kernel"]:

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-21 15:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-20 15:52 [PATCH] Fix pygrub --isconfig John Haxby
2011-01-20 16:40 ` Ian Jackson
2011-01-21 15:20   ` John Haxby
2011-01-21 15:25     ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.