From 0c25931b13d8d3a9c72ad3f55a457389dee8d0bb Mon Sep 17 00:00:00 2001 From: Nikita Dubrovskii Date: Mon, 3 Feb 2025 12:51:11 +0100 Subject: [PATCH] zipl: remove 'sdboot' image before generating new one --- src/libostree/ostree-bootloader-zipl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libostree/ostree-bootloader-zipl.c b/src/libostree/ostree-bootloader-zipl.c index f0c18cbcfc..bfa7823f83 100644 --- a/src/libostree/ostree-bootloader-zipl.c +++ b/src/libostree/ostree-bootloader-zipl.c @@ -22,10 +22,12 @@ #include "ostree-libarchive-private.h" #include "ostree-sysroot-private.h" #include "otutil.h" +#include #include #include #include #include +#include #define SECURE_EXECUTION_SYSFS_FLAG "/sys/firmware/uv/prot_virt_guest" #define SECURE_EXECUTION_PARTITION "/dev/disk/by-label/se" @@ -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");