diff options
-rw-r--r-- | bootloader/x1000/boot.c | 45 | ||||
-rw-r--r-- | bootloader/x1000/recovery.c | 9 | ||||
-rw-r--r-- | bootloader/x1000/x1000bootloader.h | 23 |
3 files changed, 76 insertions, 1 deletions
diff --git a/bootloader/x1000/boot.c b/bootloader/x1000/boot.c index 6719375151..ca69e2e057 100644 --- a/bootloader/x1000/boot.c +++ b/bootloader/x1000/boot.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "power.h" | 26 | #include "power.h" |
27 | #include "linuxboot.h" | ||
27 | #include "boot-x1000.h" | 28 | #include "boot-x1000.h" |
28 | 29 | ||
29 | void boot_rockbox(void) | 30 | void boot_rockbox(void) |
@@ -50,3 +51,47 @@ void reboot(void) | |||
50 | system_reboot(); | 51 | system_reboot(); |
51 | while(1); | 52 | while(1); |
52 | } | 53 | } |
54 | |||
55 | /* | ||
56 | * WARNING: Original firmware can be finicky. | ||
57 | * Be careful when modifying this code. | ||
58 | */ | ||
59 | |||
60 | static __attribute__((unused)) | ||
61 | void boot_of_helper(uint32_t addr, uint32_t flash_size, const char* args) | ||
62 | { | ||
63 | struct uimage_header uh; | ||
64 | size_t img_length; | ||
65 | int handle = load_uimage_flash(addr, flash_size, &uh, &img_length); | ||
66 | if(handle < 0) | ||
67 | return; | ||
68 | |||
69 | gui_shutdown(); | ||
70 | |||
71 | x1000_dualboot_load_pdma_fw(); | ||
72 | x1000_dualboot_cleanup(); | ||
73 | x1000_dualboot_init_clocktree(); | ||
74 | x1000_dualboot_init_uart2(); | ||
75 | |||
76 | x1000_boot_linux(core_get_data(handle), img_length, | ||
77 | (void*)uimage_get_load(&uh), | ||
78 | (void*)uimage_get_ep(&uh), args); | ||
79 | } | ||
80 | |||
81 | void boot_of_player(void) | ||
82 | { | ||
83 | #if defined(OF_PLAYER_ADDR) | ||
84 | boot_of_helper(OF_PLAYER_ADDR, OF_PLAYER_LENGTH, OF_PLAYER_ARGS); | ||
85 | #else | ||
86 | splash(HZ, "Not supported"); | ||
87 | #endif | ||
88 | } | ||
89 | |||
90 | void boot_of_recovery(void) | ||
91 | { | ||
92 | #if defined(OF_RECOVERY_ADDR) | ||
93 | boot_of_helper(OF_RECOVERY_ADDR, OF_RECOVERY_LENGTH, OF_RECOVERY_ARGS); | ||
94 | #else | ||
95 | splash(HZ, "Not supported"); | ||
96 | #endif | ||
97 | } | ||
diff --git a/bootloader/x1000/recovery.c b/bootloader/x1000/recovery.c index 3d6a079af8..ffd6151858 100644 --- a/bootloader/x1000/recovery.c +++ b/bootloader/x1000/recovery.c | |||
@@ -39,8 +39,15 @@ struct menuitem { | |||
39 | 39 | ||
40 | /* Defines the recovery menu contents */ | 40 | /* Defines the recovery menu contents */ |
41 | static const struct menuitem recovery_items[] = { | 41 | static const struct menuitem recovery_items[] = { |
42 | {MENUITEM_HEADING, "Boot select", NULL}, | ||
43 | {MENUITEM_ACTION, "Rockbox", &boot_rockbox}, | ||
44 | #ifdef OF_PLAYER_NAME | ||
45 | {MENUITEM_ACTION, OF_PLAYER_NAME, &boot_of_player}, | ||
46 | #endif | ||
47 | #ifdef OF_RECOVERY_NAME | ||
48 | {MENUITEM_ACTION, OF_RECOVERY_NAME, &boot_of_recovery}, | ||
49 | #endif | ||
42 | {MENUITEM_HEADING, "System", NULL}, | 50 | {MENUITEM_HEADING, "System", NULL}, |
43 | {MENUITEM_ACTION, "Start Rockbox", &boot_rockbox}, | ||
44 | {MENUITEM_ACTION, "USB mode", &usb_mode}, | 51 | {MENUITEM_ACTION, "USB mode", &usb_mode}, |
45 | {MENUITEM_ACTION, "Shutdown", &shutdown}, | 52 | {MENUITEM_ACTION, "Shutdown", &shutdown}, |
46 | {MENUITEM_ACTION, "Reboot", &reboot}, | 53 | {MENUITEM_ACTION, "Reboot", &reboot}, |
diff --git a/bootloader/x1000/x1000bootloader.h b/bootloader/x1000/x1000bootloader.h index 9090523c14..88d4e3585b 100644 --- a/bootloader/x1000/x1000bootloader.h +++ b/bootloader/x1000/x1000bootloader.h | |||
@@ -41,6 +41,17 @@ struct uimage_header; | |||
41 | # define BL_SELECT_NAME "PLAY" | 41 | # define BL_SELECT_NAME "PLAY" |
42 | # define BL_QUIT_NAME "POWER" | 42 | # define BL_QUIT_NAME "POWER" |
43 | # define BOOTBACKUP_FILE "/fiiom3k-boot.bin" | 43 | # define BOOTBACKUP_FILE "/fiiom3k-boot.bin" |
44 | // FIXME: OF kernel hangs on the m3k | ||
45 | //# define OF_PLAYER_NAME "FiiO player" | ||
46 | # define OF_PLAYER_ADDR 0x20000 | ||
47 | # define OF_PLAYER_LENGTH (4 * 1024 * 1024) | ||
48 | # define OF_PLAYER_ARGS OF_RECOVERY_ARGS \ | ||
49 | " init=/linuxrc ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw loglevel=8" | ||
50 | //# define OF_RECOVERY_NAME "FiiO recovery" | ||
51 | # define OF_RECOVERY_ADDR 0x420000 | ||
52 | # define OF_RECOVERY_LENGTH (5 * 1024 * 1024) | ||
53 | # define OF_RECOVERY_ARGS \ | ||
54 | "mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off" | ||
44 | #elif defined(SHANLING_Q1) | 55 | #elif defined(SHANLING_Q1) |
45 | # define BL_RECOVERY BUTTON_NEXT | 56 | # define BL_RECOVERY BUTTON_NEXT |
46 | # define BL_UP BUTTON_PREV | 57 | # define BL_UP BUTTON_PREV |
@@ -52,6 +63,16 @@ struct uimage_header; | |||
52 | # define BL_SELECT_NAME "PLAY" | 63 | # define BL_SELECT_NAME "PLAY" |
53 | # define BL_QUIT_NAME "POWER" | 64 | # define BL_QUIT_NAME "POWER" |
54 | # define BOOTBACKUP_FILE "/shanlingq1-boot.bin" | 65 | # define BOOTBACKUP_FILE "/shanlingq1-boot.bin" |
66 | # define OF_PLAYER_NAME "Shanling player" | ||
67 | # define OF_PLAYER_ADDR 0x140000 | ||
68 | # define OF_PLAYER_LENGTH (8 * 1024 * 1024) | ||
69 | # define OF_PLAYER_ARGS OF_RECOVERY_ARGS \ | ||
70 | " init=/linuxrc ubi.mtd=5 root=ubi0:rootfs ubi.mtd=6 rootfstype=ubifs rw" | ||
71 | # define OF_RECOVERY_NAME "Shanling recovery" | ||
72 | # define OF_RECOVERY_ADDR 0x940000 | ||
73 | # define OF_RECOVERY_LENGTH (10 * 1024 * 1024) | ||
74 | # define OF_RECOVERY_ARGS \ | ||
75 | "mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off" | ||
55 | #elif defined(EROS_QN) | 76 | #elif defined(EROS_QN) |
56 | # define BL_RECOVERY BUTTON_VOL_UP | 77 | # define BL_RECOVERY BUTTON_VOL_UP |
57 | # define BL_UP BUTTON_SCROLL_BACK | 78 | # define BL_UP BUTTON_SCROLL_BACK |
@@ -118,6 +139,8 @@ void bootloader_restore(void); | |||
118 | */ | 139 | */ |
119 | 140 | ||
120 | void boot_rockbox(void); | 141 | void boot_rockbox(void); |
142 | void boot_of_player(void); | ||
143 | void boot_of_recovery(void); | ||
121 | void shutdown(void); | 144 | void shutdown(void); |
122 | void reboot(void); | 145 | void reboot(void); |
123 | 146 | ||