summaryrefslogtreecommitdiffstats
path: root/tools/ipod_fw.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2005-12-18 12:40:40 +0000
committerDave Chapman <dave@dchapman.com>2005-12-18 12:40:40 +0000
commit3f9789b45a971418025a23a437a9c9384c61e2f7 (patch)
tree32e1983e148daa900f8c30334f8a7490c4a43115 /tools/ipod_fw.c
parentfeca29576fe58f0962e9c0299dfb494e1a06c2dc (diff)
downloadrockbox-3f9789b45a971418025a23a437a9c9384c61e2f7.tar.gz
rockbox-3f9789b45a971418025a23a437a9c9384c61e2f7.tar.bz2
rockbox-3f9789b45a971418025a23a437a9c9384c61e2f7.zip
Sync with ipodlinux CVS - add support for 5g (video) iPods
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8260 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/ipod_fw.c')
-rw-r--r--tools/ipod_fw.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/ipod_fw.c b/tools/ipod_fw.c
index 8f07854bc1..c2854edaa3 100644
--- a/tools/ipod_fw.c
+++ b/tools/ipod_fw.c
@@ -282,6 +282,7 @@ main(int argc, char **argv)
};
int images_done = 0;
unsigned version = 0, offset = 0, len = 0;
+ int needs_rcsc = 0;
test_endian();
@@ -318,6 +319,9 @@ main(int argc, char **argv)
(strcasecmp(optarg, "5g") == 0)) {
fw_version = 3;
image.addr = 0x10000000;
+ if ((strcasecmp(optarg, "5g") == 0) || (strcasecmp(optarg, "video") == 0)) {
+ needs_rcsc = 1;
+ }
}
else if ((strcasecmp(optarg, "1g") != 0) &&
(strcasecmp(optarg, "2g") != 0) &&
@@ -512,6 +516,35 @@ main(int argc, char **argv)
if (write_entry(&image, out, TBL, 0) == -1)
return 1;
if (verbose) print_image(&image, "Master image: ");
+
+ if (needs_rcsc) {
+ image_t rsrc;
+
+ if ((in = fopen("apple_sw_5g_rcsc.bin", "rb")) == NULL) {
+ fprintf(stderr, "Cannot open firmware image file %s\n", "apple_sw_5g_rcsc.bin");
+ return 1;
+ }
+ if (load_entry(&rsrc, in, 0, 0) == -1) {
+ return 1;
+ }
+ rsrc.devOffset = image.devOffset + image.len;
+ rsrc.devOffset = ((rsrc.devOffset + 0x1ff) & ~0x1ff) + 0x200;
+ if (fseek(out, rsrc.devOffset + IMAGE_PADDING, SEEK_SET) == -1) {
+ fprintf(stderr, "fseek failed: %s\n", strerror(errno));
+ return 1;
+ }
+ if ((rsrc.chksum = copysum(in, out, rsrc.len, 0x200)) == -1) {
+ return 1;
+ }
+ fclose(in);
+
+ if (write_entry(&rsrc, out, TBL, 1) == -1) {
+ return 1;
+ }
+
+ if (verbose) print_image(&rsrc, "rsrc image: ");
+ }
+
return 0;
}