mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] bootstrap: Boot barebox with kernel calling convention
@ 2015-12-10 20:00 Trent Piepho
  2015-12-11  7:25 ` Sascha Hauer
  2015-12-14 10:15 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Trent Piepho @ 2015-12-10 20:00 UTC (permalink / raw)
  To: barebox

In commit 8e3ddc13eb8239177ed20f119e3a3d02518b941d the bootm code was
changed to boot barebox using the same calling convention as the
kernel.  Which on ARM is to pass three arguments which are zero, an
architecture code, and a params pointer.

A 2nd stage barebox can be booted using lib/bootstrap, which is
different code from bootm.  This code just leaves garbage in the first
three parameters and so doesn't follow the convention.

Change it to be compatible with the ARM kernel booting convention.
This just sends a zero for the architecture, since the code for
architectures depends on boot[zmu] and something using bootstrap
wouldn't have those too.  And it just passes NULL for the params since
we don't have a way to pass a device tree from the preloader.

All users of bootstrap are ARM based, but the code is in lib so a
non-ARM board might someday make use of it.  If the current code would
work for them, then the change here will be ok too.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
---
 include/bootstrap.h    | 3 ++-
 lib/bootstrap/common.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/bootstrap.h b/include/bootstrap.h
index 28852c0..9863ff4 100644
--- a/include/bootstrap.h
+++ b/include/bootstrap.h
@@ -11,7 +11,8 @@
 
 #define bootstrap_err(fmt, arg...) printf(fmt, ##arg)
 
-void bootstrap_boot(int (*func)(void), bool barebox);
+typedef void (*kernel_entry_func)(int zero, int arch, void *params);
+void bootstrap_boot(kernel_entry_func func, bool barebox);
 
 #ifdef CONFIG_BOOTSTRAP_DEVFS
 void* bootstrap_read_devfs(char *devname, bool use_bb, int offset,
diff --git a/lib/bootstrap/common.c b/lib/bootstrap/common.c
index 38ec272..4a61992 100644
--- a/lib/bootstrap/common.c
+++ b/lib/bootstrap/common.c
@@ -9,7 +9,7 @@
 #include <bootstrap.h>
 #include <filetype.h>
 
-void bootstrap_boot(int (*func)(void), bool barebox)
+void bootstrap_boot(kernel_entry_func func, bool barebox)
 {
 	if (!func)
 		return;
@@ -18,7 +18,7 @@ void bootstrap_boot(int (*func)(void), bool barebox)
 		return;
 
 	shutdown_barebox();
-	func();
+	func(0, 0, NULL);
 
 	while (1);
 }
-- 
1.8.3.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] bootstrap: Boot barebox with kernel calling convention
  2015-12-10 20:00 [PATCH] bootstrap: Boot barebox with kernel calling convention Trent Piepho
@ 2015-12-11  7:25 ` Sascha Hauer
  2015-12-14 10:15 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2015-12-11  7:25 UTC (permalink / raw)
  To: Trent Piepho; +Cc: barebox

On Thu, Dec 10, 2015 at 08:00:50PM +0000, Trent Piepho wrote:
> In commit 8e3ddc13eb8239177ed20f119e3a3d02518b941d the bootm code was
> changed to boot barebox using the same calling convention as the
> kernel.  Which on ARM is to pass three arguments which are zero, an
> architecture code, and a params pointer.
> 
> A 2nd stage barebox can be booted using lib/bootstrap, which is
> different code from bootm.  This code just leaves garbage in the first
> three parameters and so doesn't follow the convention.
> 
> Change it to be compatible with the ARM kernel booting convention.
> This just sends a zero for the architecture, since the code for
> architectures depends on boot[zmu] and something using bootstrap
> wouldn't have those too.  And it just passes NULL for the params since
> we don't have a way to pass a device tree from the preloader.
> 
> All users of bootstrap are ARM based, but the code is in lib so a
> non-ARM board might someday make use of it.  If the current code would
> work for them, then the change here will be ok too.
> 
> Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
> ---

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] bootstrap: Boot barebox with kernel calling convention
  2015-12-10 20:00 [PATCH] bootstrap: Boot barebox with kernel calling convention Trent Piepho
  2015-12-11  7:25 ` Sascha Hauer
@ 2015-12-14 10:15 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2015-12-14 10:15 UTC (permalink / raw)
  To: Trent Piepho; +Cc: barebox

On Thu, Dec 10, 2015 at 08:00:50PM +0000, Trent Piepho wrote:
> In commit 8e3ddc13eb8239177ed20f119e3a3d02518b941d the bootm code was
> changed to boot barebox using the same calling convention as the
> kernel.  Which on ARM is to pass three arguments which are zero, an
> architecture code, and a params pointer.
> 
> A 2nd stage barebox can be booted using lib/bootstrap, which is
> different code from bootm.  This code just leaves garbage in the first
> three parameters and so doesn't follow the convention.
> 
> Change it to be compatible with the ARM kernel booting convention.
> This just sends a zero for the architecture, since the code for
> architectures depends on boot[zmu] and something using bootstrap
> wouldn't have those too.  And it just passes NULL for the params since
> we don't have a way to pass a device tree from the preloader.
> 
> All users of bootstrap are ARM based, but the code is in lib so a
> non-ARM board might someday make use of it.  If the current code would
> work for them, then the change here will be ok too.
> 
> Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
> ---
>  include/bootstrap.h    | 3 ++-
>  lib/bootstrap/common.c | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/include/bootstrap.h b/include/bootstrap.h
> index 28852c0..9863ff4 100644
> --- a/include/bootstrap.h
> +++ b/include/bootstrap.h
> @@ -11,7 +11,8 @@
>  
>  #define bootstrap_err(fmt, arg...) printf(fmt, ##arg)
>  
> -void bootstrap_boot(int (*func)(void), bool barebox);
> +typedef void (*kernel_entry_func)(int zero, int arch, void *params);
> +void bootstrap_boot(kernel_entry_func func, bool barebox);

This needs fixup in arch/arm/mach-at91/bootstrap.c. Added these.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2015-12-14 10:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10 20:00 [PATCH] bootstrap: Boot barebox with kernel calling convention Trent Piepho
2015-12-11  7:25 ` Sascha Hauer
2015-12-14 10:15 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox