From: Ian Jackson Date: Wed, 18 Jan 2017 15:49:56 +0000 (+0000) Subject: netboot: UEFI grub: Do it more like pxe X-Git-Tag: openstack-v11~131 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=112d5f794db09cd9fc4d2d8fea1660b2c82b10df;p=people%2Faperard%2Fosstest.git netboot: UEFI grub: Do it more like pxe * Abolish setup_grub_efi_bootcfg and use setup_netboot_bootcfg instead. The latter function now expects to be given a config file for the host's bootloader. For a UEFI host, that's a grub config file, which it will write to the configured NetGrub location for the specific host. * Consequently, we no longer copy an actual grub image around every time we do a bootloader setup. Instead, we expect that the tftp server will be configured to point relevant hosts at a suitable fixed image, which will go to our config file. * Also, consequently, write the NetGrubTemplate path when we want to setup the bootloader, rather than the ad-hoc grub-%ether%. * Update mg-netgrub-loader-update jessie so that it writes the NetGrubTemplateReal from the config into the grub.cfg so that the grub image will read that file and then read the file created by setup_netboot_bootcfg. * Document this in its head comment. Currently this new mg-netgrub-loader-update is untested because jessie i386 grub (which is what we would run on the osstest controllers) does not understand the arm64-efi target. But the new Netgrub.cfg location is in use. Signed-off-by: Ian Jackson --- diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index bd67b378..c900df02 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -2468,25 +2468,10 @@ END sub setup_netboot_di_uboot ($$$$$;%) { return &setup_netboot_di_bios; } sub setup_netboot_local_uboot ($) { return &setup_netboot_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 $img=$ho->{Tftp}{Path}.'/'.hostnamepath($ho).'/pxe.img'; - - logm("Copy $grub => $img"); - copy($grub, $img) or die "Copy $grub to $img failed: $!"; - - logm("grub_efi bootcfg into $f"); - file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{TmpDir}$f", - $bootfile, hostnamepath($ho)."-pxegrub.cfg"); -} - # UEFI systems netboot using grub.efi sub setup_netboot_di_uefi ($$$$$;%) { my ($ho,$kern,$initrd,$dicmd,$hocmd,%xopts) = @_; - setup_grub_efi_bootcfg($ho, < qw(${net_default_mac}) }, + $k; + print $file, "\n" or die $!; +') + mkdir -p $dstroot cd $dstroot mkdir -p $dst