diff mbox series

[v2,10/14] loader: switch arm/linux to grub_linux_kernel_header struct

Message ID 20170803100432.29913-11-leif.lindholm@linaro.org
State Superseded
Headers show
Series efi: improved correctness, arm unification, and cleanup | expand

Commit Message

Leif Lindholm Aug. 3, 2017, 10:04 a.m. UTC
Use kernel header struct and generic magic definition to align with
arm64/linux loader.

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

---
 grub-core/loader/arm/linux.c | 11 +++++------
 include/grub/arm/linux.h     | 15 ++++++++++++---
 2 files changed, 17 insertions(+), 9 deletions(-)

-- 
2.11.0


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

Comments

Vladimir 'phcoder' Serbinenko Aug. 7, 2017, 2:07 p.m. UTC | #1
Le Thu, Aug 3, 2017 à 12:15 PM, Leif Lindholm <leif.lindholm@linaro.org> a
écrit :

> Use kernel header struct and generic magic definition to align with

> arm64/linux loader.

>

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

> ---

>  grub-core/loader/arm/linux.c | 11 +++++------

>  include/grub/arm/linux.h     | 15 ++++++++++++---

>  2 files changed, 17 insertions(+), 9 deletions(-)

>

> diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c

> index e64c79a95..067f69894 100644

> --- a/grub-core/loader/arm/linux.c

> +++ b/grub-core/loader/arm/linux.c

> @@ -46,9 +46,6 @@ static const void *current_fdt;

>

>  typedef void (*kernel_entry_t) (int, unsigned long, void *);

>

> -#define LINUX_ZIMAGE_OFFSET    0x24

> -#define LINUX_ZIMAGE_MAGIC     0x016f2818

> -

>  #define LINUX_PHYS_OFFSET        (0x00008000)

>  #define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)

>  #define LINUX_FDT_PHYS_OFFSET    (LINUX_INITRD_PHYS_OFFSET - 0x10000)

> @@ -315,6 +312,7 @@ linux_boot (void)

>  static grub_err_t

>  linux_load (const char *filename, grub_file_t file)

>  {

> +  struct grub_linux_kernel_header *lh;

>    int size;

>

>    size = grub_file_size (file);

> @@ -337,9 +335,10 @@ linux_load (const char *filename, grub_file_t file)

>        return grub_errno;

>      }

>

> -  if (size > LINUX_ZIMAGE_OFFSET + 4

> -      && *(grub_uint32_t *) (linux_addr + LINUX_ZIMAGE_OFFSET)

> -      == LINUX_ZIMAGE_MAGIC)

> +  lh = (void *) linux_addr;

> +

> +  if ((grub_size_t) size > sizeof (*lh) &&

> +      lh->magic == GRUB_LINUX_MAGIC_SIGNATURE)

>      ;

>    else if (size > 0x8000 && *(grub_uint32_t *) (linux_addr) == 0xea000006

>            && machine_type == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)

> diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h

> index f217f8281..802090239 100644

> --- a/include/grub/arm/linux.h

> +++ b/include/grub/arm/linux.h

> @@ -20,11 +20,20 @@

>  #ifndef GRUB_LINUX_CPU_HEADER

>  #define GRUB_LINUX_CPU_HEADER 1

>

> -#define LINUX_ZIMAGE_OFFSET 0x24

> -#define LINUX_ZIMAGE_MAGIC  0x016f2818

> -

>  #include "system.h"

>

> +#define GRUB_LINUX_MAGIC_SIGNATURE 0x016f2818

> +

> +struct grub_linux_kernel_header {

>

This maz clash with other architectures preventing including several
architecture files in the same file. We need it to create tools like
grub-file .

> +  grub_uint32_t code0;

> +  grub_uint32_t reserved1[8];

> +  grub_uint32_t magic;

> +  grub_uint32_t start; /* _start */

> +  grub_uint32_t end;   /* _edata */

> +  grub_uint32_t reserved2[4];

> +  grub_uint32_t hdr_offset;

> +};

