diff mbox series

[OSSTEST,46/49] setupboot_grub2: Copy hv command line from grub to xen.cfg

Message ID 20200529111945.21394-47-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series Switch to Debian buster (= Debian stable) | expand

Commit Message

Ian Jackson May 29, 2020, 11:19 a.m. UTC
This reuses all of the stuff that update-grub, etc., have put there.

In particular without this we never have flask=enforcing!

We have to do something about the ${xen_rm_opts} that appear in these
entries.  In principle there might be many variable expansions, but in
practice there is only this one It applies only to x86, and this use
of chainloading to xen.efi and reading xen.cfg applies only to arm64.
And anyway we weren't putting it these things in before.  So OK...

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/Debian.pm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index de53c1ac..c18bf718 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -534,10 +534,11 @@  sub setupboot_grub2 ($$$$) {
                 $entry->{Hv}= $1;
                 $entry->{Chainload} = 1;
             }
-            if (m/^\s*multiboot2?\s+(?:\/boot)?\/(xen\-[0-9][-+.0-9a-z]*\S+)/) {
+            if (m/^\s*multiboot2?\s+(?:\/boot)?\/(xen\-[0-9][-+.0-9a-z]*\S+)\s+(.*)/) {
                 die unless $entry;
                 $entry->{Hv}= $1;
                 $entry->{Chainload} = 0;
+		$entry->{HvOpts} = $2;
             }
             if (m/^\s*multiboot2?\s+(?:\/boot)?\/(vmlinu[xz]-(\S+))\s+(.*)/) {
                 die unless $entry;
@@ -575,7 +576,7 @@  sub setupboot_grub2 ($$$$) {
             # Propagate relevant fields of the main entry over to the
             # chain entry for use of subsequent code.
             foreach (qw(KernVer KernDom0 KernOnly KernOpts
-                        Initrd Xenpolicy)) {
+                        Initrd Xenpolicy HvOpts)) {
 		next unless $entry->{$_};
 		die if $chainentry->{$_};
 		$chainentry->{$_} = $entry->{$_};
@@ -604,12 +605,14 @@  sub setupboot_grub2 ($$$$) {
 
 	if ($need_uefi_chainload) {
 	    my $entry= $parsemenu->();
+	    my $hvopts = $entry->{HvOpts};
+	    $hvopts =~ s/\$\{\w+\}//g; # delete these and hope!
 	    my $xencfg = <<END;
 [global]
 default=osstest
 
 [osstest]
-options=$xenhopt
+options=$hvopts
 kernel=vmlinuz $entry->{KernOpts}
 END
             $xencfg .= "ramdisk=initrd.gz\n" if $entry->{Initrd};