RISC-V: Align boot image header with Linux
authorAtish Patra <atish.patra@wdc.com>
Wed, 9 Oct 2019 17:34:17 +0000 (10:34 -0700)
committerAndes <uboot@andestech.com>
Fri, 18 Oct 2019 01:04:19 +0000 (09:04 +0800)
The released 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>
Reviewed-by: Rick Chen <rick@andestech.com>
arch/riscv/lib/image.c

index d063beb7dfbefaa928e39952f3e94d995b2f1221..7357d3b07d6cd02c920d43660e87408d91b29482 100644 (file)
 
 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,