u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* Falcon Mode Support For Uncompressed Kernel Images
@ 2022-01-18  0:58 Nathan Barrett-Morrison
  2022-01-31 15:11 ` Tom Rini
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Barrett-Morrison @ 2022-01-18  0:58 UTC (permalink / raw)
  To: u-boot; +Cc: trini, aneesh

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

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

[-- Attachment #2: 0001-Add-in-the-ability-to-load-and-boot-an-uncompressed-.patch --]
[-- Type: text/x-patch, Size: 3067 bytes --]

From d5542ccc2d4f81ac0442be8ca772a99e1a13b6dd Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison <nathan.morrison@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.morrison@timesys.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Aneesh V <aneesh@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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: Falcon Mode Support For Uncompressed Kernel Images
  2022-01-18  0:58 Falcon Mode Support For Uncompressed Kernel Images Nathan Barrett-Morrison
@ 2022-01-31 15:11 ` Tom Rini
  2022-01-31 15:23   ` Nathan Barrett-Morrison
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2022-01-31 15:11 UTC (permalink / raw)
  To: Nathan Barrett-Morrison; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 2875 bytes --]

On Mon, Jan 17, 2022 at 07:58:00PM -0500, Nathan Barrett-Morrison wrote:
> 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.morrison@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.morrison@timesys.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Aneesh V <aneesh@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

We shouldn't need another CONFIG option here, and this would then I
believe fail to boot uncompressed arm32 images.  The real problem I
think is that the code assumed bootm/bootz but needs to instead be more
explicit in checking / supporting each and then also yes, adding booti
support.  Following up with also supporting compressed Images may or may
not take additional logic, I'm not sure off-hand.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Falcon Mode Support For Uncompressed Kernel Images
  2022-01-31 15:11 ` Tom Rini
@ 2022-01-31 15:23   ` Nathan Barrett-Morrison
  2022-01-31 15:35     ` Tom Rini
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Barrett-Morrison @ 2022-01-31 15:23 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot

Hi Tom,

Yea, I'm not sure if uncompressed ARM32 would work, but I don't believe it
was ever working to begin with... as bootz_setup is being called right now
( @ https://source.denx.de/u-boot/u-boot/-/blob/master/common/spl/spl.c#L366
)

My intent was for SPL_OS_BOOT_UNCOMPRESSED to only be used for platforms
which need booti_setup (ARM64, ...).

So... I could add a dependency on ARM64 in the config option or I could
remove the option altogether and let the booti_setup fail and fallback to
bootz_setup.  Would either of those work for you?

Sincerely,
Nathan

On Mon, Jan 31, 2022 at 10:11 AM Tom Rini <trini@konsulko.com> wrote:

> On Mon, Jan 17, 2022 at 07:58:00PM -0500, Nathan Barrett-Morrison wrote:
> > 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.morrison@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.morrison@timesys.com>
> > Cc: Tom Rini <trini@konsulko.com>
> > Cc: Aneesh V <aneesh@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
>
> We shouldn't need another CONFIG option here, and this would then I
> believe fail to boot uncompressed arm32 images.  The real problem I
> think is that the code assumed bootm/bootz but needs to instead be more
> explicit in checking / supporting each and then also yes, adding booti
> support.  Following up with also supporting compressed Images may or may
> not take additional logic, I'm not sure off-hand.
>
> --
> Tom
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Falcon Mode Support For Uncompressed Kernel Images
  2022-01-31 15:23   ` Nathan Barrett-Morrison
@ 2022-01-31 15:35     ` Tom Rini
  2022-02-02 21:53       ` Nathan Barrett-Morrison
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2022-01-31 15:35 UTC (permalink / raw)
  To: Nathan Barrett-Morrison; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 978 bytes --]

On Mon, Jan 31, 2022 at 10:23:58AM -0500, Nathan Barrett-Morrison wrote:

> Hi Tom,
> 
> Yea, I'm not sure if uncompressed ARM32 would work, but I don't believe it
> was ever working to begin with... as bootz_setup is being called right now
> ( @ https://source.denx.de/u-boot/u-boot/-/blob/master/common/spl/spl.c#L366
> )
> 
> My intent was for SPL_OS_BOOT_UNCOMPRESSED to only be used for platforms
> which need booti_setup (ARM64, ...).
> 
> So... I could add a dependency on ARM64 in the config option or I could
> remove the option altogether and let the booti_setup fail and fallback to
> bootz_setup.  Would either of those work for you?

The code and logic overall needs a bit of refactoring to support
"booti", "bootz" and also FIT images.  I believe FIT images are how
anyone doing falcon mode on arm64 has worked thus far.  booti/bootz
should only be an option when CMD_BOOTI/Z is set, and FIT should depend
on SPL_LOAD_FIT already.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Falcon Mode Support For Uncompressed Kernel Images
  2022-01-31 15:35     ` Tom Rini
