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

[Xen-devel] [PATCH OSSTEST v3 08/22] ts-host-install: Support UEFI PXE boot using grub.efi



(Wrap DiBase entry in README too for consistency)

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
v3: Reindent README (fix DiBase too for consistency)
    Adjust for reordering of setup_{firmware}_pxeboot to put
      {firmware} at end
    Rewrap setup_grub_efi_bootcfg
    Adjust for setup_pxeboot -> setup_pxeboot_di
---
 Osstest/TestSupport.pm | 37 ++++++++++++++++++++++++++++++++++++-
 README                 |  6 ++++--
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 512efd2..94a7c27 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_pxeboot_di_uboot ($$$$$;%) { return &setup_pxeboot_di_bios; }
 sub setup_pxeboot_local_uboot ($) { return &setup_pxeboot_local_bios; }
 
+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_pxeboot_di_uefi ($$$$$;%) {
+    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_pxeboot_local_uefi ($) {
+    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..0f503c5 100644
--- a/README
+++ b/README
@@ -453,8 +453,10 @@ TftpFoo_<scope> and TftpFoo
         PxeTemplates  See TftpPxeTemplates
         PxeTemplatesReal
 
-        DiBase        The path under `Path' to the root of the debian installer
-                      images.
+        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®.