diff mbox series

[03/10] make GRUB_LINUX_MAGIC_SIGNATURE architecture-specific

Message ID 20180201181858.1472-4-leif.lindholm@linaro.org
State Accepted
Commit 3245f02d9d7274e942426541cf73dc73e7298f02
Headers show
Series various cleanup | expand

Commit Message

Leif Lindholm Feb. 1, 2018, 6:18 p.m. UTC
Rename GRUB_LINUX_MAGIC_SIGNATURE GRUB_LINUX_I386_MAGIC_SIGNATURE,
to be usable in code that supports more than one image type.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

---
 grub-core/commands/file.c        | 4 ++--
 grub-core/loader/i386/linux.c    | 2 +-
 grub-core/loader/i386/pc/linux.c | 6 +++---
 grub-core/loader/i386/xen_file.c | 2 +-
 include/grub/i386/linux.h        | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.11.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Daniel Kiper Feb. 15, 2018, 10:05 a.m. UTC | #1
On Thu, Feb 01, 2018 at 06:18:51PM +0000, Leif Lindholm wrote:
> Rename GRUB_LINUX_MAGIC_SIGNATURE GRUB_LINUX_I386_MAGIC_SIGNATURE,


Missing "to" between GRUB_LINUX_MAGIC_SIGNATURE and GRUB_LINUX_I386_MAGIC_SIGNATURE.
I will fix it during commit.

> to be usable in code that supports more than one image type.

>

> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>


Otherwise Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Leif Lindholm Feb. 15, 2018, 10:39 a.m. UTC | #2
On Thu, Feb 15, 2018 at 11:05:16AM +0100, Daniel Kiper wrote:
> On Thu, Feb 01, 2018 at 06:18:51PM +0000, Leif Lindholm wrote:

> > Rename GRUB_LINUX_MAGIC_SIGNATURE GRUB_LINUX_I386_MAGIC_SIGNATURE,

> 

> Missing "to" between GRUB_LINUX_MAGIC_SIGNATURE and

> GRUB_LINUX_I386_MAGIC_SIGNATURE.


Both forms are valid (it wasn't a typo).

> I will fix it during commit.


But I don't mind if you change it :)

> > to be usable in code that supports more than one image type.

> >

> > Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

> 

> Otherwise Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>


Thanks!

/
    Leif

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Daniel Kiper Feb. 15, 2018, 10:42 a.m. UTC | #3
On Thu, Feb 15, 2018 at 10:39:38AM +0000, Leif Lindholm wrote:
> On Thu, Feb 15, 2018 at 11:05:16AM +0100, Daniel Kiper wrote:

> > On Thu, Feb 01, 2018 at 06:18:51PM +0000, Leif Lindholm wrote:

> > > Rename GRUB_LINUX_MAGIC_SIGNATURE GRUB_LINUX_I386_MAGIC_SIGNATURE,

> >

> > Missing "to" between GRUB_LINUX_MAGIC_SIGNATURE and

> > GRUB_LINUX_I386_MAGIC_SIGNATURE.

>

> Both forms are valid (it wasn't a typo).


OK, thanks.

> > I will fix it during commit.

>

> But I don't mind if you change it :)


I will leave it then.

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
diff mbox series

Patch

diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c
index 12fba99e0..474666d3a 100644
--- a/grub-core/commands/file.c
+++ b/grub-core/commands/file.c
@@ -508,7 +508,7 @@  grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
 
 	/* FIXME: some really old kernels (< 1.3.73) will fail this.  */
 	if (lh.header !=
-	    grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
+	    grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE)
 	    || grub_le_to_cpu16 (lh.version) < 0x0200)
 	  break;
 
@@ -521,7 +521,7 @@  grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
 	/* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and
 	   still not support 32-bit boot.  */
 	if (lh.header !=
-	    grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
+	    grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE)
 	    || grub_le_to_cpu16 (lh.version) < 0x0203)
 	  break;
 
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 083f9417c..9bd5afb65 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -721,7 +721,7 @@  grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and
      still not support 32-bit boot.  */
-  if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
+  if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE)
       || grub_le_to_cpu16 (lh.version) < 0x0203)
     {
       grub_error (GRUB_ERR_BAD_OS, "version too old for 32-bit boot"
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
index a293b17aa..31a687644 100644
--- a/grub-core/loader/i386/pc/linux.c
+++ b/grub-core/loader/i386/pc/linux.c
@@ -169,7 +169,7 @@  grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   maximal_cmdline_size = 256;
 
-  if (lh.header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
+  if (lh.header == grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE)
       && grub_le_to_cpu16 (lh.version) >= 0x0200)
     {
       grub_linux_is_bzimage = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL);
@@ -322,7 +322,7 @@  grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
       goto fail;
     }
 
-  if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
+  if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE)
       || grub_le_to_cpu16 (lh.version) < 0x0200)
     /* Clear the heap space.  */
     grub_memset (grub_linux_real_chunk
@@ -407,7 +407,7 @@  grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   lh = (struct linux_kernel_header *) grub_linux_real_chunk;
 
-  if (!(lh->header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
+  if (!(lh->header == grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE)
 	&& grub_le_to_cpu16 (lh->version) >= 0x0200))
     {
       grub_error (GRUB_ERR_BAD_OS, "the kernel is too old for initrd");
diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c
index 99fad4cad..6e76e16aa 100644
--- a/grub-core/loader/i386/xen_file.c
+++ b/grub-core/loader/i386/xen_file.c
@@ -43,7 +43,7 @@  grub_xen_file (grub_file_t file)
     goto fail;
 
   if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)
-      || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
+      || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE)
       || grub_le_to_cpu16 (lh.version) < 0x0208)
     {
       grub_error (GRUB_ERR_BAD_OS, "version too old for xen boot");
diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
index 2ff1621a4..3ff432be9 100644
--- a/include/grub/i386/linux.h
+++ b/include/grub/i386/linux.h
@@ -19,7 +19,7 @@ 
 #ifndef GRUB_I386_LINUX_HEADER
 #define GRUB_I386_LINUX_HEADER	1
 
-#define GRUB_LINUX_MAGIC_SIGNATURE	0x53726448      /* "HdrS" */
+#define GRUB_LINUX_I386_MAGIC_SIGNATURE	0x53726448      /* "HdrS" */
 #define GRUB_LINUX_DEFAULT_SETUP_SECTS	4
 #define GRUB_LINUX_INITRD_MAX_ADDRESS	0x37FFFFFF
 #define GRUB_LINUX_MAX_SETUP_SECTS	64