mirror of
https://github.com/sharkcz/rkdeveloptool.git
synced 2024-11-22 14:06:47 +01:00
1.fix erase ubi bug
2.fix download ubi bug Signed-off-by: liuyi <liuyi@rock-chips.com>
This commit is contained in:
parent
e541b7bbff
commit
e607a5d6ad
18
main.cpp
18
main.cpp
@ -1042,9 +1042,6 @@ bool write_gpt(STRUCT_RKDEVICE_DESC &dev, char *szParameter)
|
|||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
if (vecItems[vecItems.size()-1].uiItemSize!=0xFFFFFFFF)
|
|
||||||
total_size_sector = vecItems[vecItems.size()-1].uiItemOffset + vecItems[vecItems.size()-1].uiItemSize + 33
|
|
||||||
//vecItems[vecItems.size()-1].uiItemSize = total_size_sector - 33;
|
|
||||||
//3.generate gpt info
|
//3.generate gpt info
|
||||||
create_gpt_buffer(master_gpt, vecItems, vecUuid, total_size_sector);
|
create_gpt_buffer(master_gpt, vecItems, vecUuid, total_size_sector);
|
||||||
memcpy(backup_gpt, master_gpt + 2* SECTOR_SIZE, 32 * SECTOR_SIZE);
|
memcpy(backup_gpt, master_gpt + 2* SECTOR_SIZE, 32 * SECTOR_SIZE);
|
||||||
@ -2600,13 +2597,11 @@ bool erase_ubi_block(STRUCT_RKDEVICE_DESC &dev, u32 uiOffset, u32 uiPartSize)
|
|||||||
goto EXIT_UBI_ERASE;
|
goto EXIT_UBI_ERASE;
|
||||||
}
|
}
|
||||||
if (uiPartSize==0xFFFFFFFF)
|
if (uiPartSize==0xFFFFFFFF)
|
||||||
uiPartSize = info.uiFlashSize - uiOffset - (info.usBlockSize * 4);
|
uiPartSize = info.uiFlashSize - uiOffset;
|
||||||
|
|
||||||
uiStartBlock = uiOffset / info.usBlockSize;
|
uiStartBlock = uiOffset / info.usBlockSize;
|
||||||
if ((uiPartSize % info.usBlockSize) == 0)
|
uiEraseBlock = (uiPartSize + info.usBlockSize -1) / info.usBlockSize;
|
||||||
uiEraseBlock = uiPartSize / info.usBlockSize;
|
|
||||||
else
|
|
||||||
uiEraseBlock = uiPartSize / info.usBlockSize + 1;
|
|
||||||
|
|
||||||
printf("Erase block start, offset=0x%08x,count=0x%08x!\r\n",uiStartBlock,uiEraseBlock);
|
printf("Erase block start, offset=0x%08x,count=0x%08x!\r\n",uiStartBlock,uiEraseBlock);
|
||||||
uiErasePos=uiStartBlock;
|
uiErasePos=uiStartBlock;
|
||||||
@ -3204,7 +3199,12 @@ bool handle_command(int argc, char* argv[], CRKScan *pScan)
|
|||||||
else {
|
else {
|
||||||
bSuccess = true;
|
bSuccess = true;
|
||||||
if (is_ubifs_image(argv[3]))
|
if (is_ubifs_image(argv[3]))
|
||||||
bSuccess = erase_ubi_block(dev, (u32)lba, (u32)(lba_end - lba + 1));
|
{
|
||||||
|
if (lba_end == 0xFFFFFFFF)
|
||||||
|
bSuccess = erase_ubi_block(dev, (u32)lba, (u32)lba_end);
|
||||||
|
else
|
||||||
|
bSuccess = erase_ubi_block(dev, (u32)lba, (u32)(lba_end - lba + 1));
|
||||||
|
}
|
||||||
if (bSuccess)
|
if (bSuccess)
|
||||||
bSuccess = write_lba(dev, (u32)lba, argv[3]);
|
bSuccess = write_lba(dev, (u32)lba, argv[3]);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user