summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-08-21 22:37:27 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-08-21 22:37:27 +0000
commitf7b4ed369e6523c09b923bcb9a7c3c0dfa2ccc17 (patch)
treee2c8d29840a60354a1bcc86179bdceae4dd93757 /bootloader
parent9f6d3a758f1536dee408b41211804312e6fabcd7 (diff)
downloadrockbox-f7b4ed369e6523c09b923bcb9a7c3c0dfa2ccc17.tar.gz
rockbox-f7b4ed369e6523c09b923bcb9a7c3c0dfa2ccc17.tar.bz2
rockbox-f7b4ed369e6523c09b923bcb9a7c3c0dfa2ccc17.zip
Onda VX747/VX777 bootloader: make boot menu more robust + add reset Rockbox configuration option
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22459 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/ondavx747.c52
1 files changed, 42 insertions, 10 deletions
diff --git a/bootloader/ondavx747.c b/bootloader/ondavx747.c
index 496363c4b1..0cae73c174 100644
--- a/bootloader/ondavx747.c
+++ b/bootloader/ondavx747.c
@@ -83,8 +83,6 @@ static void usb_mode(void)
}
}
}
-
- reset_screen();
}
static int boot_of(void)
@@ -92,6 +90,11 @@ static int boot_of(void)
int fd, rc, len, i, checksum = 0;
void (*kernel_entry)(int, void*, void*);
+ printf("Mounting disk...");
+ rc = disk_mount_all();
+ if (rc <= 0)
+ error(EDISK,rc);
+
/* TODO: get this from the NAND flash instead of SD */
fd = open("/ccpmp.bin", O_RDONLY);
if(fd < 0)
@@ -140,7 +143,12 @@ static int boot_rockbox(void)
int rc;
void (*kernel_entry)(void);
- printf("Loading firmware");
+ printf("Mounting disk...");
+ rc = disk_mount_all();
+ if (rc <= 0)
+ error(EDISK,rc);
+
+ printf("Loading firmware...");
rc = load_firmware((unsigned char *)CONFIG_SDRAM_START, BOOTFILE, 0x400000);
if(rc < 0)
return rc;
@@ -157,6 +165,20 @@ static int boot_rockbox(void)
}
}
+static void reset_configuration(void)
+{
+ int rc;
+
+ rc = disk_mount_all();
+ if (rc <= 0)
+ error(EDISK,rc);
+
+ if(rename(ROCKBOX_DIR "/config.cfg", ROCKBOX_DIR "/config.old") == 0)
+ show_splash(HZ/2, "Configuration reset successfully!");
+ else
+ show_splash(HZ/2, "Couldn't reset configuration!");
+}
+
#define RECT_X (LCD_WIDTH/8)
#define RECT_Y(i) (LCD_HEIGHT/20 + LCD_HEIGHT/10*i + RECT_HEIGHT*i)
#define RECT_WIDTH (LCD_WIDTH*3/4)
@@ -165,10 +187,11 @@ static int boot_rockbox(void)
#define TEXT_Y(i) (RECT_Y(i) + RECT_HEIGHT/2 - SYSFONT_HEIGHT/2)
static int boot_menu(void)
{
- const char* strings[] = {"Boot Rockbox", "Boot OF", "USB mode"};
+ const char* strings[] = {"Boot Rockbox", "Boot OF", "USB mode", "Reset Rockbox configuration"};
int button, touch;
unsigned int i;
+ verbose = true;
adc_init();
redraw:
@@ -201,12 +224,19 @@ redraw:
switch(found)
{
case 0:
- return boot_rockbox();
+ reset_screen();
+ boot_rockbox();
+ break;
case 1:
- return boot_of();
+ reset_screen();
+ boot_of();
+ break;
case 2:
usb_mode();
break;
+ case 3:
+ reset_configuration();
+ break;
}
if(found != -1)
@@ -237,6 +267,9 @@ int main(void)
if(rc)
error(EATA, rc);
+ /* Don't mount the disks yet, there could be file system/partition errors
+ which are fixable in USB mode */
+
#ifdef HAVE_TOUCHSCREEN
rc = button_read_device(&dummy);
#else
@@ -249,6 +282,9 @@ int main(void)
#ifdef BUTTON_VOL_UP
if(rc & BUTTON_VOL_UP ||
#endif
+#ifdef BUTTON_POWER
+ rc & BUTTON_POWER ||
+#endif
0)
rc = boot_menu();
@@ -257,10 +293,6 @@ int main(void)
printf(MODEL_NAME" Rockbox Bootloader");
printf("Version "APPSVERSION);
- rc = disk_mount_all();
- if (rc <= 0)
- error(EDISK,rc);
-
#ifdef HAS_BUTTON_HOLD
if(button_hold())
rc = boot_of();