When invoking a kernel via the UEFI shim, the kernel image must be
accessible via EFI_SIMPLE_FILE_SYSTEM_PROTOCOL but must not be present
in the magic initrd constructed from all registered images.
Re-register a currently executing EFI image and mark it as hidden,
thereby allowing it to be accessed via the virtual filesystem exposed
via EFI_SIMPLE_FILE_SYSTEM_PROTOCOL without appearing in the magic
initrd contents.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
EFI_HANDLE handle;
EFI_MEMORY_TYPE type;
wchar_t *cmdline;
+ unsigned int toggle;
EFI_STATUS efirc;
int rc;
goto err_no_snpdev;
}
+ /* Re-register as a hidden image to allow for access via file I/O */
+ toggle = ( ~image->flags & IMAGE_HIDDEN );
+ image->flags |= IMAGE_HIDDEN;
+ if ( ( rc = register_image ( image ) ) != 0 )
+ goto err_register_image;
+
/* Install file I/O protocols */
if ( ( rc = efi_file_install ( snpdev->handle ) ) != 0 ) {
DBGC ( image, "EFIIMAGE %s could not install file protocol: "
err_pxe_install:
efi_file_uninstall ( snpdev->handle );
err_file_install:
+ unregister_image ( image );
+ err_register_image:
+ image->flags ^= toggle;
err_no_snpdev:
return rc;
}