Falcon Mode Support For Uncompressed Kernel Images

Nathan Barrett-Morrison nathan.morrison at timesys.com
Tue Apr 19 23:31:52 CEST 2022


Hi Tom,

While trying to bring up Falcon Mode boot on an ARM64 board, I discovered
that there is no path which allows you to use an uncompressed kernel image
(booti).  I've added this path and attached the relevant patch.

Sincerely,
Nathan

>From f1c34333f79996bd2927a60f4858c01699431cba Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison <nathan.morrison at timesys.com>
Date: Wed, 2 Feb 2022 15:05:18 -0500
Subject: [PATCH v2] Add in the ability to load and boot an uncompressed kernel
 image during the Falcon Mode boot sequence.

This is required for architectures which do not support compressed kernel images (i.e. ARM64).  This is only used while not booting via FIT image.

Signed-off-by: Nathan Barrett-Morrison <nathan.morrison at timesys.com>
Cc: Tom Rini <trini at konsulko.com>
---
Changes for v2:
   - Remove original SPL_OS_BOOT_UNCOMPRESSED option and check via CMD_BOOTI and CMD_BOOTZ instead

 arch/arm/lib/Makefile |  5 ++++-
 common/spl/spl.c      | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index c603fe61bc..08b7475e37 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -36,7 +36,10 @@ obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
 obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
 else
 obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o
-obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o
+ifdef CONFIG_SPL_FRAMEWORK
+obj-$(CONFIG_CMD_BOOTI) += image.o
+obj-$(CONFIG_CMD_BOOTZ) += zimage.o
+endif
 obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
 endif
 ifdef CONFIG_ARM64
diff --git a/common/spl/spl.c b/common/spl/spl.c
index c9750ee163..7b86443f1b 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -107,6 +107,11 @@ int __weak bootz_setup(ulong image, ulong *start, ulong *end)
 {
 	 return 1;
 }
+
+int __weak booti_setup(ulong image, ulong *relocated_addr, ulong *size, bool force_reloc)
+{
+	 return 1;
+}
 #endif
 
 /* Weak default function for arch/board-specific fixups to the spl_image_info */
@@ -366,6 +371,21 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 #endif
 
 #if CONFIG_IS_ENABLED(OS_BOOT)
+#if defined(CMD_BOOTI)
+		ulong start, size;
+
+		if (!booti_setup((ulong)header, &start, &size, 0)) {
+			spl_image->name = "Linux";
+			spl_image->os = IH_OS_LINUX;
+			spl_image->load_addr = start;
+			spl_image->entry_point = start;
+			spl_image->size = size;
+			debug(SPL_TPL_PROMPT
+			      "payload Image, load addr: 0x%lx size: %d\n",
+			      spl_image->load_addr, spl_image->size);
+			return 0;
+		}
+#elif defined(CMD_BOOTZ)
 		ulong start, end;
 
 		if (!bootz_setup((ulong)header, &start, &end)) {
@@ -379,6 +399,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 			      spl_image->load_addr, spl_image->size);
 			return 0;
 		}
+#endif
 #endif
 
 		if (!spl_parse_board_header(spl_image, bootdev, (const void *)header, sizeof(*header)))
-- 
2.30.2



More information about the U-Boot mailing list