On linux command also it requires to improve the way `StartImage and `LoadImage` is checked.
But first there is things i need to point, while currently the command is did well by printing the hex value of the status of `StartImage` however some UEFI status code documentation is bad and not well documented and some people may experience difficulties for finding out the meaning of the error codes so for most common expectable error codes we need to print descriptive error messages to save them for time and some uncommon print errors on hex. diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c index 78ea07ca8..062a07f9e 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -211,9 +211,15 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) status = b->load_image (0, grub_efi_image_handle, (grub_efi_device_path_t *) mempath, (void *) addr, size, &image_handle); - if (status != GRUB_EFI_SUCCESS) - return grub_error (GRUB_ERR_BAD_OS, "cannot load image"); - + + if (status != GRUB_EFI_SUCCESS) { + if (status == GRUB_EFI_INVALID_PARAMETER) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); + else if (status == GRUB_EFI_OUT_OF_RESOURCES) + return grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of resources"); + else + return grub_error (GRUB_ERR_BAD_OS, "cannot load image 0x%" PRIxGRUB_EFI_UINTN_T, status); + } grub_dprintf ("linux", "linux command line: '%s'\n", args); /* Convert command line to UTF-16. */ @@ -238,7 +244,13 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args) status = b->start_image (image_handle, 0, NULL); /* When successful, not reached */ - grub_error (GRUB_ERR_BAD_OS, "start_image() returned 0x%" PRIxGRUB_EFI_UINTN_T, status); + if (status == GRUB_EFI_INVALID_PARAMETER) + grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); + else if (status == GRUB_EFI_OUT_OF_RESOURCES) + grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory"); + else + grub_error (GRUB_ERR_BAD_OS, "cannot start image 0x%" PRIxGRUB_EFI_UINTN_T, status); + grub_efi_free_pages ((grub_addr_t) loaded_image->load_options, GRUB_EFI_BYTES_TO_PAGES (len)); loaded_image->load_options = NULL; Best regards, khaalid _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel