From: Marc Andre Tanner <[email protected]>

Signed-off-by: Marc Andre Tanner <[email protected]>
---
 include/qi.h |    4 ++++
 src/phase2.c |   10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/include/qi.h b/include/qi.h
index b99695d..62130e3 100644
--- a/include/qi.h
+++ b/include/qi.h
@@ -45,6 +45,7 @@ enum filesystem {
 enum ui_actions {
        UI_ACTION_ADD_DEBUG     = (1 << 0),
        UI_ACTION_SKIPKERNEL    = (1 << 1),
+       UI_ACTION_UI_KERNEL     = (1 << 2),
 };
 
 enum ui_indication {
@@ -110,6 +111,9 @@ struct board_api {
        void (*set_ui_indication)(enum ui_indication);
 
        struct kernel_source kernel_source[8];
+       /* index into the array above, if this is != 0 then the corresponding
+        * kernel will be loaded upon the UI_ACTION_UI_KERNEL event */
+       int kernel_ui;
 };
 
 /* this is the board we are running on */
diff --git a/src/phase2.c b/src/phase2.c
index 4a7ff18..6889503 100644
--- a/src/phase2.c
+++ b/src/phase2.c
@@ -469,8 +469,16 @@ void bootloader_second_phase(void)
        /* we try the possible kernels for this board in order */
 
        for (this_kernel = this_board->kernel_source; this_kernel->name;
-           this_kernel++)
+            this_kernel++) {
+               if (this_board->kernel_ui && this_board->get_ui_keys &&
+                   this_board->get_ui_keys() & UI_ACTION_UI_KERNEL) {
+                       this_kernel = 
&this_board->kernel_source[this_board->kernel_ui];
+                       try_this_kernel();
+                       puts("Failed to boot UI Kernel\n");
+                       break;
+               }
                try_this_kernel();
+       }
 
        /* none of the kernels worked out */
 
-- 
1.6.5


Reply via email to