From 6d1d9bed3ea567c74d787c0450c6de193e232851 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 20 Sep 2009 08:28:18 +0000 Subject: Integrate mknkboot into beastpatcher. Add a new option to beastpatcher to patch and upload an original firmware file. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22745 a1c6a512-1295-4272-9138-f99709370657 --- utils/MTP/beastpatcher/main.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'utils/MTP/beastpatcher/main.c') diff --git a/utils/MTP/beastpatcher/main.c b/utils/MTP/beastpatcher/main.c index 873dad5c7f..315f78b264 100644 --- a/utils/MTP/beastpatcher/main.c +++ b/utils/MTP/beastpatcher/main.c @@ -56,6 +56,7 @@ enum actions { NONE, INSTALL, + DUALBOOT, SEND, HELP }; @@ -66,11 +67,13 @@ static void print_usage(void) fprintf(stderr,"\n"); fprintf(stderr,"Where [action] is one of the following options:\n"); #ifdef WITH_BOOTOBJS - fprintf(stderr," -i, --install \n"); + fprintf(stderr," -i, --install [bootloader.bin]\n"); + fprintf(stderr," -d, --dual-boot [bootloader.bin]\n"); #else - fprintf(stderr," -i, --install bootloader.bin\n"); + fprintf(stderr," -i, --install \n"); + fprintf(stderr," -d --dual-boot \n"); #endif - fprintf(stderr," -s, --send nk.bin\n"); + fprintf(stderr," -s, --send \n"); fprintf(stderr," -h, --help\n"); fprintf(stderr,"\n"); #ifdef WITH_BOOTOBJS @@ -88,9 +91,9 @@ int main(int argc, char* argv[]) char* bootloader = NULL; char* firmware = NULL; #ifdef WITH_BOOTOBJS - int action = INSTALL; + enum actions action = INSTALL; #else - int action = NONE; + enum actions action = NONE; #endif fprintf(stderr,"beastpatcher v" VERSION " - (C) 2009 by the Rockbox developers\n"); @@ -113,6 +116,20 @@ int main(int argc, char* argv[]) } #endif } + else if(strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "--dual-boot") == 0) { + action = DUALBOOT; + if(((i + 1) < argc) && argv[i + 1][0] != '-') { + firmware = argv[++i]; +#ifndef WITH_BOOTOBJS + if(((i + 1) < argc) && argv[i + 1][0] != '-') { + bootloader = argv[++i]; + } +#endif + } + else { + action = NONE; + } + } else if(((strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--send") == 0) && (i + 1) < argc)) { action = SEND; @@ -132,8 +149,11 @@ int main(int argc, char* argv[]) else if(action == SEND) { res = sendfirm(firmware); } + else if(action == DUALBOOT) { + res = beastpatcher(bootloader, firmware); + } else if(action == INSTALL) { - res = beastpatcher(bootloader); + res = beastpatcher(bootloader, NULL); /* don't ask for enter if started with command line arguments */ if(argc == 1) { printf("\nPress ENTER to exit beastpatcher: "); @@ -142,3 +162,4 @@ int main(int argc, char* argv[]) } return res; } + -- cgit v1.2.3