Skip to content

Commit

Permalink
zipl: remove 'sdboot' image before generating new one
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-dubrovskii committed Feb 3, 2025
1 parent 968b0b1 commit 0c25931
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libostree/ostree-bootloader-zipl.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
#include "ostree-libarchive-private.h"
#include "ostree-sysroot-private.h"
#include "otutil.h"
#include <fcntl.h>
#include <gio/gunixinputstream.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <unistd.h>

#define SECURE_EXECUTION_SYSFS_FLAG "/sys/firmware/uv/prot_virt_guest"
#define SECURE_EXECUTION_PARTITION "/dev/disk/by-label/se"
Expand Down Expand Up @@ -354,6 +356,12 @@ _ostree_secure_execution_generate_sdboot (gchar *vmlinuz, gchar *initramfs, gcha
return FALSE;
g_autofree gchar *ramdisk_filename = g_strdup_printf ("/proc/%d/fd/%d", self, ramdisk.fd);

// Since s390-tools commit f4cf4ae6ebb1 (Remove genprotimg-C and switch to genprotimg-Rust
// implementation) 'genprotimg' is just a symlink to 'pvimg create', which by default doesn't
// overwrite the output image, but introduces the '--overwrite' flag for this. Let's silently
// remove the file to support both tools
(void)unlink (SECURE_EXECUTION_BOOT_IMAGE);

g_autoptr (GPtrArray) argv = g_ptr_array_new ();
g_ptr_array_add (argv, "genprotimg");
g_ptr_array_add (argv, "-i");
Expand Down

0 comments on commit 0c25931

Please sign in to comment.