Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/harmn1/iphonelinux

Also, the NAND chip settings are now current for 2.2. If anyone else has problems, I'll look in an even newer iBoot.
  • Loading branch information...
commit 13d390104a5ca069ea5dfad86aef81cb869854d1 2 parents bd639e4 + ddc88ea
planetbeing authored
2  openiboot/ftl.c
View
@@ -1021,7 +1021,7 @@ int ftl_read(void* buffer, uint64_t offset, int size) {
return FALSE;
}
- int read = ((Data->bytesPerPage > toRead) ? toRead : Data->bytesPerPage);
+ int read = (((Data->bytesPerPage-pageOffset) > toRead) ? toRead : Data->bytesPerPage-pageOffset);
memcpy(curLoc, tBuffer + pageOffset, read);
curLoc += read;
toRead -= read;
10 openiboot/hfs/rawfile.c
View
@@ -86,7 +86,7 @@ int allocate(RawFile* rawFile, off_t size) {
}
/* zero out allocated block */
- ASSERT(WRITE(volume->image, curBlock * volume->volumeHeader->blockSize, volume->volumeHeader->blockSize, zeros), "WRITE");
+ ASSERT(WRITE(volume->image, ((uint64_t)curBlock) * volume->volumeHeader->blockSize, volume->volumeHeader->blockSize, zeros), "WRITE");
setBlockUsed(volume, curBlock, TRUE);
volume->volumeHeader->freeBlocks--;
@@ -195,12 +195,12 @@ static int rawFileRead(io_func* io,off_t location, size_t size, void *buffer) {
possible = extent->blockCount * blockSize - locationInBlock;
if(size > possible) {
- ASSERT(READ(volume->image, extent->startBlock * blockSize + locationInBlock, possible, buffer), "READ");
+ ASSERT(READ(volume->image, ((uint64_t)extent->startBlock) * blockSize + locationInBlock, possible, buffer), "READ");
size -= possible;
buffer = (void*)(((size_t)buffer) + possible);
extent = extent->next;
} else {
- ASSERT(READ(volume->image, extent->startBlock * blockSize + locationInBlock, size, buffer), "READ");
+ ASSERT(READ(volume->image, ((uint64_t)extent->startBlock) * blockSize + locationInBlock, size, buffer), "READ");
break;
}
@@ -251,12 +251,12 @@ static int rawFileWrite(io_func* io,off_t location, size_t size, void *buffer) {
possible = extent->blockCount * blockSize - locationInBlock;
if(size > possible) {
- ASSERT(WRITE(volume->image, extent->startBlock * blockSize + locationInBlock, possible, buffer), "WRITE");
+ ASSERT(WRITE(volume->image, ((uint64_t)extent->startBlock) * blockSize + locationInBlock, possible, buffer), "WRITE");
size -= possible;
buffer = (void*)(((size_t)buffer) + possible);
extent = extent->next;
} else {
- ASSERT(WRITE(volume->image, extent->startBlock * blockSize + locationInBlock, size, buffer), "WRITE");
+ ASSERT(WRITE(volume->image, ((uint64_t)extent->startBlock) * blockSize + locationInBlock, size, buffer), "WRITE");
break;
}
26 openiboot/nand.c
View
@@ -32,18 +32,20 @@ static uint8_t* aTemporarySBuf;
#define SECTOR_SIZE 512
static const NANDDeviceType SupportedDevices[] = {
- {0x2555D5EC, 8192, 0x80, 4, 64, 4, 2, 4, 2, 7744, 4, 6},
- {0xB614D5EC, 4096, 0x80, 8, 128, 4, 2, 4, 2, 3872, 4, 6},
- {0xB655D7EC, 8192, 0x80, 8, 128, 4, 2, 4, 2, 7744, 4, 6},
- {0xA514D3AD, 4096, 0x80, 4, 64, 4, 2, 4, 2, 3872, 4, 6},
- {0xA555D5AD, 8192, 0x80, 4, 64, 4, 2, 4, 2, 7744, 4, 6},
- {0xA585D598, 8320, 0x80, 4, 64, 6, 2, 4, 2, 7744, 4, 6},
- {0xBA94D598, 4096, 0x80, 8, 216, 6, 2, 4, 2, 3872, 8, 8},
- {0xBA95D798, 8192, 0x80, 8, 216, 6, 2, 4, 2, 7744, 8, 8},
- {0x3ED5D789, 8192, 0x80, 8, 216, 4, 2, 4, 2, 7744, 8, 8},
- {0x3E94D589, 4096, 0x80, 8, 216, 4, 2, 4, 2, 3872, 8, 8},
- {0x3ED5D72C, 8192, 0x80, 8, 216, 4, 2, 4, 2, 7744, 8, 8},
- {0x3E94D52C, 4096, 0x80, 8, 216, 4, 2, 4, 2, 3872, 8, 8},
+ {0x2555D5EC, 8192, 128, 4, 64, 4, 2, 4, 2, 7744, 4, 6},
+ {0xB614D5EC, 4096, 128, 8, 128, 4, 2, 4, 2, 3872, 4, 6},
+ {0xB655D7EC, 8192, 128, 8, 128, 4, 2, 4, 2, 7744, 4, 6},
+ {0xA514D3AD, 4096, 128, 4, 64, 4, 2, 4, 2, 3872, 4, 6},
+ {0xA555D5AD, 8192, 128, 4, 64, 4, 2, 4, 2, 7744, 4, 6},
+ {0xB614D5AD, 4096, 128, 8, 128, 4, 2, 4, 2, 3872, 4, 6},
+ {0xB655D7AD, 8192, 128, 8, 128, 4, 2, 4, 2, 7744, 4, 6},
+ {0xA585D598, 8320, 128, 4, 64, 6, 2, 4, 2, 7744, 4, 6},
+ {0xBA94D598, 4096, 128, 8, 216, 6, 2, 4, 2, 3872, 8, 8},
+ {0xBA95D798, 8192, 128, 8, 216, 6, 2, 4, 2, 7744, 8, 8},
+ {0x3ED5D789, 8192, 128, 8, 216, 4, 2, 4, 2, 7744, 8, 8},
+ {0x3E94D589, 4096, 128, 8, 216, 4, 2, 4, 2, 3872, 8, 8},
+ {0x3ED5D72C, 8192, 128, 8, 216, 4, 2, 4, 2, 7744, 8, 8},
+ {0x3E94D52C, 4096, 128, 8, 216, 4, 2, 4, 2, 3872, 8, 8},
{0}
};
50 tools/dumpnandinfo.c
View
@@ -0,0 +1,50 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+typedef struct NANDDeviceType {
+ uint32_t id;
+ uint16_t blocksPerBank;
+ uint16_t pagesPerBlock;
+ uint16_t sectorsPerPage;
+ uint16_t bytesPerSpare;
+ uint8_t WPPulseTime;
+ uint8_t WEHighHoldTime;
+ uint8_t NANDSetting3;
+ uint8_t NANDSetting4;
+ uint32_t userSubBlksTotal;
+ uint32_t ecc1;
+ uint32_t ecc2;
+} NANDDeviceType;
+
+int main(int argc, char* argv[])
+{
+ if(argc < 3)
+ {
+ printf("Spit out a struct openiboot can use to configure NAND parameters from the similar table in iBoot.\n\n");
+ printf("Usage: %s <decrypted iboot file> <offset>\n", argv[0]);
+ return 0;
+ }
+
+ printf("static const NANDDeviceType SupportedDevices[] = {\n");
+ uint32_t offset = strtol(argv[2], NULL, 0);
+ FILE* f = fopen(argv[1], "rb");
+
+ fseek(f, offset, SEEK_SET);
+ while(1)
+ {
+ NANDDeviceType entry;
+ fread(&entry, 1, sizeof(entry), f);
+ if(entry.id == 0)
+ break;
+
+ printf("\t{0x%X, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d},\n",
+ entry.id, entry.blocksPerBank, entry.pagesPerBlock, entry.sectorsPerPage, entry.bytesPerSpare,
+ entry.WPPulseTime, entry.WEHighHoldTime, entry.NANDSetting3, entry.NANDSetting4,
+ entry.userSubBlksTotal, entry.ecc1, entry.ecc2);
+ }
+
+ printf("\t{0}\n};\n");
+
+ fclose(f);
+}
Please sign in to comment.
Something went wrong with that request. Please try again.