[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/10] commands/file: use definitions from arm/linux.h
From: |
Leif Lindholm |
Subject: |
[PATCH 09/10] commands/file: use definitions from arm/linux.h |
Date: |
Thu, 1 Feb 2018 18:18:57 +0000 |
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 <address@hidden>
---
grub-core/commands/file.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c
index 63c84499b..fad191202 100644
--- a/grub-core/commands/file.c
+++ b/grub-core/commands/file.c
@@ -27,6 +27,7 @@
#include <grub/elf.h>
#include <grub/xen_file.h>
#include <grub/efi/pe32.h>
+#include <grub/arm/linux.h>
#include <grub/i386/linux.h>
#include <grub/xnu.h>
#include <grub/machoload.h>
@@ -383,21 +384,18 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char
**args)
}
case IS_ARM_LINUX:
{
- grub_uint32_t sig, sig_pi;
- if (grub_file_read (file, &sig_pi, 4) != 4)
+ struct linux_arm_kernel_header lh;
+ if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
break;
/* Raspberry pi. */
- if (sig_pi == grub_cpu_to_le32_compile_time (0xea000006))
+ if (lh.code0 == grub_cpu_to_le32_compile_time (0xea000006))
{
ret = 1;
break;
}
- if (grub_file_seek (file, 0x24) == (grub_size_t) -1)
- break;
- if (grub_file_read (file, &sig, 4) != 4)
- break;
- if (sig == grub_cpu_to_le32_compile_time (0x016f2818))
+ if (lh.magic ==
+ grub_cpu_to_le32_compile_time (GRUB_LINUX_ARM_MAGIC_SIGNATURE))
{
ret = 1;
break;
--
2.11.0
- Re: [PATCH 03/10] make GRUB_LINUX_MAGIC_SIGNATURE architecture-specific, (continued)
[PATCH 06/10] arm64: align linux kernel magic macro naming with i386, Leif Lindholm, 2018/02/01
[PATCH 07/10] arm: switch linux loader to linux_arm_kernel_header struct, Leif Lindholm, 2018/02/01
[PATCH 10/10] commands/file: use definitions from arm64/linux.h, Leif Lindholm, 2018/02/01
[PATCH 05/10] arm64: align linux kernel header struct naming with i386, Leif Lindholm, 2018/02/01
[PATCH 09/10] commands/file: use definitions from arm/linux.h,
Leif Lindholm <=
[PATCH 08/10] arm: make linux.h safe to include for non-native builds, Leif Lindholm, 2018/02/01
Re: [PATCH 00/10] various cleanup, Daniel Kiper, 2018/02/15