summaryrefslogtreecommitdiffstats
path: root/rbutil/ipodpatcher/main.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-06-16 22:32:57 +0000
committerDave Chapman <dave@dchapman.com>2007-06-16 22:32:57 +0000
commit56780e3e417cb1b9d1d453592d58c988c8029c16 (patch)
tree78cf5d5ebb36348932bc7f425a107d838b656fe9 /rbutil/ipodpatcher/main.c
parent9e0dfa1a533206200d2fcc87113417d8676e8fd7 (diff)
downloadrockbox-56780e3e417cb1b9d1d453592d58c988c8029c16.tar.gz
rockbox-56780e3e417cb1b9d1d453592d58c988c8029c16.tar.bz2
rockbox-56780e3e417cb1b9d1d453592d58c988c8029c16.zip
Initial integration of a --format option, based on fat32format.exe. The main limitation is that it only works on disks with 512-byte sectors - it needs adapting to the 2048-byte sector ipods. It has only been tested on Linux and Mac OS X, with a 60GB ipod Color, but appears to work.... When this feature has been more widely tested, the intention is to add code to convert the information in an Apple Partition Map (which can currently be read by ipodpatcher) to a DOS partition table, and hence allow conversion of Macpods to Winpods.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13643 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/ipodpatcher/main.c')
-rw-r--r--rbutil/ipodpatcher/main.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/rbutil/ipodpatcher/main.c b/rbutil/ipodpatcher/main.c
index 0983af768f..a4508abf57 100644
--- a/rbutil/ipodpatcher/main.c
+++ b/rbutil/ipodpatcher/main.c
@@ -46,7 +46,8 @@ enum {
READ_FIRMWARE,
WRITE_FIRMWARE,
READ_PARTITION,
- WRITE_PARTITION
+ WRITE_PARTITION,
+ FORMAT_PARTITION
};
void print_macpod_warning(void)
@@ -85,6 +86,7 @@ void print_usage(void)
fprintf(stderr," -a, --add-bootloader filename.ipod\n");
fprintf(stderr," -ab, --add-bootloader-bin filename.bin\n");
fprintf(stderr," -d, --delete-bootloader\n");
+ fprintf(stderr," -f, --format\n");
fprintf(stderr,"\n");
#ifdef __WIN32__
@@ -128,9 +130,7 @@ void display_partinfo(struct ipod_t* ipod)
int main(int argc, char* argv[])
{
-#ifdef WITH_BOOTOBJS
char yesno[4];
-#endif
int i;
int n;
int infile, outfile;
@@ -293,6 +293,10 @@ int main(int argc, char* argv[])
(strcmp(argv[i],"--verbose")==0)) {
verbose++;
i++;
+ } else if ((strcmp(argv[i],"-f")==0) ||
+ (strcmp(argv[i],"--format")==0)) {
+ action = FORMAT_PARTITION;
+ i++;
} else {
print_usage(); return 1;
}
@@ -465,6 +469,23 @@ int main(int argc, char* argv[])
}
close(infile);
+ } else if (action==FORMAT_PARTITION) {
+ printf("WARNING!!! YOU ARE ABOUT TO USE AN EXPERIMENTAL FORMATTING FEATURE.\n");
+ printf("Are you sure you want to continue? (y/n):");
+
+ if (fgets(yesno,4,stdin)) {
+ if (yesno[0]=='y') {
+ if (ipod_reopen_rw(&ipod) < 0) {
+ return 5;
+ }
+
+ if (format_partition(&ipod,1) < 0) {
+ fprintf(stderr,"[ERR] Format failed.\n");
+ }
+ } else {
+ fprintf(stderr,"[INFO] Format cancelled.\n");
+ }
+ }
}
ipod_close(&ipod);