[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH OSSTEST 01/12] Add support of parsing grub which has 'submenu' primitive



 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. Also, this patch adjust
 some indent alignments.

---
 Osstest/Debian.pm | 60 +++++++++++++++++++++++++++++++++----------------------
 1 file changed, 36 insertions(+), 24 deletions(-)

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 3e2d1c3..b85b9fd 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -1,5 +1,6 @@
 # This is part of "osstest", an automated testing framework for Xen.
 # Copyright (C) 2009-2013 Citrix Inc.
+# Copyright (C) 2014-2015 Intel Inc.
 # 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
@@ -286,26 +287,34 @@ 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
-                        ? qw(Title Hv KernDom0 KernVer)
-                        : qw(Title Hv KernOnly KernVer));
-               if (@missing) {
-                   logm("(skipping entry at $entry->{StartLine};".
-                        " no @missing)");
-               } elsif (defined $want_kernver &&
-                        $entry->{KernVer} ne $want_kernver) {
-                   logm("(skipping entry at $entry->{StartLine};".
-                        " kernel $entry->{KernVer}, not $want_kernver)");
-               } else {
-                   # yes!
-                   last;
-               }
+                           grep { !defined $entry->{$_} }
+                               (defined $xenhopt 
+                               ? qw(Title Hv KernDom0 KernVer)
+                               : qw(Title Hv KernOnly KernVer));
+                       if (@missing) {
+                           logm("(skipping entry at $entry->{StartLine};".
+                                " no @missing)");
+                       } elsif (defined $want_kernver &&
+                        $entry->{KernVer} ne $want_kernver) {
+                           logm("(skipping entry at $entry->{StartLine};".
+                                " kernel $entry->{KernVer}, not 
$want_kernver)");
+                       } else {
+                   # yes!
+                   last;
+                       }
                 $entry= undef;
                 next;
             }
@@ -317,21 +326,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;
             }
         }
@@ -341,10 +353,10 @@ sub setupboot_grub2 ($$$) {
 
         logm("boot check: grub2, found $entry->{Title}");
 
-       die unless $entry->{$kernkey};
-       if (defined $xenhopt) {
-           die unless $entry->{Hv};
-       }
+       die unless $entry->{$kernkey};
+       if (defined $xenhopt) {
+           die unless $entry->{Hv};
+       }
 
         return $entry;
     };
-- 
1.8.3.1


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.