All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: "longtao.pang" <longtaox.pang@intel.com>
Cc: wei.liu2@citrix.com, robert.hu@intel.com,
	Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [OSSTEST Nested PATCH v8 1/7] parsing grub which has 'submenu' primitive
Date: Tue, 21 Apr 2015 11:12:51 +0100	[thread overview]
Message-ID: <1429611171.4743.16.camel@citrix.com> (raw)
In-Reply-To: <1428959990-24199-2-git-send-email-longtaox.pang@intel.com>

[-- Attachment #1: Type: text/plain, Size: 3899 bytes --]

On Mon, 2015-04-13 at 17:19 -0400, longtao.pang wrote:
> 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 <longtaox.pang@intel.com>

I think this won't work with nested submenus, but I assume we don't see
them at least with Jessie so we can live with this.

I'm also not sure it would cope with a submenu declared within a
function, but again I expect we aren't seeing those in practice.

So given this handles the grub.cfg files we see in practice:
Acked-by: Ian Campbell <ian.campbell@citrix.com>

I'd also like to see some of our delta in
overlay/etc/grub.d/20_linux_xen which was added to remove the
possibility of submenus to be removed, see below.

Wei, per the comment below I think we should update the grub BR with a
fixed patch, like the attached.

Ian.

-----


>From e082a82a3036152797447ac4c809e3b67e68cd12 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@citrix.com>
Date: Tue, 21 Apr 2015 11:06:06 +0100
Subject: [PATCH] grub: remove patch to disable submenu from 20_linux_xen
 overlay

setupboot_grub2 now supports submenus, so we can reduce our delta vs
upstream a bit.

I started by extracting 20_linux_xen from
http://snapshot.debian.org/archive/debian/20130703T094657Z/pool/main/g/grub2/grub-common_1.99-27%2Bdeb7u2_amd64.deb
and then applying the patch at
http://savannah.gnu.org/file/grub.patch?file_id=32276 (the patch from
grub bug #42420 at http://savannah.gnu.org/bugs/?43420) and
reinstating the comment at the top of the file (modified to drop the
reference to the Debian bug.

This left me with some spurious changes:

    @@ -93,7 +93,7 @@ linux_entry ()
           if test ! -e "${xen_dirname}/${xenpolicy}" ; then
              return
           fi
    -      xen_args=`echo $xen_args flask=enforcing`
    +      xen_args=`echo $xen_args flask_enabled=1 flask_enforcing=1`
           if ${recovery} ; then
              title="$(gettext_quoted "%s, with Xen %s (XSM enabled) and Linux %s (recovery mode)")"
           else
    @@ -137,7 +137,6 @@ EOF
            echo    '$message'
            module  ${rel_dirname}/${xenpolicy}
     EOF
    -  fi
       cat << EOF
     }
     EOF

I think these are bugs in the patch in the grub BTS, which were fixed
while iterating over the XSM series in osstest but didn't make it into
the upstream version, the fixes to those bugs are reverted byu the
above. So I have manually reverted them.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
Wei, if you agree wrt those changes I'll update the bug, or perhaps
you want to?
---
 overlay/etc/grub.d/20_linux_xen | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/overlay/etc/grub.d/20_linux_xen b/overlay/etc/grub.d/20_linux_xen
index 5315e2a..aaead1b 100755
--- a/overlay/etc/grub.d/20_linux_xen
+++ b/overlay/etc/grub.d/20_linux_xen
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Copied from the identically named file in grub-common 1.99-27+deb7u2.
-# This version fixed Debian bug #690538 and GRUB bug #43420.
+# This version fixes GRUB bug #43420.
 
 set -e
 
@@ -173,6 +173,7 @@ while [ "x${xen_list}" != "x" ] ; do
     xen_dirname=`dirname ${current_xen}`
     rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname`
     xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"`
+    echo "submenu \"Xen ${xen_version}\" {"
     while [ "x$list" != "x" ] ; do
 	linux=`version_find_latest $list`
 	echo "Found linux image: $linux" >&2
@@ -214,5 +215,6 @@ while [ "x${xen_list}" != "x" ] ; do
 
 	list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
     done
+    echo "}"
     xen_list=`echo $xen_list | tr ' ' '\n' | grep -vx $current_xen | tr '\n' ' '`
 done
-- 
2.1.4



[-- Attachment #2: grub.v2.patch --]
[-- Type: text/x-patch, Size: 2670 bytes --]

--- /home/ianc/tmp/x/etc/grub.d/20_linux_xen	2013-07-03 04:39:20.000000000 +0100
+++ overlay/etc/grub.d/20_linux_xen	2015-04-21 11:09:57.777812773 +0100
@@ -81,10 +85,27 @@
   recovery="$4"
   args="$5"
   xen_args="$6"
-  if ${recovery} ; then
-    title="$(gettext_quoted "%s, with Xen %s and Linux %s (recovery mode)")"
+  xsm="$7"
+  # If user wants to enable XSM support, make sure there's
+  # corresponding policy file.
+  if ${xsm} ; then
+      xenpolicy=`echo xenpolicy-$xen_version`
+      if test ! -e "${xen_dirname}/${xenpolicy}" ; then
+	  return
+      fi
+      xen_args=`echo $xen_args flask=enforcing`
+      if ${recovery} ; then
+	  title="$(gettext_quoted "%s, with Xen %s (XSM enabled) and Linux %s (recovery mode)")"
+      else
+	  title="$(gettext_quoted "%s, with Xen %s (XSM enabled) and Linux %s")"
+      fi
   else
-    title="$(gettext_quoted "%s, with Xen %s and Linux %s")"
+      xenpolicy=""
+      if ${recovery} ; then
+	  title="$(gettext_quoted "%s, with Xen %s and Linux %s (recovery mode)")"
+      else
+	  title="$(gettext_quoted "%s, with Xen %s and Linux %s")"
+      fi
   fi
   printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${xen_version}" "${version}"
   if ! ${recovery} ; then
@@ -110,6 +131,13 @@
 	module	${rel_dirname}/${initrd}
 EOF
   fi
+  if test -n "${xenpolicy}" ; then
+    message="$(gettext_printf "Loading XSM policy ...")"
+    cat << EOF
+	echo	'$message'
+	module	${rel_dirname}/${xenpolicy}
+EOF
+  fi
   cat << EOF
 }
 EOF
@@ -133,7 +161,7 @@
 if [ "x${linux_list}" = "x" ] ; then
     exit 0
 fi
-xen_list=`for i in /boot/xen*; do
+xen_list=`for i in /boot/xen[-.]*; do
         if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
       done`
 prepare_boot_cache=
@@ -175,10 +203,14 @@
 	fi
 
 	linux_entry "${OS}" "${version}" "${xen_version}" false \
-	    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
+	    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" false
+	linux_entry "${OS}" "${version}" "${xen_version}" false \
+	    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" true
 	if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
 	    linux_entry "${OS}" "${version}" "${xen_version}" true \
-		"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"
+		"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" false
+	    linux_entry "${OS}" "${version}" "${xen_version}" true \
+		"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" true
 	fi
 
 	list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

  reply	other threads:[~2015-04-21 10:12 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 21:19 [OSSTEST Nested PATCH v8 0/7] Introduction of netsted HVM test job longtao.pang
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 1/7] parsing grub which has 'submenu' primitive longtao.pang
2015-04-21 10:12   ` Ian Campbell [this message]
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 2/7] Changes to support '/boot' leading paths of kernel, xen, in grub longtao.pang
2015-04-21 10:13   ` Ian Campbell
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 3/7] Edit some APIs in TestSupport.pm for nested test longtao.pang
2015-04-21 10:19   ` Ian Campbell
2015-04-21 12:33     ` Ian Jackson
2015-04-21 12:53       ` Ian Campbell
2015-04-21 13:28         ` Ian Jackson
2015-04-21 13:41           ` Ian Campbell
2015-04-21 14:30             ` Ian Jackson
2015-04-21 14:43               ` Ian Campbell
2015-04-22  8:25                 ` Pang, LongtaoX
2015-04-22  9:48                   ` Ian Campbell
2015-04-22 12:50                     ` Ian Jackson
2015-04-23  0:34                       ` Hu, Robert
2015-04-27  9:36                         ` Robert Hu
2015-04-28  7:41                           ` Ian Campbell
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 4/7] Changes on test step of Debian hvm guest install longtao.pang
2015-04-21 10:28   ` Ian Campbell
2015-04-23  5:59     ` Robert Hu
2015-04-23  6:52       ` Ian Campbell
2015-04-23 10:43         ` Hu, Robert
2015-04-23 12:04           ` Ian Campbell
2015-04-23 11:07         ` Ian Jackson
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 5/7] Add new script to customize nested test configuration longtao.pang
2015-04-21 10:40   ` Ian Campbell
2015-04-22  8:35     ` Pang, LongtaoX
2015-04-22  9:56       ` Ian Campbell
2015-04-23  9:38         ` Robert Hu
2015-04-23 11:30           ` Ian Campbell
2015-04-23 13:05             ` Ian Campbell
2015-04-24  8:45             ` Pang, LongtaoX
2015-04-28  7:39               ` Ian Campbell
2015-04-23  7:27     ` Pang, LongtaoX
2015-04-23 11:35       ` Ian Campbell
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 6/7] Compose the main recipe of nested test job longtao.pang
2015-04-21 10:48   ` Ian Campbell
2015-04-22  8:38     ` Pang, LongtaoX
2015-04-22 11:04       ` Ian Campbell
2015-04-22 11:23         ` Ian Campbell
2015-04-23  8:08           ` Pang, LongtaoX
2015-04-23 11:05             ` Ian Jackson
2015-04-24  6:31               ` Robert Hu
2015-04-23 10:49           ` Robert Hu
2015-04-13 21:19 ` [OSSTEST Nested PATCH v8 7/7] Add test job for nest test case longtao.pang
2015-04-21 10:51   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429611171.4743.16.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=longtaox.pang@intel.com \
    --cc=robert.hu@intel.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.