Skip to contentSkip to conversation

MTD driver

DISCUSSION Subrahmanyam 3 participants 5 messages Dec 9, 2004 – Dec 13, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi Stephen,

Yes as you have said I shall setup a dedicated partition to give access a particular location in flash. We, have an Intel starta NOR flash which uses cfi command set driver, which basically i guess takes care of the erase operation too. I have accessed the target through minicom tool, is this where i have to set up an additional partition?, can you suggest any site or procedure by which I can acheive setting up an additional partition.

Yes, Thomas has suggested that i indeed use a filesystem, but how can I best achieve it! I mean the procedure to store data in a file.

Thanks,
Subrahmanyam.

Quoted 59 lines

----- Original Message -----
From: "Stephan Linke" <[email protected]>
To: "Subrahmanyam" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, December 08, 2004 03:33 PM
Subject: RE: MTD driver

Quoted 49 lines

Hi,

you may setup a dedicated partition that gives you access to the particular location in the flash where you whant to place this data. Then you can use normal open() read() write() and seek() functions to access what ever byte in this partition. How to erass a block you can look up in one of the MTD tools. (Only if you are using NAND flash you should not do it like this since bad block handling whould be missing.)
But I aggree with Thomas. Best whould be to put it into a filesystem...

Stephan

Quoted 35 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Thomas Gleixner
Sent: Mittwoch, 8. Dezember 2004 07:37
To: Subrahmanyam
Cc: [email protected]
Subject: Re: MTD driver

Quoted 5 lines · Subrahmanyam

Hi,

I need to provide an user interface/GUI wherein when a certain data
(string/key) is entered, it should basically store the key in the flash (this basically happens during run time after the target has been

identified

Quoted 6 lines

by the host).

In the target we have a flash in which there is jffs2 file system and also mtd drivers, since i need to store block oriented data, i am looking at the possiblity of using mtd driver and storing data(key) in a particular location in flash. How should i proceed in acheiving the same.

Is there any good reason, why the key cannot be stored on the already available jffs2 filesystem ?

tglx

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#1 lore raw

Hi Subrahmanyam,

to setup a separate partition you should have a look at the files in mtd/maps directory.

The rest is simple as long as you whant to access it from user space. Just use open/lseek/write (see man pages (2)) on either the filedescriptor of a regular file or the device inode of the new flash partition.

If you need to access the data from within kernel code it is slightly different. If you write to a flash partition you can find some ideas how to do it in mtd/maps. About writing a file from within kernel code I can only tell you that it is possible but I have no experience.

Stephan

Quoted 98 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Subrahmanyam
Sent: Donnerstag, 9. Dezember 2004 04:38
To: [email protected]
Subject: MTD driver

Hi Stephen,

Yes as you have said I shall setup a dedicated partition to give access a particular location in flash. We, have an Intel starta NOR flash which uses cfi command set driver, which basically i guess takes care of the erase operation too. I have accessed the target through minicom tool, is this where i have to set up an additional partition?, can you suggest any site
or
procedure by which I can acheive setting up an additional partition.

Yes, Thomas has suggested that i indeed use a filesystem, but how can I
best
achieve it! I mean the procedure to store data in a file.

Thanks,
Subrahmanyam.

Quoted 67 lines

----- Original Message -----
From: "Stephan Linke" <[email protected]>
To: "Subrahmanyam" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, December 08, 2004 03:33 PM
Subject: RE: MTD driver

Quoted 57 lines

Hi,

you may setup a dedicated partition that gives you access to the particular
location in the flash where you whant to place this data. Then you can use
normal open() read() write() and seek() functions to access what ever byte in
this partition. How to erass a block you can look up in one of the MTD tools.
(Only if you are using NAND flash you should not do it like this since bad block
handling whould be missing.)
But I aggree with Thomas. Best whould be to put it into a filesystem...

Stephan

Quoted 38 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Thomas Gleixner
Sent: Mittwoch, 8. Dezember 2004 07:37
To: Subrahmanyam
Cc: [email protected]
Subject: Re: MTD driver

Quoted 6 lines · Subrahmanyam

Hi,

I need to provide an user interface/GUI wherein when a certain data
(string/key) is entered, it should basically store the key in the flash
(this basically happens during run time after the target has been

identified

Quoted 8 lines

by the host).

In the target we have a flash in which there is jffs2 file system and also
mtd drivers, since i need to store block oriented data, i am looking at the
possiblity of using mtd driver and storing data(key) in a particular location in flash. How should i proceed in acheiving the same.

Is there any good reason, why the key cannot be stored on the already available jffs2 filesystem ?

tglx

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#3 lore raw
In reply to Subrahmanyam
Quoted 3 lines · Subrahmanyam

Yes, Thomas has suggested that i indeed use a filesystem, but how can I
best
achieve it! I mean the procedure to store data in a file.

# echo "KEYSTRING" >/path/to/your/file

All programming languages provide functions to write to files.