> +

>  #if defined GRUB_MACHINE_UBOOT

>  # include <grub/uboot/uboot.h>

>  # define LINUX_ADDRESS        (start_of_ram + 0x8000)

> --

> 2.11.0

>

>

> _______________________________________________

> Grub-devel mailing list

> Grub-devel@gnu.org

> https://lists.gnu.org/mailman/listinfo/grub-devel

>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Leif Lindholm Sept. 4, 2017, 2:31 p.m. UTC | #2
On Mon, Aug 07, 2017 at 02:07:19PM +0000, Vladimir 'phcoder' Serbinenko wrote:
> Le Thu, Aug 3, 2017 à 12:15 PM, Leif Lindholm <leif.lindholm@linaro.org> a

> écrit :

> 

> > Use kernel header struct and generic magic definition to align with

> > arm64/linux loader.

> >

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

> > ---

> >  grub-core/loader/arm/linux.c | 11 +++++------

> >  include/grub/arm/linux.h     | 15 ++++++++++++---

> >  2 files changed, 17 insertions(+), 9 deletions(-)

> >

> > diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c

> > index e64c79a95..067f69894 100644

> > --- a/grub-core/loader/arm/linux.c

> > +++ b/grub-core/loader/arm/linux.c

> > @@ -46,9 +46,6 @@ static const void *current_fdt;

> >

> >  typedef void (*kernel_entry_t) (int, unsigned long, void *);

> >

> > -#define LINUX_ZIMAGE_OFFSET    0x24

> > -#define LINUX_ZIMAGE_MAGIC     0x016f2818

> > -

> >  #define LINUX_PHYS_OFFSET        (0x00008000)

> >  #define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)

> >  #define LINUX_FDT_PHYS_OFFSET    (LINUX_INITRD_PHYS_OFFSET - 0x10000)

> > @@ -315,6 +312,7 @@ linux_boot (void)

> >  static grub_err_t

> >  linux_load (const char *filename, grub_file_t file)

> >  {

> > +  struct grub_linux_kernel_header *lh;

> >    int size;

> >

> >    size = grub_file_size (file);

> > @@ -337,9 +335,10 @@ linux_load (const char *filename, grub_file_t file)

> >        return grub_errno;

> >      }

> >

> > -  if (size > LINUX_ZIMAGE_OFFSET + 4

> > -      && *(grub_uint32_t *) (linux_addr + LINUX_ZIMAGE_OFFSET)

> > -      == LINUX_ZIMAGE_MAGIC)

> > +  lh = (void *) linux_addr;

> > +

> > +  if ((grub_size_t) size > sizeof (*lh) &&

> > +      lh->magic == GRUB_LINUX_MAGIC_SIGNATURE)

> >      ;

> >    else if (size > 0x8000 && *(grub_uint32_t *) (linux_addr) == 0xea000006

> >            && machine_type == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)

> > diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h

> > index f217f8281..802090239 100644

> > --- a/include/grub/arm/linux.h

> > +++ b/include/grub/arm/linux.h

> > @@ -20,11 +20,20 @@

> >  #ifndef GRUB_LINUX_CPU_HEADER

> >  #define GRUB_LINUX_CPU_HEADER 1

> >

> > -#define LINUX_ZIMAGE_OFFSET 0x24

> > -#define LINUX_ZIMAGE_MAGIC  0x016f2818

> > -

> >  #include "system.h"

> >

> > +#define GRUB_LINUX_MAGIC_SIGNATURE 0x016f2818

> > +

> > +struct grub_linux_kernel_header {

> >

> This maz clash with other architectures preventing including several

> architecture files in the same file. We need it to create tools like

> grub-file .


Right, then I do need to inject some patches renaming this struct and
signature on x86 too.

/
    Leif

> > +  grub_uint32_t code0;

> > +  grub_uint32_t reserved1[8];

> > +  grub_uint32_t magic;

> > +  grub_uint32_t start; /* _start */

> > +  grub_uint32_t end;   /* _edata */

> > +  grub_uint32_t reserved2[4];

> > +  grub_uint32_t hdr_offset;

> > +};

