mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-26 17:19:22 +00:00
arm/linux: Unify ARM/arm64 vs Xen PE/COFF header handling
Xen has its own version of the image header, to account for the additional PE/COFF header fields. Since we are adding references to those in the shared EFI loader code, update the common definitions and drop the Xen specific one which no longer has a purpose. Since in both cases, the call to grub_arch_efi_linux_check_image() is preceded by a load of the image header, let's move the load into that function, and rename it to grub_arch_efi_linux_load_image_header(). Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
6d7bb89efa
commit
b040285628
5 files changed
+21
-25
No files matched your search
@@ -49,8 +49,13 @@ static grub_addr_t initrd_start;
|
||||
static grub_addr_t initrd_end;
|
||||
|
||||
grub_err_t
|
||||
grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh)
|
||||
grub_arch_efi_linux_load_image_header (grub_file_t file,
|
||||
struct linux_arch_kernel_header * lh)
|
||||
{
|
||||
grub_file_seek (file, 0);
|
||||
if (grub_file_read (file, lh, sizeof (*lh)) < (grub_ssize_t) sizeof (*lh))
|
||||
return grub_error(GRUB_ERR_FILE_READ_ERROR, "failed to read Linux image header");
|
||||
|
||||
if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
|
||||
@@ -301,10 +306,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
kernel_size = grub_file_size (file);
|
||||
|
||||
if (grub_file_read (file, &lh, sizeof (lh)) < (long) sizeof (lh))
|
||||
return grub_errno;
|
||||
|
||||
if (grub_arch_efi_linux_check_image (&lh) != GRUB_ERR_NONE)
|
||||
if (grub_arch_efi_linux_load_image_header (file, &lh) != GRUB_ERR_NONE)
|
||||
goto fail;
|
||||
|
||||
grub_loader_unset();
|
||||
|
||||
Reference in new issue
Block a user