xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* pygrub patch to allow explicit offset to fs
@ 2013-06-18 23:40 Kjetil Torgrim Homme
  2013-06-19  8:17 ` Ian Campbell
  0 siblings, 1 reply; 9+ messages in thread
From: Kjetil Torgrim Homme @ 2013-06-18 23:40 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian.Campbell

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

I recently needed an old VM to work even though it was created on a SAN 
LUN with no partition table, just LVM straight onto the raw device.

pygrub didn't like this, so I added a simple hack to allow the user to 
override pygrub's probing when necessary.  please consider applying this 
patch.  btw, I think most LVM will have first filesystem at offset 196608.


commit 80a3f7b48da235695f8560deb41c19b23e7799e3
Author: Kjetil Torgrim Homme <kjetil.homme@redpill-linpro.com>
Date:   Wed Jun 19 00:54:43 2013 +0200

     allow user to specify offset parameter which overrides partition 
table parsing

     Signed-off-by: Kjetil Torgrim Homme <kjetil.homme@redpill-linpro.com>


-- 
Kjetil T. Homme
Redpill Linpro - Changing the game


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

diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index eedfdb2..d46ee8c 100644
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -712,7 +712,7 @@ if __name__ == "__main__":
     sel = None
     
     def usage():
-        print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] <image>" %(sys.argv[0],)
+        print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],)
 
     def copy_from_image(fs, file_to_read, file_type, output_directory,
                         not_really):
@@ -748,7 +748,7 @@ if __name__ == "__main__":
     try:
         opts, args = getopt.gnu_getopt(sys.argv[1:], 'qilnh::',
                                    ["quiet", "interactive", "list-entries", "not-really", "help",
-                                    "output=", "output-format=", "output-directory=",
+                                    "output=", "output-format=", "output-directory=", "offset=",
                                     "entry=", "kernel=", 
                                     "ramdisk=", "args=", "isconfig", "debug"])
     except getopt.GetoptError:
@@ -765,6 +765,7 @@ if __name__ == "__main__":
     interactive = True
     list_entries = False
     isconfig = False
+    user_provided_offset = None
     debug = False
     not_really = False
     output_format = "sxp"
@@ -797,6 +798,8 @@ if __name__ == "__main__":
             incfg["ramdisk"] = a
         elif o in ("--args",):
             incfg["args"] = a
+        elif o in ("--offset",):
+            user_provided_offset = a
         elif o in ("--entry",):
             entry = a
             # specifying the entry to boot implies non-interactive
@@ -840,7 +843,10 @@ if __name__ == "__main__":
         bootfsoptions = ""
 
     # get list of offsets into file which start partitions
-    part_offs = get_partition_offsets(file)
+    if user_provided_offset is None:
+        part_offs = get_partition_offsets(file)
+    else:
+        part_offs = [ int(user_provided_offset) ]
 
     for offset in part_offs:
         try:

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

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

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

end of thread, other threads:[~2013-07-17 10:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-18 23:40 pygrub patch to allow explicit offset to fs Kjetil Torgrim Homme
2013-06-19  8:17 ` Ian Campbell
2013-06-19  8:39   ` Wei Liu
2013-06-19  8:44     ` Ian Campbell
2013-06-19 18:10       ` Matt Wilson
2013-06-20 11:51         ` Kjetil Torgrim Homme
2013-06-24 15:17           ` Matt Wilson
2013-07-17 10:37             ` Ian Campbell
2013-06-19 10:06   ` George Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).