commands/file: Use definitions from arm/linux.h
Clean up code for matching IS_ARM slightly by making use of struct linux_arm_kernel_header and GRUB_LINUX_ARM_MAGIC_SIGNATURE. Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
14a3a29839
commit
c110582e72
1 changed files with 8 additions and 9 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include <grub/elf.h>
|
#include <grub/elf.h>
|
||||||
#include <grub/xen_file.h>
|
#include <grub/xen_file.h>
|
||||||
#include <grub/efi/pe32.h>
|
#include <grub/efi/pe32.h>
|
||||||
|
#include <grub/arm/linux.h>
|
||||||
#include <grub/i386/linux.h>
|
#include <grub/i386/linux.h>
|
||||||
#include <grub/xnu.h>
|
#include <grub/xnu.h>
|
||||||
#include <grub/machoload.h>
|
#include <grub/machoload.h>
|
||||||
|
@ -383,21 +384,19 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
}
|
}
|
||||||
case IS_ARM_LINUX:
|
case IS_ARM_LINUX:
|
||||||
{
|
{
|
||||||
grub_uint32_t sig, sig_pi;
|
struct linux_arm_kernel_header lh;
|
||||||
if (grub_file_read (file, &sig_pi, 4) != 4)
|
|
||||||
|
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
|
||||||
break;
|
break;
|
||||||
/* Raspberry pi. */
|
/* Short forward branch in A32 state (for Raspberry pi kernels). */
|
||||||
if (sig_pi == grub_cpu_to_le32_compile_time (0xea000006))
|
if (lh.code0 == grub_cpu_to_le32_compile_time (0xea000006))
|
||||||
{
|
{
|
||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grub_file_seek (file, 0x24) == (grub_size_t) -1)
|
if (lh.magic ==
|
||||||
break;
|
grub_cpu_to_le32_compile_time (GRUB_LINUX_ARM_MAGIC_SIGNATURE))
|
||||||
if (grub_file_read (file, &sig, 4) != 4)
|
|
||||||
break;
|
|
||||||
if (sig == grub_cpu_to_le32_compile_time (0x016f2818))
|
|
||||||
{
|
{
|
||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue