diff options
Diffstat (limited to 'bootloader')
-rw-r--r-- | bootloader/x1000/main.c | 37 | ||||
-rw-r--r-- | bootloader/x1000/x1000bootloader.h | 4 |
2 files changed, 31 insertions, 10 deletions
diff --git a/bootloader/x1000/main.c b/bootloader/x1000/main.c index 4db172b3f0..b948b030f1 100644 --- a/bootloader/x1000/main.c +++ b/bootloader/x1000/main.c | |||
@@ -33,6 +33,16 @@ | |||
33 | #include "boot-x1000.h" | 33 | #include "boot-x1000.h" |
34 | #include <stdbool.h> | 34 | #include <stdbool.h> |
35 | 35 | ||
36 | static int read_btn(void) | ||
37 | { | ||
38 | #ifdef HAVE_BUTTON_DATA | ||
39 | int bdata; | ||
40 | return button_read_device(&bdata); | ||
41 | #else | ||
42 | return button_read_device(); | ||
43 | #endif | ||
44 | } | ||
45 | |||
36 | void main(void) | 46 | void main(void) |
37 | { | 47 | { |
38 | system_init(); | 48 | system_init(); |
@@ -65,17 +75,24 @@ void main(void) | |||
65 | * let's not force them to hold down the recovery key. */ | 75 | * let's not force them to hold down the recovery key. */ |
66 | bool recovery_mode = get_boot_flag(BOOT_FLAG_USB_BOOT); | 76 | bool recovery_mode = get_boot_flag(BOOT_FLAG_USB_BOOT); |
67 | 77 | ||
68 | #ifdef HAVE_BUTTON_DATA | 78 | /* Normal boot - if it fails, we bail to the recovery menu */ |
69 | int bdata; | 79 | if(!recovery_mode) { |
70 | if(button_read_device(&bdata) & BL_RECOVERY) | 80 | int btn = read_btn(); |
71 | #else | 81 | btn &= ~BUTTON_POWER; /* ignore power button */ |
72 | if(button_read_device() & BL_RECOVERY) | ||
73 | #endif | ||
74 | recovery_mode = true; | ||
75 | 82 | ||
76 | /* If boot fails, it will return and continue on below */ | 83 | if(btn == BL_RECOVERY) |
77 | if(!recovery_mode) | 84 | recovery_mode = true; |
78 | boot_rockbox(); | 85 | #if defined(OF_PLAYER_BTN) |
86 | else if(btn == OF_PLAYER_BTN) | ||
87 | boot_of_player(); | ||
88 | #endif | ||
89 | #if defined(OF_RECOVERY_BTN) | ||
90 | else if(btn == OF_RECOVERY_BTN) | ||
91 | boot_of_recovery(); | ||
92 | #endif | ||
93 | else | ||
94 | boot_rockbox(); | ||
95 | } | ||
79 | 96 | ||
80 | /* This function does not return. */ | 97 | /* This function does not return. */ |
81 | recovery_menu(); | 98 | recovery_menu(); |
diff --git a/bootloader/x1000/x1000bootloader.h b/bootloader/x1000/x1000bootloader.h index f7acd8a675..1fba9a29a1 100644 --- a/bootloader/x1000/x1000bootloader.h +++ b/bootloader/x1000/x1000bootloader.h | |||
@@ -54,11 +54,13 @@ struct uimage_header; | |||
54 | * bug may not affect the Q1. */ | 54 | * bug may not affect the Q1. */ |
55 | # define OF_PLAYER_ARGS OF_RECOVERY_ARGS \ | 55 | # define OF_PLAYER_ARGS OF_RECOVERY_ARGS \ |
56 | " init=/linuxrc ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" | 56 | " init=/linuxrc ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw" |
57 | # define OF_PLAYER_BTN BUTTON_PLAY | ||
57 | # define OF_RECOVERY_NAME "FiiO recovery" | 58 | # define OF_RECOVERY_NAME "FiiO recovery" |
58 | # define OF_RECOVERY_ADDR 0x420000 | 59 | # define OF_RECOVERY_ADDR 0x420000 |
59 | # define OF_RECOVERY_LENGTH (5 * 1024 * 1024) | 60 | # define OF_RECOVERY_LENGTH (5 * 1024 * 1024) |
60 | # define OF_RECOVERY_ARGS \ | 61 | # define OF_RECOVERY_ARGS \ |
61 | "mem=64M console=ttyS2" | 62 | "mem=64M console=ttyS2" |
63 | # define OF_RECOVERY_BTN (BUTTON_PLAY|BUTTON_VOL_UP) | ||
62 | #elif defined(SHANLING_Q1) | 64 | #elif defined(SHANLING_Q1) |
63 | # define BL_RECOVERY BUTTON_NEXT | 65 | # define BL_RECOVERY BUTTON_NEXT |
64 | # define BL_UP BUTTON_PREV | 66 | # define BL_UP BUTTON_PREV |
@@ -77,11 +79,13 @@ struct uimage_header; | |||
77 | # define OF_PLAYER_LENGTH (8 * 1024 * 1024) | 79 | # define OF_PLAYER_LENGTH (8 * 1024 * 1024) |
78 | # define OF_PLAYER_ARGS OF_RECOVERY_ARGS \ | 80 | # define OF_PLAYER_ARGS OF_RECOVERY_ARGS \ |
79 | " init=/linuxrc ubi.mtd=5 root=ubi0:rootfs ubi.mtd=6 rootfstype=ubifs rw" | 81 | " init=/linuxrc ubi.mtd=5 root=ubi0:rootfs ubi.mtd=6 rootfstype=ubifs rw" |
82 | # define OF_PLAYER_BTN BUTTON_PREV | ||
80 | # define OF_RECOVERY_NAME "Shanling recovery" | 83 | # define OF_RECOVERY_NAME "Shanling recovery" |
81 | # define OF_RECOVERY_ADDR 0x940000 | 84 | # define OF_RECOVERY_ADDR 0x940000 |
82 | # define OF_RECOVERY_LENGTH (10 * 1024 * 1024) | 85 | # define OF_RECOVERY_LENGTH (10 * 1024 * 1024) |
83 | # define OF_RECOVERY_ARGS \ | 86 | # define OF_RECOVERY_ARGS \ |
84 | "mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off" | 87 | "mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off" |
88 | # define OF_RECOVERY_BTN (BUTTON_PREV|BUTTON_NEXT) | ||
85 | #elif defined(EROS_QN) | 89 | #elif defined(EROS_QN) |
86 | # define BL_RECOVERY BUTTON_VOL_UP | 90 | # define BL_RECOVERY BUTTON_VOL_UP |
87 | # define BL_UP BUTTON_SCROLL_BACK | 91 | # define BL_UP BUTTON_SCROLL_BACK |