[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4] xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry
menuentry in grub2/grub.cfg uses linux16 and initrd16 commands instead of linux and initrd. Due to this RHEL 7 (beta) guest failed to boot after the installation. In addition to this, RHEL 7 menu entries have two different single-quote delimited strings on the same line, and the greedy grouping for menuentry parsing gets both strings, and the options inbetween. Signed-off-by: Joby Poriyath <joby.poriyath@xxxxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Cc: george.dunlap@xxxxxxxxxx --- v2: Added RHEL 7 grub.cfg in pygrub/examples v3 & v4: Tidied the commit message based on Andrew Cooper's feedback Kindly consider this patch for xen-4.4 as RHEL 7 (beta) fails to boot on Xen. tools/pygrub/examples/rhel-7-beta.grub2 | 118 +++++++++++++++++++++++++++++++ tools/pygrub/src/GrubConf.py | 4 +- 2 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 tools/pygrub/examples/rhel-7-beta.grub2 diff --git a/tools/pygrub/examples/rhel-7-beta.grub2 b/tools/pygrub/examples/rhel-7-beta.grub2 new file mode 100644 index 0000000..88f0f99 --- /dev/null +++ b/tools/pygrub/examples/rhel-7-beta.grub2 @@ -0,0 +1,118 @@ +# +# DO NOT EDIT THIS FILE +# +# It is automatically generated by grub2-mkconfig using templates +# from /etc/grub.d and settings from /etc/default/grub +# + +### BEGIN /etc/grub.d/00_header ### +set pager=1 + +if [ -s $prefix/grubenv ]; then + load_env +fi +if [ "${next_entry}" ] ; then + set default="${next_entry}" + set next_entry= + save_env next_entry + set boot_once=true +else + set default="${saved_entry}" +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +if [ "${prev_saved_entry}" ]; then + set saved_entry="${prev_saved_entry}" + save_env saved_entry + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true +fi + +function savedefault { + if [ -z "${boot_once}" ]; then + saved_entry="${chosen}" + save_env saved_entry + fi +} + +function load_video { + if [ x$feature_all_video_module = xy ]; then + insmod all_video + else + insmod efi_gop + insmod efi_uga + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + fi +} + +terminal_output console +set timeout=5 +### END /etc/grub.d/00_header ### + +### BEGIN /etc/grub.d/10_linux ### +menuentry 'Red Hat Enterprise Linux Everything, with Linux 3.10.0-54.0.1.el7.x86_64' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10.0-54.0.1.el7.x86_64-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163' { + load_video + set gfxpayload=keep + insmod gzio + insmod part_msdos + insmod xfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 89ffef78-82b3-457c-bc57-42cccc373851 + else + search --no-floppy --fs-uuid --set=root 89ffef78-82b3-457c-bc57-42cccc373851 + fi + linux16 /vmlinuz-3.10.0-54.0.1.el7.x86_64 root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/swap vconsole.keymap=uk crashkernel=auto rd.lvm.lv=rhel/root vconsole.font=latarcyrheb-sun16 LANG=en_GB.UTF-8 + initrd16 /initramfs-3.10.0-54.0.1.el7.x86_64.img +} +menuentry 'Red Hat Enterprise Linux Everything, with Linux 0-rescue-af34f0b8cf364cdbbe6d093f8228a37f' --class red --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f-advanced-d23b8b49-4cfe-4900-8ef1-ec80bc633163' { + load_video + insmod gzio + insmod part_msdos + insmod xfs + set root='hd0,msdos1' + if [ x$feature_platform_search_hint = xy ]; then + search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1' 89ffef78-82b3-457c-bc57-42cccc373851 + else + search --no-floppy --fs-uuid --set=root 89ffef78-82b3-457c-bc57-42cccc373851 + fi + linux16 /vmlinuz-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/swap vconsole.keymap=uk crashkernel=auto rd.lvm.lv=rhel/root vconsole.font=latarcyrheb-sun16 + initrd16 /initramfs-0-rescue-af34f0b8cf364cdbbe6d093f8228a37f.img +} + +### END /etc/grub.d/10_linux ### + +### BEGIN /etc/grub.d/20_linux_xen ### +### END /etc/grub.d/20_linux_xen ### + +### BEGIN /etc/grub.d/20_ppc_terminfo ### +### END /etc/grub.d/20_ppc_terminfo ### + +### BEGIN /etc/grub.d/30_os-prober ### +### END /etc/grub.d/30_os-prober ### + +### BEGIN /etc/grub.d/40_custom ### +# This file provides an easy way to add custom menu entries. Simply type the +# menu entries you want to add after this comment. Be careful not to change +# the 'exec tail' line above. +### END /etc/grub.d/40_custom ### + +### BEGIN /etc/grub.d/41_custom ### +if [ -f ${config_directory}/custom.cfg ]; then + source ${config_directory}/custom.cfg +elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then + source $prefix/custom.cfg; +fi +### END /etc/grub.d/41_custom ### diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py index cb853c9..974cded 100644 --- a/tools/pygrub/src/GrubConf.py +++ b/tools/pygrub/src/GrubConf.py @@ -348,7 +348,9 @@ class Grub2Image(_GrubImage): commands = {'set:root': 'root', 'linux': 'kernel', + 'linux16': 'kernel', 'initrd': 'initrd', + 'initrd16': 'initrd', 'echo': None, 'insmod': None, 'search': None} @@ -394,7 +396,7 @@ class Grub2ConfigFile(_GrubConfigFile): continue # new image - title_match = re.match('^menuentry ["\'](.*)["\'] (.*){', l) + title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l) if title_match: if img is not None: raise RuntimeError, "syntax error: cannot nest menuentry (%d %s)" % (len(img),img) -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |