[PATCH v2 10/16] LoongArch: Boot Image bits
Tom Rini
trini at konsulko.com
Wed Jul 1 19:53:28 CEST 2026
On Wed, Jul 01, 2026 at 11:18:02AM +0000, Yao Zi wrote:
> From: Jiaxun Yang <jiaxun.yang at flygoat.com>
>
> 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 <jiaxun.yang at flygoat.com>
> Signed-off-by: Yao Zi <me at ziyao.cc>
> ---
>
> Changed from v1
> - Remove now unused arch_lmb_reserve()
>
> arch/loongarch/lib/Makefile | 2 +
> arch/loongarch/lib/bootm.c | 163 ++++++++++++++++++++++++++++++++++++
> arch/loongarch/lib/image.c | 66 +++++++++++++++
> cmd/Kconfig | 2 +-
> 4 files changed, 232 insertions(+), 1 deletion(-)
> create mode 100644 arch/loongarch/lib/bootm.c
> create mode 100644 arch/loongarch/lib/image.c
>
> diff --git a/arch/loongarch/lib/Makefile b/arch/loongarch/lib/Makefile
> index 3c17b9cd85af..e65e66357a9b 100644
> --- a/arch/loongarch/lib/Makefile
> +++ b/arch/loongarch/lib/Makefile
> @@ -3,6 +3,8 @@
> # Copyright (C) 2024 Jiaxun yang <jiaxun.yang at flygoat.com>
> #
>
> +obj-$(CONFIG_CMD_BOOTM) += bootm.o
> +obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o
We have LIB_BOOT[MI] symbols now, which should be used here instead.
[snip]
> +/**
> + * announce_and_cleanup() - Print message and prepare for kernel boot
> + *
> + * @fake: non-zero to do everything except actually boot
> + */
> +static void announce_and_cleanup(int fake)
> +{
> + printf("\nStarting kernel ...%s\n\n", fake ?
> + "(fake run for tracing)" : "");
> + bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
> +#if CONFIG_IS_ENABLED(BOOTSTAGE_FDT)
> + bootstage_fdt_add_report();
> +#endif
> +#if CONFIG_IS_ENABLED(BOOTSTAGE_REPORT)
> + bootstage_report();
> +#endif
> +
> +#if CONFIG_IS_ENABLED(USB_DEVICE)
> + udc_disconnect();
> +#endif
We don't have USB_DEVICE anymore, so I think you should look at the git
changes to arm and riscv for example to these functions, since the
loongarch port was done, to catch up on current best practices here.
Thanks.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260701/db2deedb/attachment.sig>
More information about the U-Boot
mailing list