diff options
-rw-r--r-- | tools/ipod_fw.c | 33 |
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) | |||
282 | }; | 282 | }; |
283 | int images_done = 0; | 283 | int images_done = 0; |
284 | unsigned version = 0, offset = 0, len = 0; | 284 | unsigned version = 0, offset = 0, len = 0; |
285 | int needs_rcsc = 0; | ||
285 | 286 | ||
286 | test_endian(); | 287 | test_endian(); |
287 | 288 | ||
@@ -318,6 +319,9 @@ main(int argc, char **argv) | |||
318 | (strcasecmp(optarg, "5g") == 0)) { | 319 | (strcasecmp(optarg, "5g") == 0)) { |
319 | fw_version = 3; | 320 | fw_version = 3; |
320 | image.addr = 0x10000000; | 321 | image.addr = 0x10000000; |
322 | if ((strcasecmp(optarg, "5g") == 0) || (strcasecmp(optarg, "video") == 0)) { | ||
323 | needs_rcsc = 1; | ||
324 | } | ||
321 | } | 325 | } |
322 | else if ((strcasecmp(optarg, "1g") != 0) && | 326 | else if ((strcasecmp(optarg, "1g") != 0) && |
323 | (strcasecmp(optarg, "2g") != 0) && | 327 | (strcasecmp(optarg, "2g") != 0) && |
@@ -512,6 +516,35 @@ main(int argc, char **argv) | |||
512 | if (write_entry(&image, out, TBL, 0) == -1) | 516 | if (write_entry(&image, out, TBL, 0) == -1) |
513 | return 1; | 517 | return 1; |
514 | if (verbose) print_image(&image, "Master image: "); | 518 | if (verbose) print_image(&image, "Master image: "); |
519 | |||
520 | if (needs_rcsc) { | ||
521 | image_t rsrc; | ||
522 | |||
523 | if ((in = fopen("apple_sw_5g_rcsc.bin", "rb")) == NULL) { | ||
524 | fprintf(stderr, "Cannot open firmware image file %s\n", "apple_sw_5g_rcsc.bin"); | ||
525 | return 1; | ||
526 | } | ||
527 | if (load_entry(&rsrc, in, 0, 0) == -1) { | ||
528 | return 1; | ||
529 | } | ||
530 | rsrc.devOffset = image.devOffset + image.len; | ||
531 | rsrc.devOffset = ((rsrc.devOffset + 0x1ff) & ~0x1ff) + 0x200; | ||
532 | if (fseek(out, rsrc.devOffset + IMAGE_PADDING, SEEK_SET) == -1) { | ||
533 | fprintf(stderr, "fseek failed: %s\n", strerror(errno)); | ||
534 | return 1; | ||
535 | } | ||
536 | if ((rsrc.chksum = copysum(in, out, rsrc.len, 0x200)) == -1) { | ||
537 | return 1; | ||
538 | } | ||
539 | fclose(in); | ||
540 | |||
541 | if (write_entry(&rsrc, out, TBL, 1) == -1) { | ||
542 | return 1; | ||
543 | } | ||
544 | |||
545 | if (verbose) print_image(&rsrc, "rsrc image: "); | ||
546 | } | ||
547 | |||
515 | return 0; | 548 | return 0; |
516 | } | 549 | } |
517 | 550 | ||