[U-Boot] [PATCH] riscv: image: save space on the magic number field

Atish Patra Atish.Patra at wdc.com
Mon Jul 8 17:06:47 UTC 2019


On Mon, 2019-07-08 at 11:27 +0000, Chester Lin wrote:
> Change the symbol from "RISCV" to "RSCV" so the magic number can be
> 32-bit
> long, which is consistent with other architectures. This change can
> also
> be compatible with grub because grub defines this field as 32-bit
> long.
> 

It is incompatible with Linux kernel header. So booti will fail to work
with this patch unless a corresponding patch is sent to Linux kernel.

The kernel patch should be part of 5.3-rc1 (which also includes some
compatible field updates). We can revisit all of the changes together
once the kernel patch is merged.

> Signed-off-by: Chester Lin <clin at suse.com>
> ---
>  arch/riscv/lib/image.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/riscv/lib/image.c b/arch/riscv/lib/image.c
> index d063beb7df..e8a8cb7190 100644
> --- a/arch/riscv/lib/image.c
> +++ b/arch/riscv/lib/image.c
> @@ -14,8 +14,8 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> -/* ASCII version of "RISCV" defined in Linux kernel */
> -#define LINUX_RISCV_IMAGE_MAGIC 0x5643534952
> +/* ASCII version of "RSCV" defined in Linux kernel */
> +#define LINUX_RISCV_IMAGE_MAGIC 0x56435352
>  
>  struct linux_image_h {
>  	uint32_t	code0;		/* Executable code */
> @@ -25,8 +25,8 @@ struct linux_image_h {
>  	uint64_t	res1;		/* reserved */
>  	uint64_t	res2;		/* reserved */
>  	uint64_t	res3;		/* reserved */
> -	uint64_t	magic;		/* Magic number */
> -	uint32_t	res4;		/* reserved */
> +	uint64_t	res4;		/* reserved */
> +	uint32_t	magic;		/* Magic number */
>  	uint32_t	res5;		/* reserved */
>  };
>  

-- 
Regards,
Atish


More information about the U-Boot mailing list