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

[Xen-devel] [PATCH OSSTEST v2 06/19] ts-host-install: Support UEFI PXE boot using grub.efi



Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 Osstest/TestSupport.pm | 37 ++++++++++++++++++++++++++++++++++++-
 README                 |  1 +
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 622f44d..1164a11 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -898,7 +898,7 @@ sub selecthost ($) {
     $ho->{Tftp} = { };
     $ho->{Tftp}{$_} = $c{"Tftp${_}_${tftpscope}"} || $c{"Tftp${_}"}
         foreach qw(Path TmpDir PxeDir PxeGroup PxeTemplates PxeTemplatesReal
-                   DiBase);
+                   DiBase GrubBase);
 
     #----- finalise -----
 
@@ -2138,6 +2138,41 @@ END
 sub setup_uboot_pxeboot ($$$$$;%) { return &setup_bios_pxeboot; }
 sub setup_uboot_pxeboot_local ($) { return &setup_bios_pxeboot_local; }
 
+sub setup_grub_efi_bootcfg ($$) {
+    my ($ho, $bootfile) = @_;
+    my $f = "grub.cfg-$ho->{Ether}";
+    my $grub= 
$ho->{Tftp}{Path}.'/'.$ho->{Tftp}{GrubBase}.'/'.$c{TftpGrubVersion}.
+       "/pxegrub-$r{arch}.efi";
+    my $pxe=$ho->{Tftp}{Path}.'/'.$ho->{Name}.'/pxe.img';
+
+    logm("Copy $grub => $pxe");
+    copy($grub, $pxe) or die "Copy $grub to $pxe failed: $!";
+
+    logm("grub_efi bootcfg into $f");
+    file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{TmpDir}$f", $bootfile,
+                      "$ho->{Name}-pxegrub.cfg");
+}
+
+# UEFI systems PXE boot using grub.efi
+sub setup_uefi_pxeboot ($$$$$;%) {
+    my ($ho,$kern,$initrd,$dicmd,$hocmd,%xopts) = @_;
+    setup_grub_efi_bootcfg($ho, <<END);
+set default=0
+set timeout=5
+menuentry 'overwrite' {
+  linux $kern $dicmd -- $hocmd
+  initrd $initrd
+}
+END
+}
+
+sub setup_uefi_pxeboot_local ($) {
+    my ($ho) = @_;
+    setup_grub_efi_bootcfg($ho, <<END);
+echo Should do a local boot here, somehow
+END
+}
+
 sub setup_pxeboot_local ($) {
     my ($ho) = @_;
     my $firmware = get_host_property($ho, "firmware", "bios");
diff --git a/README b/README
index 503d15d..1351f49 100644
--- a/README
+++ b/README
@@ -455,6 +455,7 @@ TftpFoo_<scope> and TftpFoo
 
         DiBase        The path under `Path' to the root of the debian installer
                       images.
+        GrubBase      The path under `Path' to the root of the grub EFI PXE 
images.
 
     For hosts in scope "default", TftpFoo_default (if set) takes
     precedence over TftpFoo.  TftpFoo is used when the setting Foo is
-- 
2.1.4


_______________________________________________
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®.