diff mbox series

[U-Boot] RISC-V: Align boot image header with Linux.

Message ID 20191009011402.13728-1-atish.patra@wdc.com
State Superseded
Delegated to: Andes
Headers show
Series [U-Boot] RISC-V: Align boot image header with Linux. | expand

Commit Message

Atish Patra Oct. 9, 2019, 1:14 a.m. UTC
The release linux boot image header in v5.3 is different from the
one present in U-boot. Align the header with the new version. The
changes in Linux are backward compatible. Previous u-boot releases
with older header will continue to work as well. As v5.3 kernel is
the first one to support image header, there is no compatibility
issue between new U-boot (with this patch) and older kernel.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
---
 arch/riscv/lib/image.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Bin Meng Oct. 9, 2019, 1:47 a.m. UTC | #1
On Wed, Oct 9, 2019 at 9:15 AM Atish Patra <atish.patra@wdc.com> wrote:
>

nits: please remove the ending period in the commit summary

> The release linux boot image header in v5.3 is different from the

nits: Linux

> one present in U-boot. Align the header with the new version. The

nits: U-Boot

> changes in Linux are backward compatible. Previous u-boot releases

nits: U-Boot

> with older header will continue to work as well. As v5.3 kernel is
> the first one to support image header, there is no compatibility
> issue between new U-boot (with this patch) and older kernel.

nits: U-Boot

>
> Signed-off-by: Atish Patra <atish.patra@wdc.com>
> ---
>  arch/riscv/lib/image.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/lib/image.c b/arch/riscv/lib/image.c
> index d063beb7dfbe..41fca5939020 100644
> --- a/arch/riscv/lib/image.c
> +++ b/arch/riscv/lib/image.c
> @@ -14,20 +14,21 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> -/* ASCII version of "RISCV" defined in Linux kernel */
> -#define LINUX_RISCV_IMAGE_MAGIC 0x5643534952
> +/* ASCII version of "RSC\0x5" defined in Linux kernel */
> +#define LINUX_RISCV_IMAGE_MAGIC 0x05435352
>
>  struct linux_image_h {
>         uint32_t        code0;          /* Executable code */
>         uint32_t        code1;          /* Executable code */
>         uint64_t        text_offset;    /* Image load offset */
>         uint64_t        image_size;     /* Effective Image size */
> -       uint64_t        res1;           /* reserved */
> +       uint64_t        flags;          /* kernel flags(little endian) */

need have a space before (little endian)

> +       uint32_t        version;        /* version of the header */
> +       uint32_t        res1;           /* reserved */
>         uint64_t        res2;           /* reserved */
>         uint64_t        res3;           /* reserved */
> -       uint64_t        magic;          /* Magic number */
> +       uint32_t        magic;          /* Magic number */
>         uint32_t        res4;           /* reserved */
> -       uint32_t        res5;           /* reserved */
>  };
>
>  int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
> --

Regards,
Bin
Atish Patra Oct. 9, 2019, 5:35 p.m. UTC | #2
On Wed, 2019-10-09 at 09:47 +0800, Bin Meng wrote:
> On Wed, Oct 9, 2019 at 9:15 AM Atish Patra <atish.patra@wdc.com>
> wrote:
> 
> nits: please remove the ending period in the commit summary
> 
> > The release linux boot image header in v5.3 is different from the
> 
> nits: Linux
> 
> > one present in U-boot. Align the header with the new version. The
> 
> nits: U-Boot
> 
> > changes in Linux are backward compatible. Previous u-boot releases
> 
> nits: U-Boot
> 
> > with older header will continue to work as well. As v5.3 kernel is
> > the first one to support image header, there is no compatibility
> > issue between new U-boot (with this patch) and older kernel.
> 
> nits: U-Boot
> 

Sorry for not following U-Boot naming conventionl. Fixed all the
comments and sent a v2.

> > Signed-off-by: Atish Patra <atish.patra@wdc.com>
> > ---
> >  arch/riscv/lib/image.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/arch/riscv/lib/image.c b/arch/riscv/lib/image.c
> > index d063beb7dfbe..41fca5939020 100644
> > --- a/arch/riscv/lib/image.c
> > +++ b/arch/riscv/lib/image.c
> > @@ -14,20 +14,21 @@
> > 
> >  DECLARE_GLOBAL_DATA_PTR;
> > 
> > -/* ASCII version of "RISCV" defined in Linux kernel */
> > -#define LINUX_RISCV_IMAGE_MAGIC 0x5643534952
> > +/* ASCII version of "RSC\0x5" defined in Linux kernel */
> > +#define LINUX_RISCV_IMAGE_MAGIC 0x05435352
> > 
> >  struct linux_image_h {
> >         uint32_t        code0;          /* Executable code */
> >         uint32_t        code1;          /* Executable code */
> >         uint64_t        text_offset;    /* Image load offset */
> >         uint64_t        image_size;     /* Effective Image size */
> > -       uint64_t        res1;           /* reserved */
> > +       uint64_t        flags;          /* kernel flags(little
> > endian) */
> 
> need have a space before (little endian)
> 
> > +       uint32_t        version;        /* version of the header */
> > +       uint32_t        res1;           /* reserved */
> >         uint64_t        res2;           /* reserved */
> >         uint64_t        res3;           /* reserved */
> > -       uint64_t        magic;          /* Magic number */
> > +       uint32_t        magic;          /* Magic number */
> >         uint32_t        res4;           /* reserved */
> > -       uint32_t        res5;           /* reserved */
> >  };
> > 
> >  int booti_setup(ulong image, ulong *relocated_addr, ulong *size,
> > --
> 
> Regards,
> Bin
diff mbox series

Patch

diff --git a/arch/riscv/lib/image.c b/arch/riscv/lib/image.c
index d063beb7dfbe..41fca5939020 100644
--- a/arch/riscv/lib/image.c
+++ b/arch/riscv/lib/image.c
@@ -14,20 +14,21 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/* ASCII version of "RISCV" defined in Linux kernel */
-#define LINUX_RISCV_IMAGE_MAGIC 0x5643534952
+/* ASCII version of "RSC\0x5" defined in Linux kernel */
+#define LINUX_RISCV_IMAGE_MAGIC 0x05435352
 
 struct linux_image_h {
 	uint32_t	code0;		/* Executable code */
 	uint32_t	code1;		/* Executable code */
 	uint64_t	text_offset;	/* Image load offset */
 	uint64_t	image_size;	/* Effective Image size */
-	uint64_t	res1;		/* reserved */
+	uint64_t	flags;		/* kernel flags(little endian) */
+	uint32_t	version;	/* version of the header */
+	uint32_t	res1;		/* reserved */
 	uint64_t	res2;		/* reserved */
 	uint64_t	res3;		/* reserved */
-	uint64_t	magic;		/* Magic number */
+	uint32_t	magic;		/* Magic number */
 	uint32_t	res4;		/* reserved */
-	uint32_t	res5;		/* reserved */
 };
 
 int booti_setup(ulong image, ulong *relocated_addr, ulong *size,