]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
ts-host-install: Support UEFI PXE boot using grub.efi
authorIan Campbell <ian.campbell@citrix.com>
Tue, 27 Jan 2015 12:06:41 +0000 (12:06 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 26 Jun 2015 15:39:04 +0000 (16:39 +0100)
Handling of chainloading from the local hdd in
setup_pxeboot_local_uefi will be added in the next patch.

(Wrap DiBase entry in README too for consistency)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v4: Turn grub "echo todo" into a die.
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
README

index 512efd2b33508838cbbc6eebfe2143a092803bfc..2188ccae26f67f92f0a5082207bbf68706f4ff13 100644 (file)
@@ -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,39 @@ 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) = @_;
+    die "TODO: setup efi local boot";
+}
+
 sub setup_pxeboot_local ($) {
     my ($ho) = @_;
     my $firmware = get_host_property($ho, "firmware", "bios");
diff --git a/README b/README
index 8e8205530cea7166ab7845e1b4a53f84971491dd..56d590b96040a70cbb0257906b5129165e03acd5 100644 (file)
--- a/README
+++ b/README
@@ -458,8 +458,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