]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
setupboot_grub2: Copy hv command line from grub to xen.cfg
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 27 May 2020 15:16:52 +0000 (16:16 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Mon, 8 Jun 2020 15:33:28 +0000 (16:33 +0100)
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

index de53c1acd7ab57a86800ec71bb145c3647f09e6e..c18bf718f2782a6903db36fb3337256cfe153c6a 100644 (file)
@@ -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};