Hi Jiaxun,

On 2026-10-29T05:07:18+11:00, Yao Zi <[email protected]> wrote:
> LoongArch: Boot Image bits
>
> Implement loading and booting functions for LoongArch
> standard kernel image as per spec.
>
> LoongArch kernel do expect us to fake a efi systemtable
> for passing fdt to kernel, we don't need to implement any
> EFI functions for kernel because it won't look into anything
> beside devicetree from that table if we tell kernel we are
> not efi compatible by setting a0 boot argument to zero.
>
> Link: https://docs.kernel.org/arch/loongarch/booting.html
> Signed-off-by: Jiaxun Yang <[email protected]>
> Signed-off-by: Yao Zi <[email protected]>
>
>  arch/loongarch/lib/Makefile |   2 +
>  arch/loongarch/lib/bootm.c  | 129 
> ++++++++++++++++++++++++++++++++++++++++++++
>  arch/loongarch/lib/image.c  |  77 ++++++++++++++++++++++++++
>  boot/Kconfig                |   1 +
>  cmd/Kconfig                 |   2 +-
>  5 files changed, 210 insertions(+), 1 deletion(-)

> diff --git a/arch/loongarch/lib/bootm.c b/arch/loongarch/lib/bootm.c
> @@ -0,0 +1,129 @@
> +     systab->hdr.crc32 = crc32(0, (const unsigned char *)systab,
> +                               systab->hdr.headersize);
> +
> +     cfgtab[0].guid = efi_guid_fdt;
> +     cfgtab[0].table = images->ft_addr;
> +
> +     gd->bd->bi_boot_params = (ulong)systab;

The CRC is still calculated before cfgtab[0] is filled in, so please
move it after that. Also please use map_to_sysmem(systab) for
bi_boot_params rather than a plain cast.

> diff --git a/arch/loongarch/lib/image.c b/arch/loongarch/lib/image.c
> @@ -0,0 +1,77 @@
> +     uint32_t        code0;                  /* Executable code */
> +     uint32_t        code1;                  /* Executable code */
> +     uint64_t        kernel_entry;           /* Kernel entry point */

Please can you use u32/u64 for these members?

In any case:
Reviewed-by: Simon Glass <[email protected]>

Regards,
Simon

Reply via email to