@ 2022-02-02 21:53       ` Nathan Barrett-Morrison
  2022-04-19 20:30         ` Tom Rini
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Barrett-Morrison @ 2022-02-02 21:53 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]

Hi Tom,

I've attached version 2 of the patch.  I believe this should adhere more
closely to your suggestions.

Keep in mind, CONFIG_IS_ENABLED will not work for checking
CMD_BOOTI/CMD_BOOTZ in this case, as there is no CONFIG_SPL_CMD_BOOTx.  So,
I'm just directly checking if it's defined instead.

I verified both CONFIG_IS_ENABLED() and IS_ENABLED() did not work.

Sincerely,
Nathan

On Mon, Jan 31, 2022 at 10:35 AM Tom Rini <trini@konsulko.com> wrote:

> On Mon, Jan 31, 2022 at 10:23:58AM -0500, Nathan Barrett-Morrison wrote:
>
> > Hi Tom,
> >
> > Yea, I'm not sure if uncompressed ARM32 would work, but I don't believe
> it
> > was ever working to begin with... as bootz_setup is being called right
> now
> > ( @
> https://source.denx.de/u-boot/u-boot/-/blob/master/common/spl/spl.c#L366
> > )
> >
> > My intent was for SPL_OS_BOOT_UNCOMPRESSED to only be used for platforms
> > which need booti_setup (ARM64, ...).
> >
> > So... I could add a dependency on ARM64 in the config option or I could
> > remove the option altogether and let the booti_setup fail and fallback to
> > bootz_setup.  Would either of those work for you?
>
> The code and logic overall needs a bit of refactoring to support
> "booti", "bootz" and also FIT images.  I believe FIT images are how
> anyone doing falcon mode on arm64 has worked thus far.  booti/bootz
> should only be an option when CMD_BOOTI/Z is set, and FIT should depend
> on SPL_LOAD_FIT already.
>
> --
> Tom
>

