diff options
author | Kjetil Torgrim Homme <kjetil.homme@redpill-linpro.com> | 2013-06-20 13:51:41 +0200 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2013-07-17 10:36:02 +0100 |
commit | b179c6c490ca3e3baf1ce58ecb7f87f2a8df6049 (patch) | |
tree | 5f3844b96855426be52cb3e01d335c5735bc1c40 /tools/pygrub/src | |
parent | 75beb8e45133acb8795024fc6114ff557ce1c27f (diff) | |
download | xen-b179c6c490ca3e3baf1ce58ecb7f87f2a8df6049.tar.gz xen-b179c6c490ca3e3baf1ce58ecb7f87f2a8df6049.tar.bz2 xen-b179c6c490ca3e3baf1ce58ecb7f87f2a8df6049.zip |
pygrub: allow user to specify an explicit offset to fs
This new option overrides partition table parsing
Signed-off-by: Kjetil Torgrim Homme <kjetil.homme@redpill-linpro.com>
Reviewed-by: Matt Wilson <msw@amazon.com>
Diffstat (limited to 'tools/pygrub/src')
-rw-r--r-- | tools/pygrub/src/pygrub | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub index eedfdb2fbf..363fbc7c66 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 + part_offs = None debug = False not_really = False output_format = "sxp" @@ -797,6 +798,13 @@ if __name__ == "__main__": incfg["ramdisk"] = a elif o in ("--args",): incfg["args"] = a + elif o in ("--offset",): + try: + part_offs = [ int(a) ] + except ValueError: + print "offset value must be an integer" + usage() + sys.exit(1) elif o in ("--entry",): entry = a # specifying the entry to boot implies non-interactive @@ -807,7 +815,7 @@ if __name__ == "__main__": debug = True elif o in ("--output-format",): if a not in ["sxp", "simple", "simple0"]: - print "unkonwn output format %s" % a + print "unknown output format %s" % a usage() sys.exit(1) output_format = a @@ -840,7 +848,8 @@ if __name__ == "__main__": bootfsoptions = "" # get list of offsets into file which start partitions - part_offs = get_partition_offsets(file) + if part_offs is None: + part_offs = get_partition_offsets(file) for offset in part_offs: try: |