diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-09-20 08:28:18 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-09-20 08:28:18 +0000 |
commit | 6d1d9bed3ea567c74d787c0450c6de193e232851 (patch) | |
tree | fe406086d25f5f7956880c91ae45f599cbe1bf79 /utils/MTP/beastpatcher/main.c | |
parent | fc30b183c826ce006b531a24acfb3484bdd9871b (diff) | |
download | rockbox-6d1d9bed3ea567c74d787c0450c6de193e232851.tar.gz rockbox-6d1d9bed3ea567c74d787c0450c6de193e232851.zip |
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
Diffstat (limited to 'utils/MTP/beastpatcher/main.c')
-rw-r--r-- | utils/MTP/beastpatcher/main.c | 33 |
1 files changed, 27 insertions, 6 deletions
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 @@ | |||
56 | enum actions { | 56 | enum actions { |
57 | NONE, | 57 | NONE, |
58 | INSTALL, | 58 | INSTALL, |
59 | DUALBOOT, | ||
59 | SEND, | 60 | SEND, |
60 | HELP | 61 | HELP |
61 | }; | 62 | }; |
@@ -66,11 +67,13 @@ static void print_usage(void) | |||
66 | fprintf(stderr,"\n"); | 67 | fprintf(stderr,"\n"); |
67 | fprintf(stderr,"Where [action] is one of the following options:\n"); | 68 | fprintf(stderr,"Where [action] is one of the following options:\n"); |
68 | #ifdef WITH_BOOTOBJS | 69 | #ifdef WITH_BOOTOBJS |
69 | fprintf(stderr," -i, --install <bootloader.bin>\n"); | 70 | fprintf(stderr," -i, --install [bootloader.bin]\n"); |
71 | fprintf(stderr," -d, --dual-boot <nk.bin> [bootloader.bin]\n"); | ||
70 | #else | 72 | #else |
71 | fprintf(stderr," -i, --install bootloader.bin\n"); | 73 | fprintf(stderr," -i, --install <bootloader.bin>\n"); |
74 | fprintf(stderr," -d --dual-boot <nk.bin> <bootloader.bin>\n"); | ||
72 | #endif | 75 | #endif |
73 | fprintf(stderr," -s, --send nk.bin\n"); | 76 | fprintf(stderr," -s, --send <nk.bin>\n"); |
74 | fprintf(stderr," -h, --help\n"); | 77 | fprintf(stderr," -h, --help\n"); |
75 | fprintf(stderr,"\n"); | 78 | fprintf(stderr,"\n"); |
76 | #ifdef WITH_BOOTOBJS | 79 | #ifdef WITH_BOOTOBJS |
@@ -88,9 +91,9 @@ int main(int argc, char* argv[]) | |||
88 | char* bootloader = NULL; | 91 | char* bootloader = NULL; |
89 | char* firmware = NULL; | 92 | char* firmware = NULL; |
90 | #ifdef WITH_BOOTOBJS | 93 | #ifdef WITH_BOOTOBJS |
91 | int action = INSTALL; | 94 | enum actions action = INSTALL; |
92 | #else | 95 | #else |
93 | int action = NONE; | 96 | enum actions action = NONE; |
94 | #endif | 97 | #endif |
95 | 98 | ||
96 | fprintf(stderr,"beastpatcher v" VERSION " - (C) 2009 by the Rockbox developers\n"); | 99 | fprintf(stderr,"beastpatcher v" VERSION " - (C) 2009 by the Rockbox developers\n"); |
@@ -113,6 +116,20 @@ int main(int argc, char* argv[]) | |||
113 | } | 116 | } |
114 | #endif | 117 | #endif |
115 | } | 118 | } |
119 | else if(strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "--dual-boot") == 0) { | ||
120 | action = DUALBOOT; | ||
121 | if(((i + 1) < argc) && argv[i + 1][0] != '-') { | ||
122 | firmware = argv[++i]; | ||
123 | #ifndef WITH_BOOTOBJS | ||
124 | if(((i + 1) < argc) && argv[i + 1][0] != '-') { | ||
125 | bootloader = argv[++i]; | ||
126 | } | ||
127 | #endif | ||
128 | } | ||
129 | else { | ||
130 | action = NONE; | ||
131 | } | ||
132 | } | ||
116 | else if(((strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--send") == 0) | 133 | else if(((strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--send") == 0) |
117 | && (i + 1) < argc)) { | 134 | && (i + 1) < argc)) { |
118 | action = SEND; | 135 | action = SEND; |
@@ -132,8 +149,11 @@ int main(int argc, char* argv[]) | |||
132 | else if(action == SEND) { | 149 | else if(action == SEND) { |
133 | res = sendfirm(firmware); | 150 | res = sendfirm(firmware); |
134 | } | 151 | } |
152 | else if(action == DUALBOOT) { | ||
153 | res = beastpatcher(bootloader, firmware); | ||
154 | } | ||
135 | else if(action == INSTALL) { | 155 | else if(action == INSTALL) { |
136 | res = beastpatcher(bootloader); | 156 | res = beastpatcher(bootloader, NULL); |
137 | /* don't ask for enter if started with command line arguments */ | 157 | /* don't ask for enter if started with command line arguments */ |
138 | if(argc == 1) { | 158 | if(argc == 1) { |
139 | printf("\nPress ENTER to exit beastpatcher: "); | 159 | printf("\nPress ENTER to exit beastpatcher: "); |
@@ -142,3 +162,4 @@ int main(int argc, char* argv[]) | |||
142 | } | 162 | } |
143 | return res; | 163 | return res; |
144 | } | 164 | } |
165 | |||