aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pygrub
Commit message (Collapse)AuthorAgeFilesLines
* build: Make XEN_ROOT an absolute path.Keir Fraser2011-03-171-1/+1
| | | | | | | | Otherwise make can search the path relative to certain standard paths such as /usr/include (e.g., the line '-include $(XEN_ROOT)/.config' in Config.mk suffers from this). Signed-off-by: Keir Fraser <keir@xen.org>
* pygrub: support grub2 "(hdX,msdosY)" partition syntaxIan Campbell2010-10-131-0/+2
| | | | | | | | This appeared in Debian Squeeze at some point. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* pygrub: look in every partition for something to bootIan Jackson2010-07-151-35/+62
| | | | | | | | | pygrub: look in every partition for something to boot, in case the OS installer (SLES 10 sp1 in particular) forgets to mark the boot partition as active. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com> Acked-by: David Markey <admin@dmarkey.com>
* pygrub: introduce easier to parse output formatIan Jackson2010-07-141-13/+44
| | | | | | | | | | | | | | | | | libxl would rather like to parse the output of pygrub. Rather than implement an SXP parser in libxl add a --output-format option to pygrub which can select an alternative, simpler to parse, format. Available formats are: sxp: current SXP output format; simple: simple key+value output with \n separating item ( for debugging). key and value are separated by a single space (and key therefore cannot contain a space); simple0: as simple but with \0 as a separator; Also add --output-directory to allow temporary files to be placed somewhere other than /var/run/xend/boot. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* tools/pygrub: --not-really option for debuggingIan Jackson2010-07-021-15/+24
| | | | | | | Add a --not-really option to pygrub that lets us see what files it would have extracted instead of actually extracting them. Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* tools/pygrub: Fix a typo handling device specs with no partition partIan Jackson2010-07-021-1/+1
| | | | | | | pygrub: fix a typo that causes exceptions when looking at device specifications that don't have a partition part (e.g. (hd0)). Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
* tools/pygrub: Fix default when out of rangeIan Jackson2010-06-291-0/+3
| | | | | | | | | | | | | This is the patch to fix pyGrub default value when it's being set out of range. This patch makes the quiet and interactive mode select the same default image when the default value for boot entry is out of range, i.e. when the guest is having wrong configuration in it's boot loader (like 3 entries with default mistakenly set to 10 etc). When the boot entry number is being set out of range it falls back to 0 (first entry of boot loader). Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pyGrub: Use proper bootloader class when entering command manuallyKeir Fraser2010-05-264-6/+26
| | | | | | | | | | | | | | | | | | Use the proper bootloader class when entering the boot commands manually (i.e. using the 'c' option). Before this patch the bootloader was always treated to be Grub but when user is using Grub2/ExtLinux or Lilo it's rather confusing. After applying this patch the proper bootloader image class is being used, e.g. Grub2Image for Grub2 etc. when you define the boot commands manually using the 'c' command in pyGrub. Also, fix for using isconfig has been applied since if there is not fs set in the run_grub() method the read_config() would fail since it's trying to access undefined self.cf which is now being set to parser() from cfg_list. Signed-off-by: Michal Novotny <minovotn@redhat.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: Fix Grub2 support for Ubuntu 10.04Keir Fraser2010-04-151-1/+1
| | | | | | | | Due to changes in grub2, menu entry titles now have single quote around them rather than double quotes, but the memtest entries still are using double quotes, so we need to catch both. Signed-off-by: David Markey <david.markey@citrix.com>
* pygrub: fix 64b Solaris PV guest boot on 32b Linux dom0 & 64b XenKeir Fraser2010-04-121-12/+14
| | | | Signed-off-by: Mark Johnson <mark.r.johnson@oracle.com>
* pygrub: further improve grub2 supportKeir Fraser2010-03-151-11/+16
| | | | | | | | | | | | | | * Improve syntax error messages to say what actually went wrong instead of giving an arbitrary and basically useless integer. * Improve handling of quoted values used with the "set" command, previously only the default variable was special cased to handle quoting. * Allow for extra options to the menuentry command, syntax now appears to be menuentry "TITLE" --option1 --option2 {...} Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: Fix grub2 support when config is on a separate /boot partitionKeir Fraser2010-03-051-1/+1
| | | | | Signed-off-by: David Markey <david@dmarkey.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: support parsing of syslinux configuration filesKeir Fraser2010-02-013-1/+206
| | | | | | | | | | Allows booting from ISOs which use isolinux as well as guests using extlinux. Also add copyright header to GrubConf.py, I think the grub2 support added last year qualifies as a substantial change. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: improve grub 2 supportKeir Fraser2010-01-261-3/+19
| | | | | | | | | | | | | | | | | * The "default" value can be a quoted string (containing an integer) so strip the quotes before interpreting. * The "set" command takes a variable with an arbitrary name so instead of whitelisting the ones to ignore simply silently accept any set command with an unknown variable. * Ignore the echo command. * Handle the function { ... } syntax. Previously pygrub would error out with a syntax error on the closing "}" because it thought it was the closing bracket of a menuentry. This makes pygrub2 work with the configuration files generated by Debian Squeeze today. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: fix attribute error when not found parserKeir Fraser2009-12-161-1/+1
| | | | Signed-off-by: Wei Kong <weikong.cn@gmail.com>
* pygrub: add basic support for parsing grub2 style grub.cfg fileKeir Fraser2009-11-232-4/+123
| | | | | | | | | | This represents a very simplistic aproach to parsing these file. It is basically sufficient to parse the files produced by Debian Squeeze's version of update-grub. The actual grub.cfg syntax is much more expresive but not apparently documented apart from a few examples... Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: track the title of an item as an independant fieldKeir Fraser2009-11-232-18/+19
| | | | | | | | | | | | separate to the other fields. This makes the list of lines within a GrubImage 0 based rather than 1 based therefore adjust the user interface parts to suit. This is in preparation for grub2 support where the syntax for the item title does not fit the existing usage. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: factor generic Grub functionality into GrubConf base classesKeir Fraser2009-11-232-77/+90
| | | | | | | | | | | and inherit from these classes to implement Grub-legacy functionality. Use a tuple of (parser-object,configuration-file) in pygrub to allow for multiple parsers. Makes way for grub2 support. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: expands tabs before displaying menus.Keir Fraser2009-11-231-2/+2
| | | | | | | Otherwise the highlighting and line length trimming does not work as expected and the display appears corrupted. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: if default entry is "saved" then use first entry.Keir Fraser2009-11-231-1/+1
| | | | | | | | pygrub doesn't support the "savedefault" command and will error out if menu.lst uses the "default saved" directive. We might as well start on the first entry in this case instead of failing. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
* pygrub: Correct pygrub return valueKeir Fraser2009-09-151-2/+3
| | | | | | | | | | | | This is the patch to correct pygrub return value for checkPassword() function. It didn't return False at the end of the function. It returned None so it was working fine and it's most likely just a cosmetic issue. Also, the missing () were added to checkPassword() function when calling hasPassword and the unnecessary comment was removed. Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: trap exception when python module import failsKeir Fraser2009-09-072-15/+22
| | | | | | | | | | | Fix the issue when importing 'crypt' module or crypt.crypt fails in pygrub. The exception is written on the same line like "Failed!" message but only if there is an exception. If there is no exception, we don't bother users with details (probably the password they entered was wrong) so we just display "Failed!" message. Also, the code for hasPassword() was rewritten not to have try/except block here. Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: Match bare-metal GRUB behavior for passwordsKeir Fraser2009-09-021-28/+14
| | | | | | | | | | The password support patch already merged didn't match the bare-metal GRUB behavior so I created a patch to match it. If password is entered in grub.conf file, pressing `p` is required exactly like when using "real" (bare-metal) GRUB. New options are available after the correct password is entered. Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: Set path in #! line of pygrub, tooKeir Fraser2009-08-252-1/+2
| | | | | | | | | | | | | pygrub currently has a hardcoded path of /usr/bin/python which is not correct if the version of python at install time is not the same as that at build time. This patch uses the existing install-wrap and python/get-path machinery. (It does not address the currently-existing bug that the get-path machinery works by assuming that `python' is a symlink, rather than querying the python interpreter for its version.) Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* pygrub: Fix elilo handling after password patch.Keir Fraser2009-08-212-1/+7
| | | | Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: Add password supportKeir Fraser2009-08-202-1/+66
| | | | | | | | | | | | | | It basically checks for the presence of password line in grub.conf of the guest image and if this line is present, it supports both clear text and md5 versions of the password. Editing the grub entries and command-line are disabled when some password is set in domain's grub.conf file but the password was not entered yet. Also, new option to press 'p' in interactive pygrub has been added to allow entering the grub password. It's been tested on x86_64 with PV guests and was working fine. Also, the countdown has been stopped after key was pressed, ie. the user is probably editing the boot configuration. Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: Revert 19322:3118041f2259, as it breaks timeout=0 behaviourKeir Fraser2009-08-201-5/+1
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* pygrub: Remove bogus log.debug line.Keir Fraser2009-08-101-1/+0
| | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* Permit user to suppress passing --prefix to setup.pyKeir Fraser2009-05-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | We change all invocations of setup.py as follows: * use $(PYTHON) instead of `python' so that the user can specify an alternative python version if they need to. If not set it defaults to `python' in Config.mk. * pass --prefix=$(PREFIX) via a new make variable $(PYTHON_PREFIX_ARG). This allows a user to suppress the --prefix=... argument entirely by setting PYTHON_PREFIX_ARG=''. This will work around the bug described here https://bugs.launchpad.net/ubuntu/+bug/362570 where passing --prefix=/usr/local (which ought to have no effect as /usr/local is the default prefix) changes which subdirectory distutils chooses, and results in the files being installed in site-packages which is not on the default search path. Users not affected by this python packaging bug should not set PYTHON_PREFIX_ARG and their builds will not be affected. (Provided PREFIX did not contain spaces. People who put spaces in PREFIX are being quite optimistic.) Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: Always use sane upstream (`native') python pathsKeir Fraser2009-04-082-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, by default we would install our python modules into /usr/lib/python/xen, for example /usr/lib/python/xen/__init__.py. Upstream python's standard install location (a) includes the Python version number and (b) puts things in site-packages by default. Our best conjecture for the reason for this was an attempt to make the installs portable between different python versions. However, that doesn't work because compiled python modules (.pyc), and C python extensions corresponding to one version of python, are not compatible across different versions of python. This is why upstream include the version number. site-packages is the standard location for locally-installed packages and is automatically included on the python search path. In this change, we abandon our own unusual python path setup: * Invoke setup.py in an entirely standard manner. We pass PREFIX and DESTDIR using the appropriate options provided by setup.py for those purposes (adding them to setup.py calls which were previously lacking them). * Since the installation locations are now on the standard python path, we no longer need to add anything to the path in any of our python utilities. Therefore remove all that code from every python script. (Many of these scripts unconditionally added /usr/lib/python and /usr/lib64/python which is wrong even in the old world.) * There is no longer any special `Xen python path'. xen-python-path is no longer needed. It is no longer called by anything in our tree. However since out-of-tree callers may still invoke it, we retain it. It now prints a fixed string referring to a directory which does not to exist; callers (who use it to augment their python path) will thus add a nonexistent directory to their python path which is harmless. * Remove various workarounds including use of setup.py --home (which is intended for something completely different). * Remove tests for the XEN_PYTHON_NATIVE_INSTALL build-time environment variable. The new behaviour is the behaviour which we should have had if this variable had been set. That is, it is now as if this variable was always set but also bugs in the resulting install have been fixed. This should be a proper fix for the bug addressed by c/s 19515. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* tools: fix python installationKeir Fraser2009-04-071-2/+1
| | | | | | | | | | | attached patch lets python install the modules into DESTDIR/PREFIX as before, but lets python search the modules in PREFIX rather DESTDIR/PREFIX. This prevents failures about not finding python modules after files have been installed into PREFIX. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* build: Get rid of some more hardcoded install pathsKeir Fraser2009-03-311-1/+1
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* ia64, pygrub: Allow command-line editing in Lilo boot loaderKeir Fraser2009-03-311-1/+5
| | | | | | | | On IA64 platform reset() function has one more parameter for Lilo bootloader used by IA64 than for GRUB bootloader used for other platforms. Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: More accurate try/except catch.Keir Fraser2009-03-311-1/+1
| | | | Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: run first entry in config when invalid default boot option providedKeir Fraser2009-03-201-1/+5
| | | | | | This behaviour matches that of real GRUB. Signed-off-by: Michal Novotny <minovotn@redhat.com>
* pygrub: Detect NetWare PV in pygrubKeir Fraser2009-03-121-0/+12
| | | | Signed-off-by: John Levon <john.levon@sun.com>
* pygrub: Workaround for Solaris CR 1143256.Keir Fraser2009-03-121-1/+5
| | | | | | | | | | The Solaris curses library has a broken timeout() function: after a first timeout() call with a positive value for an argument, subsequent calls will fail to reset it. So, getch() always times out, confusing the pygrub timer in the main loop. Add an extra check to avoid exiting prematurely. Signed-off-by: Frank van der Linden <frank.vanderlinden@sun.com>
* pygrub: Enable domU boot without xen specific argKeir Fraser2009-03-091-2/+2
| | | | | | | | This patch makes domUs bring up without xen specific args to guest kernels. A domU should be bootable without args parameter because tools/examples/xmexample1 doesn't have one. Signed-off-by: INAKOSHI Hiroya <inakoshi.hiroya@jp.fujitsu.com>
* pygrub: parse xen module option in grubKeir Fraser2009-02-201-3/+3
| | | | | | | 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>
* Use -MMD -MF in tools/* rather than -Wp,-M...Keir Fraser2009-01-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | If you use -MMD -MF then the correct .o filename is written to the .*.d file as the compiler driver arranges everything. This was done in 19010:275abe1c5d24 for the hypervisor. In this patch we do the same elsewhere in the xen-unstable tree, particularly tools/. Specifically: * Change tools/Rules.mk to add -MMD -MF ... to CFLAGS and set DEPS. * Remove -Wp,-MD... from every other Makefile * Remove setting of DEPS from every other Makefile * Ensure that every Makefile says -include $(DEPS) * Ensure that every Makefile's clean target removes $(DEPS) Some Makefiles were already halfway there, but often for a different variable name eg PROG_DEP. The variable name is now standardised in Rules.mk as DEPS. I have done a test build with this change, on Debian etch. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* pygrub: fix the parameter `default' and `timeout' in elilo.confKeir Fraser2008-10-031-3/+3
| | | | | | | | | | | | | | | | This patch fixes two issues related to the parameter `default' and `timeout' in elilo.conf: - LiloConf.py cannot interpret the parameter `default' and `timeout'. The first kernel always boot up even if the second kernel is specified by `default'. And `timeout' is ignored. This issue is introduced by cset 15953:70bb28b62ffb. - If two kernels or more are installed, the last kernel cannot boot up even if it is specified by `default'. Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
* PyGRUB: fix menu flickerKeir Fraser2008-08-271-15/+17
| | | | | | | | To avoid flickers, PyGRUB has to avoid spurious ncurses refresh as much as possible, in particular before the complete screen is drawn, and eventually call doupdate last. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
* pygrub: Add 64bit library path to pygrub default search path.Keir Fraser2008-07-301-1/+1
| | | | Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
* Add ZFS libfsimage support patchKeir Fraser2008-05-012-3/+39
| | | | | | | | | Add support to pygrub and libfsimage to boot ZFS root filesystems. Boot argument of zfs-bootfs is set to describe ZFS root pool and boot filesystem object number. Boot argument bootpath is set to describe the virtual device root mirror components. Signed-off-by: Susan Kamm-Worrell <susan.kamm-worrell@sun.com>
* pygrub: cleanup and support for NetBSDKeir Fraser2008-03-261-7/+8
| | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
* Fix pygrub handling of many kernelsKeir Fraser2007-12-271-4/+12
| | | | | | | | If there are a large number of kernel images configured in grub.conf there will be too many to fit in the limited size pygrub display. This patch fixes this so that the list of kernels scrolls as needed. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix security vulnerability CVE-2007-4993.Keir Fraser2007-09-252-23/+23
| | | | | | | | | Protect pygrub from possible malicious content in guest grub config file. This fixes CVE-2007-4993. Original patch from Jeremy Katz, I updated to close 2 remaining issues pointed out by Christian and Keir, and to use setattr(self, ...). Signed-off-by: Chris Wright <chrisw@sous-sol.org>
* pygrub: LiloConf.py supports root and read-onlykfraser@localhost.localdomain2007-08-061-3/+21
| | | | | | | LiloConf.py ignores the following options: root and read-only. This patch fixes the issue. Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
* [IA64] Presently pygrub only looks in /efi/redhat/elilo.conf. Itkfraser@localhost.localdomain2007-05-031-1/+6
| | | | | | | should check for other distributions, plus a couple fallback locations. Signed-off-by: Aron Griffis <aron@hp.com>
* pygriub: Fix GPT support.kfraser@localhost.localdomain2007-04-131-7/+11
| | | | | | | - 64 bit support for starting of a GPT partition. - detect partition types precisely. Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>