> > +

> >  #if defined GRUB_MACHINE_UBOOT

> >  # include <grub/uboot/uboot.h>

> >  # define LINUX_ADDRESS        (start_of_ram + 0x8000)

> > --

> > 2.11.0

> >

> >

> > _______________________________________________

> > Grub-devel mailing list

> > Grub-devel@gnu.org

> > https://lists.gnu.org/mailman/listinfo/grub-devel

> >


> _______________________________________________

> Grub-devel mailing list

> Grub-devel@gnu.org

> https://lists.gnu.org/mailman/listinfo/grub-devel



_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Vladimir 'phcoder' Serbinenko Sept. 4, 2017, 2:35 p.m. UTC | #3
Great, thanks!

On Mon, Sep 4, 2017, 16:31 Leif Lindholm <leif.lindholm@linaro.org> wrote:

> On Mon, Aug 07, 2017 at 02:07:19PM +0000, Vladimir 'phcoder' Serbinenko

> wrote:

> > Le Thu, Aug 3, 2017 à 12:15 PM, Leif Lindholm <leif.lindholm@linaro.org>

> a

> > écrit :

> >

> > > Use kernel header struct and generic magic definition to align with

> > > arm64/linux loader.

> > >

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

> > > ---

> > >  grub-core/loader/arm/linux.c | 11 +++++------

> > >  include/grub/arm/linux.h     | 15 ++++++++++++---

> > >  2 files changed, 17 insertions(+), 9 deletions(-)

> > >

> > > diff --git a/grub-core/loader/arm/linux.c

> b/grub-core/loader/arm/linux.c

> > > index e64c79a95..067f69894 100644

> > > --- a/grub-core/loader/arm/linux.c

> > > +++ b/grub-core/loader/arm/linux.c

> > > @@ -46,9 +46,6 @@ static const void *current_fdt;

> > >

> > >  typedef void (*kernel_entry_t) (int, unsigned long, void *);

> > >

> > > -#define LINUX_ZIMAGE_OFFSET    0x24

> > > -#define LINUX_ZIMAGE_MAGIC     0x016f2818

> > > -

> > >  #define LINUX_PHYS_OFFSET        (0x00008000)

> > >  #define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)

> > >  #define LINUX_FDT_PHYS_OFFSET    (LINUX_INITRD_PHYS_OFFSET - 0x10000)

> > > @@ -315,6 +312,7 @@ linux_boot (void)

> > >  static grub_err_t

> > >  linux_load (const char *filename, grub_file_t file)

> > >  {

> > > +  struct grub_linux_kernel_header *lh;

> > >    int size;

> > >

> > >    size = grub_file_size (file);

> > > @@ -337,9 +335,10 @@ linux_load (const char *filename, grub_file_t

> file)

> > >        return grub_errno;

> > >      }

> > >

> > > -  if (size > LINUX_ZIMAGE_OFFSET + 4

> > > -      && *(grub_uint32_t *) (linux_addr + LINUX_ZIMAGE_OFFSET)

> > > -      == LINUX_ZIMAGE_MAGIC)

> > > +  lh = (void *) linux_addr;

> > > +

> > > +  if ((grub_size_t) size > sizeof (*lh) &&

> > > +      lh->magic == GRUB_LINUX_MAGIC_SIGNATURE)

> > >      ;

> > >    else if (size > 0x8000 && *(grub_uint32_t *) (linux_addr) ==

> 0xea000006

> > >            && machine_type == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)

> > > diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h

> > > index f217f8281..802090239 100644

> > > --- a/include/grub/arm/linux.h

> > > +++ b/include/grub/arm/linux.h

> > > @@ -20,11 +20,20 @@