# man 2 write

might be a good start. If this does not help you might try

http://www.amazon.com/exec/obidos/ASIN/0764570684/dangookin/104-4933924-3663106?creative=327641&camp=14573&link_code=as1

for further assistance.

tglx

#2 lore raw
In reply to Stephan Linke

Hi Stephan,

Thanks for the help.

Inorder to create a new partition on the flash, can I use the "fis" commands when connected to the target through minicom tool.

As you have said to create a partition, a understanding of the files in mtd/maps directory is required, but there are so many files pertaining to it, is it the file of the processor in the target, which in our case happens to be iop80321.

Please suggest how I can use the already existing jffs2 filesystem upon which I can create a file and store the key in a file. Apart from the file system the other option would be to store the key in block oriented format i.e. by using fis from the redboot.

After storing the key in the flash, you have suggested that I can access the key using the device inode of the flash partition, how exactly can I obtain the device inode of a particular partition, could you please suggest the same.

Thanks,
Subrahmanyam.

----- Original Message ----- From: "Stephan Linke" <[email protected]>
To: "Subrahmanyam" <[email protected]>; <[email protected]>
Sent: Thursday, December 09, 2004 02:21 PM
Subject: RE: MTD driver

Quoted 119 lines

Hi Subrahmanyam,

to setup a separate partition you should have a look at the files in mtd/maps directory.

The rest is simple as long as you whant to access it from user space. Just use open/lseek/write (see man pages (2)) on either the filedescriptor of a regular file or the device inode of the new flash partition.

If you need to access the data from within kernel code it is slightly different. If you write to a flash partition you can find some ideas how to do it in mtd/maps. About writing a file from within kernel code I can only tell you that it is possible but I have no experience.

Stephan

Quoted 102 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Subrahmanyam
Sent: Donnerstag, 9. Dezember 2004 04:38
To: [email protected]
Subject: MTD driver

Hi Stephen,

Yes as you have said I shall setup a dedicated partition to give access
a
particular location in flash. We, have an Intel starta NOR flash which
uses
cfi command set driver, which basically i guess takes care of the erase operation too. I have accessed the target through minicom tool, is this where i have to set up an additional partition?, can you suggest any
site
or
procedure by which I can acheive setting up an additional partition.

Yes, Thomas has suggested that i indeed use a filesystem, but how can I
best
achieve it! I mean the procedure to store data in a file.

Thanks,
Subrahmanyam.

Quoted 68 lines

----- Original Message -----
From: "Stephan Linke" <[email protected]>
To: "Subrahmanyam" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, December 08, 2004 03:33 PM
Subject: RE: MTD driver

Quoted 58 lines

Hi,

you may setup a dedicated partition that gives you access to the particular
location in the flash where you whant to place this data. Then you can use
normal open() read() write() and seek() functions to access what ever byte in
this partition. How to erass a block you can look up in one of the MTD tools.
(Only if you are using NAND flash you should not do it like this since bad block
handling whould be missing.)
But I aggree with Thomas. Best whould be to put it into a filesystem...

Stephan

Quoted 39 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Thomas Gleixner
Sent: Mittwoch, 8. Dezember 2004 07:37
To: Subrahmanyam
Cc: [email protected]
Subject: Re: MTD driver

Quoted 7 lines · Subrahmanyam

Hi,

I need to provide an user interface/GUI wherein when a certain
data
(string/key) is entered, it should basically store the key in the flash
(this basically happens during run time after the target has been

identified

Quoted 8 lines

by the host).

In the target we have a flash in which there is jffs2 file system and also
mtd drivers, since i need to store block oriented data, i am looking at the
possiblity of using mtd driver and storing data(key) in a particular location in flash. How should i proceed in acheiving the same.

Is there any good reason, why the key cannot be stored on the already available jffs2 filesystem ?

tglx

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#4 lore raw
In reply to Thomas Gleixner

Hi Thomas,

Can you suggest an approach to write into the flash either by using a file system or by using mtd drivers. Yes, I am aware of writing data to a normal file but, but how is it possible to do in a jffs2 file system which is read only.

Please do suggest an approach.

Thanks,
Subrahmanyam.

----- Original Message ----- From: "Thomas Gleixner" <[email protected]>
To: "Subrahmanyam" <[email protected]>
Cc: <[email protected]>
Sent: Thursday, December 09, 2004 03:34 PM
Subject: Re: MTD driver

Quoted 20 lines · Subrahmanyam
Quoted 3 lines

Yes, Thomas has suggested that i indeed use a filesystem, but how can I
best
achieve it! I mean the procedure to store data in a file.

# echo "KEYSTRING" >/path/to/your/file

All programming languages provide functions to write to files.

# man 2 write

might be a good start. If this does not help you might try

http://www.amazon.com/exec/obidos/ASIN/0764570684/dangookin/104-4933924-3663106?creative=327641&camp=14573&link_code=as1

for further assistance.

tglx