summaryrefslogtreecommitdiffstats
path: root/rbutil/sansapatcher/main.c
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2007-10-14 18:09:40 +0000
committerBarry Wardell <rockbox@barrywardell.net>2007-10-14 18:09:40 +0000
commit080889a135bb5a1e34f8acae3c0a330d6bd620f5 (patch)
treec7fb29763633e23521123ee2d08cd1ded6071cff /rbutil/sansapatcher/main.c
parente6e597594dcfe31ff1447e1ca8e620e5fb3ba23e (diff)
downloadrockbox-080889a135bb5a1e34f8acae3c0a330d6bd620f5.tar.gz
rockbox-080889a135bb5a1e34f8acae3c0a330d6bd620f5.zip
Add support for installing/replacing the bootloader in the PPBL section of the firmware partition. Allows installation of the Rockbox bootloader in place of the Sandisk one. This expects a plain bootloader binary with no header. Our Rockbox bootloader successfully boots both Rockbox and the OF when installed in this way. This makes it easy to get to a state where e200tool is required, so care is advised.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15108 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/sansapatcher/main.c')
-rw-r--r--rbutil/sansapatcher/main.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/rbutil/sansapatcher/main.c b/rbutil/sansapatcher/main.c
index 4b07af14ec..fb87aec2a4 100644
--- a/rbutil/sansapatcher/main.c
+++ b/rbutil/sansapatcher/main.c
@@ -48,7 +48,8 @@ enum {
WRITE_FIRMWARE,
READ_PARTITION,
WRITE_PARTITION,
- UPDATE_OF
+ UPDATE_OF,
+ UPDATE_PPBL
};
void print_usage(void)
@@ -67,6 +68,7 @@ void print_usage(void)
fprintf(stderr," -a, --add-bootloader filename.mi4\n");
fprintf(stderr," -d, --delete-bootloader\n");
fprintf(stderr," -of --update-original-firmware filename.mi4\n");
+ fprintf(stderr," -bl --update-ppbl filename.bin\n");
fprintf(stderr,"\n");
#ifdef __WIN32__
@@ -225,6 +227,13 @@ int main(int argc, char* argv[])
if (i == argc) { print_usage(); return 1; }
filename=argv[i];
i++;
+ } else if ((strcmp(argv[i],"-bl")==0) ||
+ (strcmp(argv[i],"--update-ppbl")==0)) {
+ action = UPDATE_PPBL;
+ i++;
+ if (i == argc) { print_usage(); return 1; }
+ filename=argv[i];
+ i++;
} else if ((strcmp(argv[i],"-rf")==0) ||
(strcmp(argv[i],"--read-firmware")==0)) {
action = READ_FIRMWARE;
@@ -345,6 +354,25 @@ int main(int argc, char* argv[])
} else {
fprintf(stderr,"[ERR] --update-original-firmware failed.\n");
}
+ } else if (action==UPDATE_PPBL) {
+ printf("[WARN] PPBL installation will overwrite your bootloader. This will lead to a\n");
+ printf(" Sansa that won't boot if the bootloader file is invalid. Only continue if\n");
+ printf(" you're sure you know what you're doing.\n");
+ printf(" Continue (y/n)? ");
+
+ if (fgets(yesno,4,stdin)) {
+ if (yesno[0]=='y') {
+ if (sansa_reopen_rw(&sansa) < 0) {
+ return 5;
+ }
+
+ if (sansa_update_ppbl(&sansa, filename)==0) {
+ fprintf(stderr,"[INFO] PPBL updated successfully.\n");
+ } else {
+ fprintf(stderr,"[ERR] --update-ppbl failed.\n");
+ }
+ }
+ }
}
}