> > >  #ifndef GRUB_LINUX_CPU_HEADER

> > >  #define GRUB_LINUX_CPU_HEADER 1

> > >

> > > -#define LINUX_ZIMAGE_OFFSET 0x24

> > > -#define LINUX_ZIMAGE_MAGIC  0x016f2818

> > > -

> > >  #include "system.h"

> > >

> > > +#define GRUB_LINUX_MAGIC_SIGNATURE 0x016f2818

> > > +

> > > +struct grub_linux_kernel_header {

> > >

> > This maz clash with other architectures preventing including several

> > architecture files in the same file. We need it to create tools like

> > grub-file .

>

> Right, then I do need to inject some patches renaming this struct and

> signature on x86 too.

>

> /

>     Leif

>

> > > +  grub_uint32_t code0;

> > > +  grub_uint32_t reserved1[8];

> > > +  grub_uint32_t magic;

> > > +  grub_uint32_t start; /* _start */

> > > +  grub_uint32_t end;   /* _edata */

> > > +  grub_uint32_t reserved2[4];

> > > +  grub_uint32_t hdr_offset;

> > > +};

> > > +

> > >  #if defined GRUB_MACHINE_UBOOT

> > >  # include <grub/uboot/uboot.h>

> > >  # define LINUX_ADDRESS        (start_of_ram + 0x8000)

> > > --

> > > 2.11.0

> > >

> > >

> > > _______________________________________________

> > > Grub-devel mailing list

> > > Grub-devel@gnu.org

> > > https://lists.gnu.org/mailman/listinfo/grub-devel

> > >

>

> > _______________________________________________

> > Grub-devel mailing list

> > Grub-devel@gnu.org

> > https://lists.gnu.org/mailman/listinfo/grub-devel

>

