Skip to contentSkip to conversation

bootm: Add board specific OS preboot hook

PATCH In review Marek Vasut 4 participants 6 messages Oct 4, 2018 – Oct 11, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 common/bootm_os.c | 7 +++++++
 1 file changed, 7 insertions(+)
common/bootm_os.c +7 -0
index f4bd905909..f302135868 100644
@@ -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' */
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/1 bootm: Add board specific OS preboot hook

Quoted 7 lines · Marek Vasut

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.

Great idea. There are already some boards (including my private ones) that misuse arch_preboot_os(). Those could be converted, too.

Quoted 33 lines
---
 common/bootm_os.c | 7 +++++++
 1 file changed, 7 insertions(+)
common/bootm_os.c +7 -1
index f4bd905909..f302135868 100644
@@ -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 at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#2 lore raw

PATCH 1/1 bootm: Add board specific OS preboot hook

In reply to Marek Vasut

Am Do., 4. Okt. 2018 um 21:16 Uhr schrieb Marek Vasut <[email protected]>:

Quoted 7 lines

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.

Copy of https://patchwork.ozlabs.org/patch/956942/ ?

Signature · 5 lines
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info
#3 lore raw

PATCH 1/1 bootm: Add board specific OS preboot hook

Quoted 10 lines · Christian Gmeiner

Am Do., 4. Okt. 2018 um 21:16 Uhr schrieb Marek Vasut <[email protected]>:

Quoted 7 lines

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.

Copy of https://patchwork.ozlabs.org/patch/956942/ ?

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.

Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw

PATCH 1/1 bootm: Add board specific OS preboot hook

Quoted 10 lines · Marek Vasut
Quoted 9 lines · Christian Gmeiner

Am Do., 4. Okt. 2018 um 21:16 Uhr schrieb Marek Vasut <[email protected]>:

Quoted 7 lines

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.

Quoted 8 lines
Quoted 1 line

Copy of https://patchwork.ozlabs.org/patch/956942/ ?

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!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181008/e4278386/attachment.sig>
#5 lore raw
In reply to Marek Vasut
Quoted 7 lines · Marek Vasut

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181011/0d7ea9dc/attachment.sig>