[U-Boot] [PATCH] bootm: Add board specific OS preboot hook

Add board-specific hook which is executed before the code hands over control to the OS. This lets the board perform some last-minute clean ups.
Signed-off-by: Marek Vasut marex@denx.de Cc: Tom Rini trini@konsulko.com --- common/bootm_os.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/common/bootm_os.c b/common/bootm_os.c index f4bd905909..f302135868 100644 --- a/common/bootm_os.c +++ b/common/bootm_os.c @@ -505,10 +505,17 @@ __weak void arch_preboot_os(void) /* please define platform specific arch_preboot_os() */ }
+/* Allow for board specific config before we boot */ +__weak void board_preboot_os(void) +{ + /* please define board specific board_preboot_os() */ +} + int boot_selected_os(int argc, char * const argv[], int state, bootm_headers_t *images, boot_os_fn *boot_fn) { arch_preboot_os(); + board_preboot_os(); boot_fn(state, argc, argv, images);
/* Stand-alone may return when 'autostart' is 'no' */

On Thu, Oct 4, 2018 at 9:16 PM Marek Vasut marex@denx.de wrote:
Add board-specific hook which is executed before the code hands over control to the OS. This lets the board perform some last-minute clean ups.
Signed-off-by: Marek Vasut marex@denx.de Cc: Tom Rini trini@konsulko.com
Great idea. There are already some boards (including my private ones) that misuse arch_preboot_os(). Those could be converted, too.
Reviewed-by: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com
common/bootm_os.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/common/bootm_os.c b/common/bootm_os.c index f4bd905909..f302135868 100644 --- a/common/bootm_os.c +++ b/common/bootm_os.c @@ -505,10 +505,17 @@ __weak void arch_preboot_os(void) /* please define platform specific arch_preboot_os() */ }
+/* Allow for board specific config before we boot */ +__weak void board_preboot_os(void) +{
/* please define board specific board_preboot_os() */
+}
int boot_selected_os(int argc, char * const argv[], int state, bootm_headers_t *images, boot_os_fn *boot_fn) { arch_preboot_os();
board_preboot_os(); boot_fn(state, argc, argv, images); /* Stand-alone may return when 'autostart' is 'no' */
-- 2.18.0
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Am Do., 4. Okt. 2018 um 21:16 Uhr schrieb Marek Vasut marex@denx.de:
Add board-specific hook which is executed before the code hands over control to the OS. This lets the board perform some last-minute clean ups.
Signed-off-by: Marek Vasut marex@denx.de Cc: Tom Rini trini@konsulko.com
Copy of https://patchwork.ozlabs.org/patch/956942/ ?

On 10/08/2018 01:34 PM, Christian Gmeiner wrote:
Am Do., 4. Okt. 2018 um 21:16 Uhr schrieb Marek Vasut marex@denx.de:
Add board-specific hook which is executed before the code hands over control to the OS. This lets the board perform some last-minute clean ups.
Signed-off-by: Marek Vasut marex@denx.de Cc: Tom Rini trini@konsulko.com
Wow, the patch is almost identical, except for the position of the board_preboot_os() :-) ... which is no surprise, given it's almost a verbatim copy of arch_preboot_os().
I'd prefer board after arch though, so the board can have the last word before boot.

On Mon, Oct 08, 2018 at 01:39:44PM +0200, Marek Vasut wrote:
On 10/08/2018 01:34 PM, Christian Gmeiner wrote:
Am Do., 4. Okt. 2018 um 21:16 Uhr schrieb Marek Vasut marex@denx.de:
Add board-specific hook which is executed before the code hands over control to the OS. This lets the board perform some last-minute clean ups.
Signed-off-by: Marek Vasut marex@denx.de Cc: Tom Rini trini@konsulko.com
Wow, the patch is almost identical, except for the position of the board_preboot_os() :-) ... which is no surprise, given it's almost a verbatim copy of arch_preboot_os().
I'd prefer board after arch though, so the board can have the last word before boot.
Agreed, and that's the usual flow too. Thanks!

On Thu, Oct 04, 2018 at 09:16:31PM +0200, Marek Vasut wrote:
Add board-specific hook which is executed before the code hands over control to the OS. This lets the board perform some last-minute clean ups.
Signed-off-by: Marek Vasut marex@denx.de Cc: Tom Rini trini@konsulko.com Reviewed-by: Simon Goldschmidt simon.k.r.goldschmidt@gmail.com
Applied to u-boot/master, thanks!
participants (4)
-
Christian Gmeiner
-
Marek Vasut
-
Simon Goldschmidt
-
Tom Rini