[-- Attachment #2: 0001-Add-in-the-ability-to-load-and-boot-an-uncompressed-.patch --]
[-- Type: text/x-patch, Size: 2665 bytes --]

From 5d37f2a930e7cb3455b6ec925ec6e67b40d4c022 Mon Sep 17 00:00:00 2001
From: Nathan Barrett Morrison <nathan.morrison@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@timesys.com>
Cc: Tom Rini <trini@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 c48e1f622d..57e49f69f7 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 f51d1f3205..1f6b3f1ac8 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 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)) {
@@ -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.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: Falcon Mode Support For Uncompressed Kernel Images
  2022-02-02 21:53       ` Nathan Barrett-Morrison
@ 2022-04-19 20:30         ` Tom Rini
  2022-04-19 21:16           ` Nathan Barrett-Morrison
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2022-04-19 20:30 UTC (permalink / raw)
  To: Nathan Barrett-Morrison; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 4756 bytes --]

On Wed, Feb 02, 2022 at 04:53:11PM -0500, Nathan Barrett-Morrison wrote:
> Hi Tom,
> 
> I've attached version 2 of the patch.  I believe this should adhere more
> closely to your suggestions.
> 
> Keep in mind, CONFIG_IS_ENABLED will not work for checking
> CMD_BOOTI/CMD_BOOTZ in this case, as there is no CONFIG_SPL_CMD_BOOTx.  So,
> I'm just directly checking if it's defined instead.
> 
> I verified both CONFIG_IS_ENABLED() and IS_ENABLED() did not work.
> 
> Sincerely,
> Nathan
> 
> On Mon, Jan 31, 2022 at 10:35 AM Tom Rini <trini@konsulko.com> wrote:
> 
> > On Mon, Jan 31, 2022 at 10:23:58AM -0500, Nathan Barrett-Morrison wrote:
> >
> > > Hi Tom,
> > >
> > > Yea, I'm not sure if uncompressed ARM32 would work, but I don't believe
> > it
> > > was ever working to begin with... as bootz_setup is being called right
> > now
> > > ( @
> > https://source.denx.de/u-boot/u-boot/-/blob/master/common/spl/spl.c#L366
> > > )
> > >
> > > My intent was for SPL_OS_BOOT_UNCOMPRESSED to only be used for platforms
> > > which need booti_setup (ARM64, ...).
> > >
> > > So... I could add a dependency on ARM64 in the config option or I could
> > > remove the option altogether and let the booti_setup fail and fallback to
> > > bootz_setup.  Would either of those work for you?
> >
> > The code and logic overall needs a bit of refactoring to support
> > "booti", "bootz" and also FIT images.  I believe FIT images are how
> > anyone doing falcon mode on arm64 has worked thus far.  booti/bootz
> > should only be an option when CMD_BOOTI/Z is set, and FIT should depend
> > on SPL_LOAD_FIT already.
> >
> > --
> > Tom
> >

> From 5d37f2a930e7cb3455b6ec925ec6e67b40d4c022 Mon Sep 17 00:00:00 2001
> From: Nathan Barrett Morrison <nathan.morrison@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@timesys.com>
> Cc: Tom Rini <trini@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 c48e1f622d..57e49f69f7 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 f51d1f3205..1f6b3f1ac8 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 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)) {
> @@ -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)))

Sorry for the late response.  Attached patches aren't picked up by
patchwork.  I think this looks OK, but can you please re-send it
directly rather than as attachment?  Thanks.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Falcon Mode Support For Uncompressed Kernel Images
  2022-04-19 20:30         ` Tom Rini
@ 2022-04-19 21:16           ` Nathan Barrett-Morrison
  2022-04-19 21:20             ` Nathan Barrett-Morrison
  2022-04-19 21:28             ` Tom Rini
  0 siblings, 2 replies; 11+ messages in thread
From: Nathan Barrett-Morrison @ 2022-04-19 21:16 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot

Hi Tom,

Let's see if this works any better.  Using a new mail client that is supposed to not modify whitespace:

From f1c34333f79996bd2927a60f4858c01699431cba Mon Sep 17 00:00:00 2001
From: Nathan Barrett Morrison <nathan.morrison@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@timesys.com>
Cc: Tom Rini <trini@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

On 4/19/22 16:30, Tom Rini wrote:
> On Wed, Feb 02, 2022 at 04:53:11PM -0500, Nathan Barrett-Morrison wrote:
>> Hi Tom,
>>
>> I've attached version 2 of the patch.  I believe this should adhere more
>> closely to your suggestions.
>>
>> Keep in mind, CONFIG_IS_ENABLED will not work for checking
>> CMD_BOOTI/CMD_BOOTZ in this case, as there is no CONFIG_SPL_CMD_BOOTx.  So,
>> I'm just directly checking if it's defined instead.
>>
>> I verified both CONFIG_IS_ENABLED() and IS_ENABLED() did not work.
>>
>> Sincerely,
>> Nathan
>>
>> On Mon, Jan 31, 2022 at 10:35 AM Tom Rini <trini@konsulko.com> wrote:
>>
>>> On Mon, Jan 31, 2022 at 10:23:58AM -0500, Nathan Barrett-Morrison wrote:
>>>
>>>> Hi Tom,
>>>>
>>>> Yea, I'm not sure if uncompressed ARM32 would work, but I don't believe
>>> it
>>>> was ever working to begin with... as bootz_setup is being called right
>>> now
>>>> ( @
>>> https://source.denx.de/u-boot/u-boot/-/blob/master/common/spl/spl.c#L366
>>>> )
>>>>
>>>> My intent was for SPL_OS_BOOT_UNCOMPRESSED to only be used for platforms
>>>> which need booti_setup (ARM64, ...).
>>>>
>>>> So... I could add a dependency on ARM64 in the config option or I could
>>>> remove the option altogether and let the booti_setup fail and fallback to
>>>> bootz_setup.  Would either of those work for you?
>>>
>>> The code and logic overall needs a bit of refactoring to support
>>> "booti", "bootz" and also FIT images.  I believe FIT images are how
>>> anyone doing falcon mode on arm64 has worked thus far.  booti/bootz
>>> should only be an option when CMD_BOOTI/Z is set, and FIT should depend
>>> on SPL_LOAD_FIT already.
>>>
>>> --
>>> Tom
>>>
> 
>> From 5d37f2a930e7cb3455b6ec925ec6e67b40d4c022 Mon Sep 17 00:00:00 2001
>> From: Nathan Barrett Morrison <nathan.morrison@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@timesys.com>
>> Cc: Tom Rini <trini@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 c48e1f622d..57e49f69f7 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 f51d1f3205..1f6b3f1ac8 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 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)) {
>> @@ -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)))
> 
> Sorry for the late response.  Attached patches aren't picked up by
> patchwork.  I think this looks OK, but can you please re-send it
> directly rather than as attachment?  Thanks.
> 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: Falcon Mode Support For Uncompressed Kernel Images
  2022-04-19 21:16           ` Nathan Barrett-Morrison
@ 2022-04-19 21:20             ` Nathan Barrett-Morrison
  2022-04-19 21:28             ` Tom Rini
  1 sibling, 0 replies; 11+ messages in thread
From: Nathan Barrett-Morrison @ 2022-04-19 21:20 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot

One more time --

From f1c34333f79996bd2927a60f4858c01699431cba Mon Sep 17 00:00:00 2001
From: Nathan Barrett-Morrison <nathan.morrison@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@timesys.com>
Cc: Tom Rini <trini@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



On 4/19/22 17:16, Nathan Barrett-Morrison wrote:
> Hi Tom,
> 
> Let's see if this works any better.  Using a new mail client that is supposed to not modify whitespace:
> 
> From f1c34333f79996bd2927a60f4858c01699431cba Mon Sep 17 00:00:00 2001
> From: Nathan Barrett Morrison <nathan.morrison@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@timesys.com>
> Cc: Tom Rini <trini@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)))

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: Falcon Mode Support For Uncompressed Kernel Images
  2022-04-19 21:16           ` Nathan Barrett-Morrison
  2022-04-19 21:20             ` Nathan Barrett-Morrison
@ 2022-04-19 21:28             ` Tom Rini
  1 sibling, 0 replies; 11+ messages in thread
From: Tom Rini @ 2022-04-19 21:28 UTC (permalink / raw)
  To: Nathan Barrett-Morrison; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 8453 bytes --]

On Tue, Apr 19, 2022 at 05:16:21PM -0400, Nathan Barrett-Morrison wrote:

> Hi Tom,
> 
> Let's see if this works any better.  Using a new mail client that is supposed to not modify whitespace:
> 
> From f1c34333f79996bd2927a60f4858c01699431cba Mon Sep 17 00:00:00 2001
> From: Nathan Barrett Morrison <nathan.morrison@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@timesys.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> Changes for v2:
>    - Remove original SPL_OS_BOOT_UNCOMPRESSED option and check via CMD_BOOTI and CMD_BOOTZ instead

Whitespace is fine, but since it's in reply to the previous email, that
really throws patchwork for a loop so this doesn't show up yet.  Please
do this is a new thread, thanks.

> 
>  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
> 
> On 4/19/22 16:30, Tom Rini wrote:
> > On Wed, Feb 02, 2022 at 04:53:11PM -0500, Nathan Barrett-Morrison wrote:
> >> Hi Tom,
> >>
> >> I've attached version 2 of the patch.  I believe this should adhere more
> >> closely to your suggestions.
> >>
> >> Keep in mind, CONFIG_IS_ENABLED will not work for checking
> >> CMD_BOOTI/CMD_BOOTZ in this case, as there is no CONFIG_SPL_CMD_BOOTx.  So,
> >> I'm just directly checking if it's defined instead.
> >>
> >> I verified both CONFIG_IS_ENABLED() and IS_ENABLED() did not work.
> >>
> >> Sincerely,
> >> Nathan
> >>
> >> On Mon, Jan 31, 2022 at 10:35 AM Tom Rini <trini@konsulko.com> wrote:
> >>
> >>> On Mon, Jan 31, 2022 at 10:23:58AM -0500, Nathan Barrett-Morrison wrote:
> >>>
> >>>> Hi Tom,
> >>>>
> >>>> Yea, I'm not sure if uncompressed ARM32 would work, but I don't believe
> >>> it
> >>>> was ever working to begin with... as bootz_setup is being called right
> >>> now
> >>>> ( @
> >>> https://source.denx.de/u-boot/u-boot/-/blob/master/common/spl/spl.c#L366
> >>>> )
> >>>>
> >>>> My intent was for SPL_OS_BOOT_UNCOMPRESSED to only be used for platforms
> >>>> which need booti_setup (ARM64, ...).
> >>>>
> >>>> So... I could add a dependency on ARM64 in the config option or I could
> >>>> remove the option altogether and let the booti_setup fail and fallback to
> >>>> bootz_setup.  Would either of those work for you?
> >>>
> >>> The code and logic overall needs a bit of refactoring to support
> >>> "booti", "bootz" and also FIT images.  I believe FIT images are how
> >>> anyone doing falcon mode on arm64 has worked thus far.  booti/bootz
> >>> should only be an option when CMD_BOOTI/Z is set, and FIT should depend
> >>> on SPL_LOAD_FIT already.
> >>>
> >>> --
> >>> Tom
> >>>
> > 
> >> From 5d37f2a930e7cb3455b6ec925ec6e67b40d4c022 Mon Sep 17 00:00:00 2001
> >> From: Nathan Barrett Morrison <nathan.morrison@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@timesys.com>
> >> Cc: Tom Rini <trini@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 c48e1f622d..57e49f69f7 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 f51d1f3205..1f6b3f1ac8 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 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)) {
> >> @@ -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)))
> > 
> > Sorry for the late response.  Attached patches aren't picked up by
> > patchwork.  I think this looks OK, but can you please re-send it
> > directly rather than as attachment?  Thanks.
> > 

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Falcon Mode Support For Uncompressed Kernel Images
  2022-04-19 21:31 Nathan Barrett-Morrison
@ 2022-04-19 21:36 ` Tom Rini
  0 siblings, 0 replies; 11+ messages in thread
From: Tom Rini @ 2022-04-19 21:36 UTC (permalink / raw)
  To: Nathan Barrett-Morrison; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

On Tue, Apr 19, 2022 at 05:31:52PM -0400, Nathan Barrett-Morrison wrote:

> 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@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@timesys.com>
> Cc: Tom Rini <trini@konsulko.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Falcon Mode Support For Uncompressed Kernel Images
@ 2022-04-19 21:31 Nathan Barrett-Morrison
  2022-04-19 21:36 ` Tom Rini
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Barrett-Morrison @ 2022-04-19 21:31 UTC (permalink / raw)
  To: Tom Rini, u-boot

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@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@timesys.com>
Cc: Tom Rini <trini@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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-04-19 21:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18  0:58 Falcon Mode Support For Uncompressed Kernel Images Nathan Barrett-Morrison
2022-01-31 15:11 ` Tom Rini
2022-01-31 15:23   ` Nathan Barrett-Morrison
2022-01-31 15:35     ` Tom Rini
2022-02-02 21:53       ` Nathan Barrett-Morrison
2022-04-19 20:30         ` Tom Rini
2022-04-19 21:16           ` Nathan Barrett-Morrison
2022-04-19 21:20             ` Nathan Barrett-Morrison
2022-04-19 21:28             ` Tom Rini
2022-04-19 21:31 Nathan Barrett-Morrison
2022-04-19 21:36 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).