02-24-2012, 12:19 PM
|
|
VIP Member
Offline
Threadstarter
Location: NY
|
|
Join Date: Feb 2010
Posts: 1,534
Mentioned: 2 Post(s)
Tagged: 0 Thread(s)
|
|
Re: [TESTING] - NAND OMGB (1.2.3)
Quote:
Originally Posted by muziling
Finally, easy to prevent erase or overwrite protected partition
platform/msm_shared/nand.c
Code:
int flash_erase(struct ptentry *ptn)
{
unsigned block = ptn->start;
unsigned count = ptn->length;
if (ptn->perm == PERM_NON_WRITEABLE) {
dprintf(INFO, "%s partition is protected, can't be erased.\n", ptn->name);
return -1;
}
set_nand_configuration(ptn->type);
while(count-- > 0) {
if(flash_erase_block(flash_cmdlist, flash_ptrlist, block * 64)) {
dprintf(INFO, "cannot erase @ %d (bad block?)\n", block);
}
block++;
}
return 0;
}
int flash_write(struct ptentry *ptn, unsigned extra_per_page, const void *data,
unsigned bytes)
{
unsigned page = ptn->start * 64;
unsigned lastpage = (ptn->start + ptn->length) * 64;
unsigned *spare = (unsigned*) flash_spare;
const unsigned char *image = data;
unsigned wsize = flash_pagesize + extra_per_page;
unsigned n;
int r;
if (ptn->type == TYPE_MODEM_PARTITION)
{
dprintf(CRITICAL, "flash_write_image: model partition not supported\n");
return -1;
}
if (ptn->perm == PERM_NON_WRITEABLE) {
dprintf(INFO, "%s partition is protected, can't be overwrited.\n", ptn->name);
return -1;
}
Tested pass:
|
No, bad method. We arent supposed to keep those partitions. So what i might end up doing is reading, and removing them from the ptable. flash_erase is actually stock code from google/ca since it's not meant to check permissions. But really dood, you are wasting my time with this because you decided to wipe your own nand ? come on man stop spamming my thread.
|