>
<div dir="ltr">Great, thanks! </div><span>
</span><br><div class="gmail_quote"><div dir="ltr">On Mon, Sep 4, 2017, 16:31 Leif Lindholm &lt;<a href="mailto:leif.lindholm@linaro.org" target="_blank">leif.lindholm@linaro.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Aug 07, 2017 at 02:07:19PM +0000, Vladimir &#39;phcoder&#39; Serbinenko wrote:<br>
&gt; Le Thu, Aug 3, 2017 à 12:15 PM, Leif Lindholm &lt;<a href="mailto:leif.lindholm@linaro.org" target="_blank">leif.lindholm@linaro.org</a>&gt; a<br>
&gt; écrit :<br>
&gt;<br>
&gt; &gt; Use kernel header struct and generic magic definition to align with<br>
&gt; &gt; arm64/linux loader.<br>
&gt; &gt;<br>
&gt; &gt; Signed-off-by: Leif Lindholm &lt;<a href="mailto:leif.lindholm@linaro.org" target="_blank">leif.lindholm@linaro.org</a>&gt;<br>
&gt; &gt; ---<br>
&gt; &gt;  grub-core/loader/arm/linux.c | 11 +++++------<br>
&gt; &gt;  include/grub/arm/linux.h     | 15 ++++++++++++---<br>
&gt; &gt;  2 files changed, 17 insertions(+), 9 deletions(-)<br>
&gt; &gt;<br>
&gt; &gt; diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c<br>
&gt; &gt; index e64c79a95..067f69894 100644<br>
&gt; &gt; --- a/grub-core/loader/arm/linux.c<br>
&gt; &gt; +++ b/grub-core/loader/arm/linux.c<br>
&gt; &gt; @@ -46,9 +46,6 @@ static const void *current_fdt;<br>
&gt; &gt;<br>
&gt; &gt;  typedef void (*kernel_entry_t) (int, unsigned long, void *);<br>
&gt; &gt;<br>
&gt; &gt; -#define LINUX_ZIMAGE_OFFSET    0x24<br>
&gt; &gt; -#define LINUX_ZIMAGE_MAGIC     0x016f2818<br>
&gt; &gt; -<br>
&gt; &gt;  #define LINUX_PHYS_OFFSET        (0x00008000)<br>
&gt; &gt;  #define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)<br>
&gt; &gt;  #define LINUX_FDT_PHYS_OFFSET    (LINUX_INITRD_PHYS_OFFSET - 0x10000)<br>
&gt; &gt; @@ -315,6 +312,7 @@ linux_boot (void)<br>
&gt; &gt;  static grub_err_t<br>
&gt; &gt;  linux_load (const char *filename, grub_file_t file)<br>
&gt; &gt;  {<br>
&gt; &gt; +  struct grub_linux_kernel_header *lh;<br>
&gt; &gt;    int size;<br>
&gt; &gt;<br>
&gt; &gt;    size = grub_file_size (file);<br>
&gt; &gt; @@ -337,9 +335,10 @@ linux_load (const char *filename, grub_file_t file)<br>
&gt; &gt;        return grub_errno;<br>
&gt; &gt;      }<br>
&gt; &gt;<br>
&gt; &gt; -  if (size &gt; LINUX_ZIMAGE_OFFSET + 4<br>
&gt; &gt; -      &amp;&amp; *(grub_uint32_t *) (linux_addr + LINUX_ZIMAGE_OFFSET)<br>
&gt; &gt; -      == LINUX_ZIMAGE_MAGIC)<br>
&gt; &gt; +  lh = (void *) linux_addr;<br>
&gt; &gt; +<br>
&gt; &gt; +  if ((grub_size_t) size &gt; sizeof (*lh) &amp;&amp;<br>
&gt; &gt; +      lh-&gt;magic == GRUB_LINUX_MAGIC_SIGNATURE)<br>
&gt; &gt;      ;<br>
&gt; &gt;    else if (size &gt; 0x8000 &amp;&amp; *(grub_uint32_t *) (linux_addr) == 0xea000006<br>
&gt; &gt;            &amp;&amp; machine_type == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)<br>
&gt; &gt; diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h<br>
&gt; &gt; index f217f8281..802090239 100644<br>
&gt; &gt; --- a/include/grub/arm/linux.h<br>
&gt; &gt; +++ b/include/grub/arm/linux.h<br>
&gt; &gt; @@ -20,11 +20,20 @@<br>
&gt; &gt;  #ifndef GRUB_LINUX_CPU_HEADER<br>
&gt; &gt;  #define GRUB_LINUX_CPU_HEADER 1<br>
&gt; &gt;<br>
&gt; &gt; -#define LINUX_ZIMAGE_OFFSET 0x24<br>
&gt; &gt; -#define LINUX_ZIMAGE_MAGIC  0x016f2818<br>
&gt; &gt; -<br>
&gt; &gt;  #include &quot;system.h&quot;<br>
&gt; &gt;<br>
&gt; &gt; +#define GRUB_LINUX_MAGIC_SIGNATURE 0x016f2818<br>
&gt; &gt; +<br>
&gt; &gt; +struct grub_linux_kernel_header {<br>
&gt; &gt;<br>
&gt; This maz clash with other architectures preventing including several<br>
&gt; architecture files in the same file. We need it to create tools like<br>
&gt; grub-file .<br>
<br>
Right, then I do need to inject some patches renaming this struct and<br>
signature on x86 too.<br>
<br>
/<br>
    Leif<br>
<br>
&gt; &gt; +  grub_uint32_t code0;<br>
&gt; &gt; +  grub_uint32_t reserved1[8];<br>
&gt; &gt; +  grub_uint32_t magic;<br>
&gt; &gt; +  grub_uint32_t start; /* _start */<br>
&gt; &gt; +  grub_uint32_t end;   /* _edata */<br>
&gt; &gt; +  grub_uint32_t reserved2[4];<br>
&gt; &gt; +  grub_uint32_t hdr_offset;<br>
&gt; &gt; +};<br>
&gt; &gt; +<br>
&gt; &gt;  #if defined GRUB_MACHINE_UBOOT<br>
&gt; &gt;  # include &lt;grub/uboot/uboot.h&gt;<br>
&gt; &gt;  # define LINUX_ADDRESS        (start_of_ram + 0x8000)<br>
&gt; &gt; --<br>
&gt; &gt; 2.11.0<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; Grub-devel mailing list<br>
&gt; &gt; <a href="mailto:Grub-devel@gnu.org" target="_blank">Grub-devel@gnu.org</a><br>
&gt; &gt; <a href="https://lists.gnu.org/mailman/listinfo/grub-devel" rel="noreferrer" target="_blank">https://lists.gnu.org/mailman/listinfo/grub-devel</a><br>
&gt; &gt;<br>
<br>
&gt; _______________________________________________<br>
&gt; Grub-devel mailing list<br>
&gt; <a href="mailto:Grub-devel@gnu.org" target="_blank">Grub-devel@gnu.org</a><br>
&gt; <a href="https://lists.gnu.org/mailman/listinfo/grub-devel" rel="noreferrer" target="_blank">https://lists.gnu.org/mailman/listinfo/grub-devel</a><br>
<br>
</blockquote></div>
_______________________________________________
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/loader/arm/linux.c b/grub-core/loader/arm/linux.c
index e64c79a95..067f69894 100644
--- a/grub-core/loader/arm/linux.c
+++ b/grub-core/loader/arm/linux.c
@@ -46,9 +46,6 @@  static const void *current_fdt;
 
 typedef void (*kernel_entry_t) (int, unsigned long, void *);
 
