xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xen.org
Cc: Wei Liu <wei.liu2@citrix.com>,
	dgdegra@tycho.nsa.gov, ian.jackson@eu.citrix.com,
	ian.campbell@citrix.com
Subject: [OSSTEST PATCH RFC v1 06/12] Debian.pm: pass in XSM configuration to bootloader setup routines
Date: Mon, 22 Sep 2014 15:11:55 +0100	[thread overview]
Message-ID: <1411395121-6528-7-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1411395121-6528-1-git-send-email-wei.liu2@citrix.com>

Change to Uboot will come in another patch. GRUB 1 is ignored, as
currently OSSTest only has Wheezy which has GRUB 2.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 Osstest/Debian.pm |   32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index ab09abb..4092351 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -45,9 +45,9 @@ BEGIN {
 
 #---------- manipulation of Debian bootloader setup ----------
 
-sub debian_boot_setup ($$$$;$) {
+sub debian_boot_setup ($$$$$;$) {
     # $xenhopt==undef => is actually a guest, do not set up a hypervisor
-    my ($ho, $want_kernver, $xenhopt, $distpath, $hooks) = @_;
+    my ($ho, $want_kernver, $want_xsm, $xenhopt, $distpath, $hooks) = @_;
 
     target_kernkind_check($ho);
     target_kernkind_console_inittab($ho,$ho,"/");
@@ -72,11 +72,11 @@ sub debian_boot_setup ($$$$;$) {
 
     my $bootloader;
     if ( $ho->{Flags}{'need-uboot-bootscr'} ) {
-	$bootloader= setupboot_uboot($ho, $want_kernver, $xenhopt, $kopt);
+	$bootloader= setupboot_uboot($ho, $want_kernver, $want_xsm, $xenhopt, $kopt);
     } elsif ($ho->{Suite} =~ m/lenny/) {
-        $bootloader= setupboot_grub1($ho, $want_kernver, $xenhopt, $kopt);
+        $bootloader= setupboot_grub1($ho, $want_kernver, $want_xsm, $xenhopt, $kopt);
     } else {
-        $bootloader= setupboot_grub2($ho, $want_kernver, $xenhopt, $kopt);
+        $bootloader= setupboot_grub2($ho, $want_kernver, $want_xsm, $xenhopt, $kopt);
     }
 
     $bootloader->{UpdateConfig}($ho);
@@ -112,8 +112,8 @@ sub bl_getmenu_open ($$$) {
     return $f;
 }
 
-sub setupboot_uboot ($$$) {
-    my ($ho,$want_kernver,$xenhopt,$xenkopt) = @_;
+sub setupboot_uboot ($$$$) {
+    my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
 
     $bl->{UpdateConfig}= sub {
@@ -194,13 +194,17 @@ END
     return $bl;
 }
 
-sub setupboot_grub1 ($$$) {
-    my ($ho,$want_kernver,$xenhopt,$xenkopt) = @_;
+sub setupboot_grub1 ($$$$) {
+    my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
 
     my $rmenu= "/boot/grub/menu.lst";
     my $lmenu= "$stash/$ho->{Name}--menu.lst.out";
 
+    if ($want_xsm) {
+	die "Enabling XSM with GRUB is not supported";
+    }
+
     target_editfile_root($ho, $rmenu, sub {
         while (<::EI>) {
             if (m/^## ## Start Default/ ..
@@ -274,8 +278,8 @@ sub setupboot_grub1 ($$$) {
     return $bl;
 }
 
-sub setupboot_grub2 ($$$) {
-    my ($ho,$want_kernver,$xenhopt,$xenkopt) = @_;
+sub setupboot_grub2 ($$$$) {
+    my ($ho,$want_kernver,$want_xsm,$xenhopt,$xenkopt) = @_;
     my $bl= { };
 
     my $rmenu= '/boot/grub/grub.cfg';
@@ -302,6 +306,9 @@ sub setupboot_grub2 ($$$) {
 			 $entry->{KernVer} ne $want_kernver) {
 		    logm("(skipping entry at $entry->{StartLine};".
 			 " kernel $entry->{KernVer}, not $want_kernver)");
+		} elsif ($want_xsm && !defined $entry->{Xenpolicy}) {
+		    logm("(skipping entry at $entry->{StartLine};".
+			 " XSM policy file not present)");
 		} else {
 		    # yes!
 		    last;
@@ -334,6 +341,9 @@ sub setupboot_grub2 ($$$) {
             if (m/^\s*module\s*\/(initrd\S+)/) {
                 $entry->{Initrd}= $1;
             }
+	    if (m/^\s*module\s*\/(xenpolicy\S+)/) {
+                $entry->{Xenpolicy}= $1;
+            }
         }
         die 'grub 2 bootloader entry not found' unless $entry;
 
-- 
1.7.10.4

  parent reply	other threads:[~2014-09-22 14:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-22 14:11 [OSSTEST PATCH RFC v1 00/12] XSM test cases for OSSTest Wei Liu
2014-09-22 14:11 ` [OSSTEST PATCH RFC v1 01/12] README: list chiark-utils-bin as requirement Wei Liu
2014-09-22 14:11 ` [OSSTEST PATCH RFC v1 02/12] gitignore: ignore images directory Wei Liu
2014-09-22 14:11 ` [OSSTEST PATCH RFC v1 03/12] ts-xen-build-prep: install checkpolicy Wei Liu
2014-09-22 14:11 ` [OSSTEST PATCH RFC v1 04/12] ts-xen-build: build with XSM support if requested Wei Liu
2014-09-22 14:11 ` [OSSTEST PATCH RFC v1 05/12] mfi-common: create build-$arch-xsm job Wei Liu
2014-09-24 10:38   ` Ian Campbell
2014-09-24 13:24     ` Wei Liu
2014-09-22 14:11 ` Wei Liu [this message]
2014-09-22 14:11 ` [OSSTEST PATCH RFC v1 07/12] Debian.pm: load flask policy in uboot Wei Liu
2014-09-24 10:39   ` Ian Campbell
2014-09-22 14:11 ` [OSSTEST PATCH RFC v1 08/12] ts-xen-install: install Xen with XSM support if requested Wei Liu
2014-09-24 10:41   ` Ian Campbell
2014-09-24 13:16     ` Wei Liu
2014-09-24 13:21       ` Wei Liu
2014-09-24 13:47         ` Ian Campbell
2014-09-24 13:55           ` Wei Liu
2014-09-22 14:11 ` [OSSTEST PATCH RFC v1 09/12] mfi-common: use XSM build if job name contains -xsm suffix Wei Liu
2014-09-22 14:11 ` [OSSTEST PATCH RFC v1 10/12] make-flight: create XSM test jobs Wei Liu
2014-09-24 11:00   ` Ian Campbell
2014-09-24 13:24     ` Wei Liu
2014-09-22 14:12 ` [OSSTEST PATCH RFC v1 11/12] ts-debian-install: add in seclabel if XSM is enabled Wei Liu
2014-09-24 11:01   ` Ian Campbell
2014-09-24 13:14     ` Wei Liu
2014-09-24 13:45       ` Ian Campbell
2014-09-22 14:12 ` [OSSTEST PATCH RFC v1 12/12] ts-debian-hvm-install: " Wei Liu
2014-09-22 20:23 ` [OSSTEST PATCH RFC v1 00/12] XSM test cases for OSSTest Daniel De Graaf

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=1411395121-6528-7-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).