support dual header nandfirm image

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@252 4ee2a332-4b2b-5046-8439-1ba90f034370
This commit is contained in:
yutaka 2007-08-24 08:07:38 +00:00
parent 8faf7a4f6b
commit 74db391601

View File

@ -255,12 +255,18 @@ void TwlSpMain(void)
arm9_size = *(u32*)(((u8*)block_buf)+0x2C);
arm7_ofs = *(u32*)(((u8*)block_buf)+0x30);
arm7_size = *(u32*)(((u8*)block_buf)+0x3C);
if (arm9_ofs == 0x800 || arm7_ofs == 0x800) // there is a duplicate header for mirroring
{
nandRtfsIo( 5, 3, (byte*)block_buf, 1, TRUE); // get header for mirroring image
arm9_ofs = *(u32*)(((u8*)block_buf)+0x20);
arm7_ofs = *(u32*)(((u8*)block_buf)+0x30);
}
// DBG_PRINTF( "arm9: 0x%x, 0x%x\n", arm9_ofs, arm9_size);
// DBG_PRINTF( "arm7: 0x%x, 0x%x\n", arm7_ofs, arm7_size);
if( ((arm9_ofs + arm9_size) == arm7_ofs) && (arm9_ofs < arm7_ofs) &&
(arm9_size != 0) && (arm7_size != 0)) {
nand_firm_size = arm7_ofs + arm7_size;
nand_firm_size = (arm9_ofs < arm7_ofs ? arm7_ofs + arm7_size : arm9_ofs + arm9_size);
DBG_PRINTF( "nandfirm found. (size:0x%x bytes)\n", nand_firm_size);
nand_firm_size = (nand_firm_size / 1024 / 1024) +
(((nand_firm_size % (1024*1024)) != 0)? 1:0);