diff options
Diffstat (limited to 'bootloader/x1000.c')
-rw-r--r-- | bootloader/x1000.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/bootloader/x1000.c b/bootloader/x1000.c index 0b28b7449d..2c61773b11 100644 --- a/bootloader/x1000.c +++ b/bootloader/x1000.c | |||
@@ -48,16 +48,13 @@ | |||
48 | #include "loader_strerror.h" | 48 | #include "loader_strerror.h" |
49 | #include "version.h" | 49 | #include "version.h" |
50 | #include "boot-x1000.h" | 50 | #include "boot-x1000.h" |
51 | #include "installer-x1000.h" | ||
51 | #include <stddef.h> | 52 | #include <stddef.h> |
52 | #include <stdbool.h> | 53 | #include <stdbool.h> |
53 | #include <string.h> | 54 | #include <string.h> |
54 | #include <stdio.h> | 55 | #include <stdio.h> |
55 | #include <stdarg.h> | 56 | #include <stdarg.h> |
56 | 57 | ||
57 | #ifdef FIIO_M3K | ||
58 | # include "installer-fiiom3k.h" | ||
59 | #endif | ||
60 | |||
61 | #if defined(FIIO_M3K) | 58 | #if defined(FIIO_M3K) |
62 | # define BL_RECOVERY BUTTON_VOL_UP | 59 | # define BL_RECOVERY BUTTON_VOL_UP |
63 | # define BL_UP BUTTON_VOL_UP | 60 | # define BL_UP BUTTON_VOL_UP |
@@ -68,6 +65,7 @@ | |||
68 | # define BL_DOWN_NAME "VOL-" | 65 | # define BL_DOWN_NAME "VOL-" |
69 | # define BL_SELECT_NAME "PLAY" | 66 | # define BL_SELECT_NAME "PLAY" |
70 | # define BL_QUIT_NAME "POWER" | 67 | # define BL_QUIT_NAME "POWER" |
68 | # define BOOTBACKUP_FILE "/fiiom3k-boot.bin" | ||
71 | #else | 69 | #else |
72 | # error "Missing keymap!" | 70 | # error "Missing keymap!" |
73 | #endif | 71 | #endif |
@@ -387,14 +385,12 @@ void reboot(void) | |||
387 | while(1); | 385 | while(1); |
388 | } | 386 | } |
389 | 387 | ||
390 | /* TODO: clean this up, make the installer generic as well */ | ||
391 | enum { | 388 | enum { |
392 | INSTALL, | 389 | INSTALL, |
393 | BACKUP, | 390 | BACKUP, |
394 | RESTORE, | 391 | RESTORE, |
395 | }; | 392 | }; |
396 | 393 | ||
397 | #ifdef FIIO_M3K | ||
398 | void bootloader_action(int which) | 394 | void bootloader_action(int which) |
399 | { | 395 | { |
400 | if(init_disk() != 0) { | 396 | if(init_disk() != 0) { |
@@ -414,14 +410,14 @@ void bootloader_action(int which) | |||
414 | 410 | ||
415 | int rc; | 411 | int rc; |
416 | switch(which) { | 412 | switch(which) { |
417 | case INSTALL: rc = install_boot("/bootloader.m3k"); break; | 413 | case INSTALL: rc = install_bootloader("/bootloader." BOOTFILE_EXT); break; |
418 | case BACKUP: rc = backup_boot("/fiiom3k-boot.bin"); break; | 414 | case BACKUP: rc = backup_bootloader(BOOTBACKUP_FILE); break; |
419 | case RESTORE: rc = restore_boot("/fiiom3k-boot.bin"); break; | 415 | case RESTORE: rc = restore_bootloader(BOOTBACKUP_FILE); break; |
420 | default: return; | 416 | default: return; |
421 | } | 417 | } |
422 | 418 | ||
423 | static char buf[64]; | 419 | static char buf[64]; |
424 | snprintf(buf, sizeof(buf), "Failed! Error: %d", rc); | 420 | snprintf(buf, sizeof(buf), "%s (%d)", installer_strerror(rc), rc); |
425 | const char* msg1 = rc == 0 ? "Success" : buf; | 421 | const char* msg1 = rc == 0 ? "Success" : buf; |
426 | const char* msg2 = "Press " BL_QUIT_NAME " to continue"; | 422 | const char* msg2 = "Press " BL_QUIT_NAME " to continue"; |
427 | splash2(0, msg1, msg2); | 423 | splash2(0, msg1, msg2); |
@@ -429,13 +425,6 @@ void bootloader_action(int which) | |||
429 | button_clear_queue(); | 425 | button_clear_queue(); |
430 | while(button_get(true) != BL_QUIT); | 426 | while(button_get(true) != BL_QUIT); |
431 | } | 427 | } |
432 | #else | ||
433 | void bootloader_action(int which) | ||
434 | { | ||
435 | (void)which; | ||
436 | splash(5*HZ, "Not implemented!"); | ||
437 | } | ||
438 | #endif | ||
439 | 428 | ||
440 | void bootloader_install(void) | 429 | void bootloader_install(void) |
441 | { | 430 | { |