Merge pull request #1937 from cgwalters/zipl-backend

bootloader: Add a zipl bootloader backend
This commit is contained in:
OpenShift Merge Robot authored and GitHub committed 2019-10-16 17:21:10 +02:00
commit 38729a4f90
7 files changed
+233 -2

No files matched your search

+20 -1
View File
@@ -43,6 +43,7 @@
#include "ostree.h"
#include "ostree-sysroot-private.h"
#include "ostree-sepolicy-private.h"
#include "ostree-bootloader-zipl.h"
#include "ostree-deployment-private.h"
#include "ostree-core-private.h"
#include "ostree-linuxfsutil.h"
@@ -1829,6 +1830,7 @@ prepare_new_bootloader_link (OstreeSysroot *sysroot,
/* Update the /boot/loader symlink to point to /boot/loader.$new_bootversion */
static gboolean
swap_bootloader (OstreeSysroot *sysroot,
OstreeBootloader *bootloader,
int current_bootversion,
int new_bootversion,
GCancellable *cancellable,
@@ -1862,6 +1864,15 @@ swap_bootloader (OstreeSysroot *sysroot,
if (fsync (boot_dfd) != 0)
return glnx_throw_errno_prefix (error, "fsync(boot)");
/* TODO: In the future also execute this automatically via a systemd unit
* if we detect it's necessary.
**/
if (bootloader)
{
if (!_ostree_bootloader_post_bls_sync (bootloader, cancellable, error))
return FALSE;
}
return TRUE;
}
@@ -2128,7 +2139,7 @@ write_deployments_bootswap (OstreeSysroot *self,
if (!full_system_sync (self, out_syncstats, cancellable, error))
return FALSE;
if (!swap_bootloader (self, self->bootversion, new_bootversion,
if (!swap_bootloader (self, bootloader, self->bootversion, new_bootversion,
cancellable, error))
return FALSE;
@@ -2355,6 +2366,14 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot *self,
{
/* No bootloader specified; do not query bootloaders to run. */
}
else if (g_str_equal (bootloader_config, "zipl"))
{
/* Because we do not mark zipl as active by default, lets creating one here,
* which is basically the same what _ostree_sysroot_query_bootloader() does
* for other bootloaders if being activated.
* */
bootloader = (OstreeBootloader*) _ostree_bootloader_zipl_new (self);
}
bootloader_is_atomic = bootloader != NULL && _ostree_bootloader_is_atomic (bootloader);