MTD password protection
KRISHNAN SUDHAKAR-NRD743
sudhakark at motorola.com
Mon Nov 3 07:26:17 EST 2008
Hi all,
Presently I am working on password protection for sector in spansion
flash.
I am new to Linux I understood the MTD code flow like the following
1) The mtd erase operation goes through like the following
mtdchar.c -> cfi_cmdset_0002.c -> cfi_util.c -> erase the flash(?) ->
cfi_cmdset_0002.c (call back) -> mtdpart.c(callback) ->
mtdchar.c(callback)
2) In "cfi_cmdset_0002.c" the "mtd->erase" will be pointed to
"cfi_amdstd_erase_varsize"
2.1) In "mtdchar.c" case MEMERASE uses the mtd->erase pointed in
"cfi_cmdset_0002.c" I.e. "cfi_amdstd_erase_varsize"
2.2) The "cfi_amdstd_erase_varsize" uses the call back function
"mtd_erase_callback" (mtdpart.c)
Please let me know is my understanding is correct?
I have proceeded like,
1) I have written utility "passread" which will take sector id as
parameter.
2) In mtdchar.c ioctl function added one switch case.
3) In the mtdchar.c switch case, through function pointer calling the
function in "cfi_cmdset_0002.c"
4) In cfi_cmdset_0002.c file initialized the mtd->passread with the
fucntion I need to call in "*cfi_cmdset_0002" function.
Finally ended with "Segmentation fault" in mtdchar.c during the function
pointer calling.
I believe that the mtd->passread is not initialized. But I have
initialized the same in "*cfi_cmdset_0002" function but still getting
error and don't know how to do that.
Please suggest me what wrong I have did?
Regards
Sudhakar
More information about the linux-mtd
mailing list