From: "longtao.pang" Subject: [OSSTEST Nested PATCH v7 1/6] parsing grub which has 'submenu' primitive Date: Fri, 27 Mar 2015 19:06:22 -0400 Message-ID: <1427497587-22884-2-git-send-email-longtaox.pang@intel.com> References: <1427497587-22884-1-git-send-email-longtaox.pang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1427497587-22884-1-git-send-email-longtaox.pang@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: wei.liu2@citrix.com, "longtao.pang" , Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com, robert.hu@intel.com List-Id: xen-devel@lists.xenproject.org >From a hvm kernel build from Linux stable Kernel tree, the auto generated grub2 menu will have 'submenu' primitive, upon the 'menuentry' items. Xen boot entries will be grouped into a submenu. This patch adds capability to support such grub formats. Signed-off-by: longtao.pang --- Changes in v7: Remove the reformatting change for Debian.pm and keep the original format. --- Osstest/Debian.pm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm index 6784024..35163a0 100644 --- a/Osstest/Debian.pm +++ b/Osstest/Debian.pm @@ -398,10 +398,18 @@ sub setupboot_grub2 ($$$$) { my $count= 0; my $entry; + my $submenu; while (<$f>) { next if m/^\s*\#/ || !m/\S/; if (m/^\s*\}\s*$/) { - die unless $entry; + die unless $entry || $submenu; + if(!defined $entry && defined $submenu){ + logm("Met end of a submenu starting from ". + "$submenu->{StartLine}. ". + "Our want kern is $want_kernver"); + $submenu=undef; + next; + } my (@missing) = grep { !defined $entry->{$_} } (defined $xenhopt @@ -432,21 +440,24 @@ sub setupboot_grub2 ($$$$) { $entry= { Title => $1, StartLine => $., Number => $count }; $count++; } - if (m/^\s*multiboot\s*\/(xen\-[0-9][-+.0-9a-z]*\S+)/) { + if (m/^submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) { + $submenu={ StartLine =>$.}; + } + if (m/^\s*multiboot\s*(?:\/boot)*\/(xen\S+)/) { die unless $entry; $entry->{Hv}= $1; } - if (m/^\s*multiboot\s*\/(vmlinu[xz]-(\S+))/) { + if (m/^\s*multiboot\s*(?:\/boot)*\/(vmlinu[xz]-(\S+))/) { die unless $entry; $entry->{KernOnly}= $1; $entry->{KernVer}= $2; } - if (m/^\s*module\s*\/(vmlinu[xz]-(\S+))/) { + if (m/^\s*module\s*(?:\/boot)*\/(vmlinu[xz]-(\S+))/) { die unless $entry; $entry->{KernDom0}= $1; $entry->{KernVer}= $2; } - if (m/^\s*module\s*\/(initrd\S+)/) { + if (m/^\s*module\s*(?:\/boot)*\/(initrd\S+)/) { $entry->{Initrd}= $1; } if (m/^\s*module\s*\/(xenpolicy\S+)/) { -- 1.7.10.4