Hi All,

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.

I've made this a separate if/else CONFIG option instead of allowing both
bootz+booti paths to coexist, as it seems unlikely to me that there would
be such a board which needs both.  Most architectures use either bootz or
booti, but not both.

Sincerely,
Nathan Barrett-Morrison
From d5542ccc2d4f81ac0442be8ca772a99e1a13b6dd Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison <nathan.morri...@timesys.com>
Date: Mon, 17 Jan 2022 19:42:10 -0500
Subject: [PATCH] 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 image booting (i.e.,
 ARM64)

Signed-off-by: Nathan Barrett-Morrison <nathan.morri...@timesys.com>
Cc: Tom Rini <tr...@konsulko.com>
Cc: Aneesh V <ane...@ti.com>
---
 arch/arm/lib/Makefile |  2 +-
 common/spl/Kconfig    |  6 ++++++
 common/spl/spl.c      | 21 +++++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index c48e1f622d..24c9e3c1e5 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -36,7 +36,7 @@ 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
+obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o image.o
 obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
 endif
 ifdef CONFIG_ARM64
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 4a739a7421..6d2ddddc9f 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -917,6 +917,12 @@ config SYS_OS_BASE
 	  Specify the address, where the OS image is found, which
 	  gets booted.
 
+config SPL_OS_BOOT_UNCOMPRESSED
+	bool "Use uncompressed kernel image alongside Falcon Mode"
+	depends on SPL_SPI_LOAD
+	help
+	  Use an uncompressed kernel image to boot.  This is targetting
+	  architectures which use booti instead of bootz (i.e, ARM64).
 endif # SPL_OS_BOOT
 
 config SPL_PAYLOAD
diff --git a/common/spl/spl.c b/common/spl/spl.c
index f51d1f3205..9a826971eb 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -104,6 +104,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 */
@@ -354,6 +359,21 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 #endif
 
 #if CONFIG_IS_ENABLED(OS_BOOT)
+#if CONFIG_IS_ENABLED(OS_BOOT_UNCOMPRESSED)
+		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;
+			printf(SPL_TPL_PROMPT
+			      "payload Image, load addr: 0x%lx size: %d\n",
+			      spl_image->load_addr, spl_image->size);
+			return 0;
+		}
+#else
 		ulong start, end;
 
 		if (!bootz_setup((ulong)header, &start, &end)) {
@@ -367,6 +387,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, (const void *)header, sizeof(*header)))
-- 
2.34.1

Reply via email to