qi: add build instructions for the bootloader
[qi-bootmenu-system/guyou.git] / sources / patches / qi-bootloader-Add-functionality-to-load-a-specific-kernel-upon-button-press.patch
blobea30ed93758f361be8e55788e954fbd04960c496
1 From e8688b7a6586cc634cef130b199d6c6b04422b21 Mon Sep 17 00:00:00 2001
2 From: Marc Andre Tanner <mat@brain-dump.org>
3 Date: Wed, 2 Dec 2009 01:27:59 +0100
4 Subject: [PATCH 1/3] Add functionality to load a specific kernel upon button press
6 Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>
7 ---
8 include/qi.h | 4 ++++
9 src/phase2.c | 10 +++++++++-
10 2 files changed, 13 insertions(+), 1 deletions(-)
12 diff --git a/include/qi.h b/include/qi.h
13 index b99695d..62130e3 100644
14 --- a/include/qi.h
15 +++ b/include/qi.h
16 @@ -45,6 +45,7 @@ enum filesystem {
17 enum ui_actions {
18 UI_ACTION_ADD_DEBUG = (1 << 0),
19 UI_ACTION_SKIPKERNEL = (1 << 1),
20 + UI_ACTION_UI_KERNEL = (1 << 2),
23 enum ui_indication {
24 @@ -110,6 +111,9 @@ struct board_api {
25 void (*set_ui_indication)(enum ui_indication);
27 struct kernel_source kernel_source[8];
28 + /* index into the array above, if this is != 0 then the corresponding
29 + * kernel will be loaded upon the UI_ACTION_UI_KERNEL event */
30 + int kernel_ui;
33 /* this is the board we are running on */
34 diff --git a/src/phase2.c b/src/phase2.c
35 index 4a7ff18..6889503 100644
36 --- a/src/phase2.c
37 +++ b/src/phase2.c
38 @@ -469,8 +469,16 @@ void bootloader_second_phase(void)
39 /* we try the possible kernels for this board in order */
41 for (this_kernel = this_board->kernel_source; this_kernel->name;
42 - this_kernel++)
43 + this_kernel++) {
44 + if (this_board->kernel_ui && this_board->get_ui_keys &&
45 + this_board->get_ui_keys() & UI_ACTION_UI_KERNEL) {
46 + this_kernel = &this_board->kernel_source[this_board->kernel_ui];
47 + try_this_kernel();
48 + puts("Failed to boot UI Kernel\n");
49 + break;
50 + }
51 try_this_kernel();
52 + }
54 /* none of the kernels worked out */
56 --
57 1.6.5