summaryrefslogtreecommitdiff
path: root/bootloader/main-pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/main-pp.c')
-rw-r--r--bootloader/main-pp.c55
1 files changed, 19 insertions, 36 deletions
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index 8381aa2d8a..b26807dd62 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -543,6 +543,25 @@ void* main(void)
543 i, pinfo->type, pinfo->size / 2048); 543 i, pinfo->type, pinfo->size / 2048);
544 } 544 }
545 545
546 /* Try loading Rockbox, if that fails, fall back to the OF */
547 if((btn & BOOTLOADER_BOOT_OF) == 0)
548 {
549 printf("Loading Rockbox...");
550 rc = load_mi4(loadbuffer, BOOTFILE, MAX_LOADSIZE);
551 if (rc < EOK)
552 {
553 bool old_verbose = verbose;
554 verbose = true;
555 printf("Can't load " BOOTFILE ": ");
556 printf(strerror(rc));
557 verbose = old_verbose;
558 btn |= BOOTLOADER_BOOT_OF;
559 sleep(5*HZ);
560 }
561 else
562 return (void*)loadbuffer;
563 }
564
546 if(btn & BOOTLOADER_BOOT_OF) 565 if(btn & BOOTLOADER_BOOT_OF)
547 { 566 {
548 /* Load original mi4 firmware in to a memory buffer called loadbuffer. 567 /* Load original mi4 firmware in to a memory buffer called loadbuffer.
@@ -602,42 +621,6 @@ void* main(void)
602 } 621 }
603 622
604 error(0, 0); 623 error(0, 0);
605
606 } else {
607#if 0 /* e200: enable to be able to dump the hidden partition */
608 if(btn & BUTTON_UP)
609 {
610 int fd;
611 pinfo = disk_partinfo(1);
612 fd = open("/part.bin", O_CREAT|O_RDWR);
613 char sector[512];
614 for(i=0; i<40960; i++){
615 if (!(i%100))
616 {
617 printf("dumping sector %d", i);
618 }
619 storage_read_sectors(IF_MV2(0,) pinfo->start + i, 1, sector);
620 write(fd,sector,512);
621 }
622 close(fd);
623 }
624#endif
625 printf("Loading Rockbox...");
626 rc=load_mi4(loadbuffer, BOOTFILE, MAX_LOADSIZE);
627 if (rc < EOK) {
628 printf("Can't load " BOOTFILE ": ");
629 printf(strerror(rc));
630
631#ifdef OLD_BOOTFILE
632 /* Try loading rockbox from old rockbox.e200/rockbox.h10 format */
633 rc=load_firmware(loadbuffer, OLD_BOOTFILE, MAX_LOADSIZE);
634 if (rc < EOK) {
635 printf("Can't load " OLD_BOOTFILE" : ");
636 error(EBOOTFILE, rc);
637 }
638#endif
639 }
640 } 624 }
641
642 return (void*)loadbuffer; 625 return (void*)loadbuffer;
643} 626}