-#define LINUX_ZIMAGE_OFFSET	0x24
-#define LINUX_ZIMAGE_MAGIC	0x016f2818
-
 #define LINUX_PHYS_OFFSET        (0x00008000)
 #define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
 #define LINUX_FDT_PHYS_OFFSET    (LINUX_INITRD_PHYS_OFFSET - 0x10000)
@@ -315,6 +312,7 @@  linux_boot (void)
 static grub_err_t
 linux_load (const char *filename, grub_file_t file)
 {
+  struct grub_linux_kernel_header *lh;
   int size;
 
   size = grub_file_size (file);
@@ -337,9 +335,10 @@  linux_load (const char *filename, grub_file_t file)
       return grub_errno;
     }
 
-  if (size > LINUX_ZIMAGE_OFFSET + 4
-      && *(grub_uint32_t *) (linux_addr + LINUX_ZIMAGE_OFFSET)
-      == LINUX_ZIMAGE_MAGIC)
+  lh = (void *) linux_addr;
+
+  if ((grub_size_t) size > sizeof (*lh) &&
+      lh->magic == GRUB_LINUX_MAGIC_SIGNATURE)
     ;
   else if (size > 0x8000 && *(grub_uint32_t *) (linux_addr) == 0xea000006
 	   && machine_type == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
index f217f8281..802090239 100644
--- a/include/grub/arm/linux.h
+++ b/include/grub/arm/linux.h
@@ -20,11 +20,20 @@ 
 #ifndef GRUB_LINUX_CPU_HEADER
 #define GRUB_LINUX_CPU_HEADER 1
 
-#define LINUX_ZIMAGE_OFFSET 0x24
-#define LINUX_ZIMAGE_MAGIC  0x016f2818
-
 #include "system.h"
 
+#define GRUB_LINUX_MAGIC_SIGNATURE 0x016f2818
+
+struct grub_linux_kernel_header {
+  grub_uint32_t code0;
+  grub_uint32_t reserved1[8];
+  grub_uint32_t magic;
+  grub_uint32_t start; /* _start */
+  grub_uint32_t end;   /* _edata */
+  grub_uint32_t reserved2[4];
+  grub_uint32_t hdr_offset;
+};
+
 #if defined GRUB_MACHINE_UBOOT
 # include <grub/uboot/uboot.h>
 # define LINUX_ADDRESS        (start_of_ram + 0x8000)