summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>2022-03-03 11:42:41 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2022-03-03 23:14:45 +0000
commit178d598b5fae36fa9d54c30668771f9c626724f6 (patch)
tree5c73b7f445912c1495ab38db58655cc21186d8d1
parentf05a288135efb880c6233863c8525dcc2abe9159 (diff)
downloadsystemd-178d598b5fae36fa9d54c30668771f9c626724f6.tar.gz
sd-stub: do not print warning if filesystem is not supported
Do not print a warning in case we try to load the file system protocol for an unsupported file system, just return EFI_SUCCESS instead.
-rw-r--r--src/boot/efi/cpio.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/boot/efi/cpio.c b/src/boot/efi/cpio.c
index 258755366e..2855c4119b 100644
--- a/src/boot/efi/cpio.c
+++ b/src/boot/efi/cpio.c
@@ -324,6 +324,7 @@ EFI_STATUS pack_cpio(
_cleanup_freepool_ void *buffer = NULL;
UINT32 inode = 1; /* inode counter, so that each item gets a new inode */
EFI_STATUS err;
+ EFI_FILE_IO_INTERFACE *volume;
assert(loaded_image);
assert(target_dir_prefix);
@@ -336,9 +337,24 @@ EFI_STATUS pack_cpio(
return EFI_SUCCESS;
}
- root = LibOpenRoot(loaded_image->DeviceHandle);
- if (!root)
- return log_error_status_stall(EFI_LOAD_ERROR, L"Unable to open root directory.");
+ err = BS->HandleProtocol(loaded_image->DeviceHandle,
+ &FileSystemProtocol, (void*)&volume);
+ /* Error will be unsupported if the bootloader doesn't implement the
+ * file system protocol on its file handles.
+ */
+ if (err == EFI_UNSUPPORTED) {
+ *ret_buffer = NULL;
+ *ret_buffer_size = 0;
+ return EFI_SUCCESS;
+ }
+ if (EFI_ERROR(err))
+ return log_error_status_stall(
+ err, L"Unable to load file system protocol: %r", err);
+
+ err = volume->OpenVolume(volume, &root);
+ if (EFI_ERROR(err))
+ return log_error_status_stall(
+ err, L"Unable to open root directory: %r", err);
if (!dropin_dir)
dropin_dir = rel_dropin_dir = xpool_print(L"%D.extra.d", loaded_image->FilePath);