Skip to contentSkip to conversation

Unale to get MTD device info

DISCUSSION Rahanesh 2 participants 5 messages Aug 24, 2009 1 message not in the archive Memory technology devices (MTD)

lore
Share & tools
lore

Rahanesh

author
#0 lore raw

Hi all,

I have four mtdblocks in my flash .
mtdblock0 -> Primary bootloader
mtdblock1 -> uboot
mtdblock2 -> JFFS
mtdbloack3-> config

During Linux booting , it mounts mtdblock2 to a temp folder which can be seen as a part of ramdisk(root file system of linux)

Now from Linux i need to flash a new jffs image to mtdblock2 itself.

With the support from this mailing list i have copied mtd-utilities package into Linux. Now i have flash_eraseall and flash_cp commands.

But when i run flash_eraseall i gett the following error

flash_eraseall: /dev/mtdblock1: *unable to get MTD device info

*Please help on this!!!!!!!

Thanks
Rahanesh

author
#2 lore raw
In reply to a message not in the archive

Hi Radha Mohan ,

Thanks a lot for responding.

I have few doubts regarding your reply.

In the /dev/ partition of Linux i cannot see any mtd char device. Only mtdblock is there.

Can i convert the block devices to character devices? if so how?

Is it possible for me to erase mtdblock0 and copy to mtdblock0 using any other utilities?

I am a newbie to all this. Please give your valuable suggestions

Thanks
Rahanesh

Quoted 45 lines · Radha Mohan

hi rahanesh,

The mtd-utils do not work on block devices like mtdblock0. Use mtd0 instead. The mtd0 is char device of mtdblock0.

-- Mohan

------------------------------------------------------------------------
*From:* Rahanesh <[email protected]>
*To:* [email protected]
*Sent:* Monday, 24 August, 2009 10:53:06 AM
*Subject:* Unale to get MTD device info

Hi all,

I have four mtdblocks in my flash .
mtdblock0 -> Primary bootloader
mtdblock1 -> uboot
mtdblock2 -> JFFS
mtdbloack3-> config

During Linux booting , it mounts mtdblock2 to a temp folder which can be seen as a part of ramdisk(root file system of linux)

Now from Linux i need to flash a new jffs image to mtdblock2 itself.

With the support from this mailing list i have copied mtd-utilities package into Linux. Now i have flash_eraseall and flash_cp commands.

But when i run flash_eraseall i gett the following error

flash_eraseall: /dev/mtdblock1: *unable to get MTD device info

*Please help on this!!!!!!!

Thanks
Rahanesh

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

------------------------------------------------------------------------
Looking for local information? Find it on Yahoo! Local <http://in.rd.yahoo.com/tagline_local_1/*http://in.local.yahoo.com/>

#3 lore raw

Hi,

Create char mtd devices

mknod /dev/mtd0 c 90 0
mknod /dev/mtd1 c 90 2
..
..
Note that the minor number increments by 2.
Before that you will need to confirm whether CONFIG_MTD_CHAR is set in your kernel or not. This will enable char device access to your mtdblock device. Or else you will not be able to write to mtd0 char device.

You can erase and copy anything to the mtd devices. You can use "flashcp" from the mtd-utils. Else you can write your own code to write to the flash. You can take help of the flashcp code in mtd-utils.

-- Mohan

________________________________
From: Rahanesh <[email protected]>
To: Radha Mohan <[email protected]>
Cc: [email protected]
Sent: Monday, 24 August, 2009 12:35:42 PM
Subject: Re: Unale to get MTD device info

Hi Radha Mohan ,

Thanks a lot for responding.

I have few doubts regarding your reply.

In the /dev/ partition of Linux i cannot see any mtd char device. Only mtdblock is there.

Can i convert the block devices to character devices? if so how?

Is it possible for me to erase mtdblock0 and copy to mtdblock0 using any other utilities?

I am a newbie to all this. Please give your valuable suggestions

Thanks
Rahanesh

Quoted 42 lines · Radha Mohan

hi rahanesh,

The mtd-utils do not work on block devices like mtdblock0. Use mtd0 instead. The mtd0 is char device of mtdblock0.

-- Mohan

------------------------------------------------------------------------
*From:* Rahanesh <[email protected]>
*To:* [email protected]
*Sent:* Monday, 24 August, 2009 10:53:06 AM
*Subject:* Unale to get MTD device info

Hi all,

I have four mtdblocks in my flash .
mtdblock0 -> Primary bootloader
mtdblock1 -> uboot
mtdblock2 -> JFFS
mtdbloack3-> config

During Linux booting , it mounts mtdblock2 to a temp folder which can be seen as a part of ramdisk(root file system of linux)

Now from Linux i need to flash a new jffs image to mtdblock2 itself.

With the support from this mailing list i have copied mtd-utilities package into Linux. Now i have flash_eraseall and flash_cp commands.

But when i run flash_eraseall i gett the following error

flash_eraseall: /dev/mtdblock1: *unable to get MTD device info

*Please help on this!!!!!!!

Thanks
Rahanesh

Quoted 7 lines

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

------------------------------------------------------------------------
Looking for local information? Find it on Yahoo! Local
<http://in.rd.yahoo.com/tagline_local_1/*http://in.local.yahoo.com/>

See the Web&#39;s breaking stories, chosen by people like you. Check out Yahoo! Buzz. http://in.buzz.yahoo.com/

author
#4 lore raw

Hi Mohan,

That was really very helpful..

After doing this i am nw able to erase flash.

Few doubts:

I thought Flashes are block devices. How come we treat this as char devices? Why should we treat as char device?

why minor mumber should be incremented by 2?

What happens when we do a mknod /dev/mtd0 c 90 0?

Do we need to do anything with the /dev/mtdblock0 while erasing and reflashing ?

Thanks
Rahanesh

Quoted 100 lines · Radha Mohan

Hi,

Create char mtd devices

mknod /dev/mtd0 c 90 0
mknod /dev/mtd1 c 90 2
..
..
Note that the minor number increments by 2.
Before that you will need to confirm whether CONFIG_MTD_CHAR is set in your kernel or not. This will enable char device access to your mtdblock device. Or else you will not be able to write to mtd0 char device.

You can erase and copy anything to the mtd devices. You can use "flashcp" from the mtd-utils. Else you can write your own code to write to the flash. You can take help of the flashcp code in mtd-utils.

-- Mohan

________________________________
From: Rahanesh <[email protected]>
To: Radha Mohan <[email protected]>
Cc: [email protected]
Sent: Monday, 24 August, 2009 12:35:42 PM
Subject: Re: Unale to get MTD device info

Hi Radha Mohan ,

Thanks a lot for responding.

I have few doubts regarding your reply.

In the /dev/ partition of Linux i cannot see any mtd char device. Only mtdblock is there.

Can i convert the block devices to character devices? if so how?

Is it possible for me to erase mtdblock0 and copy to mtdblock0 using any other utilities?

I am a newbie to all this. Please give your valuable suggestions

Thanks
Rahanesh

Quoted 39 lines · Radha Mohan

hi rahanesh,

The mtd-utils do not work on block devices like mtdblock0. Use mtd0 instead. The mtd0 is char device of mtdblock0.

-- Mohan

------------------------------------------------------------------------
*From:* Rahanesh <[email protected]>
*To:* [email protected]
*Sent:* Monday, 24 August, 2009 10:53:06 AM
*Subject:* Unale to get MTD device info

Hi all,

I have four mtdblocks in my flash .
mtdblock0 -> Primary bootloader
mtdblock1 -> uboot
mtdblock2 -> JFFS
mtdbloack3-> config

During Linux booting , it mounts mtdblock2 to a temp folder which can be seen as a part of ramdisk(root file system of linux)

Now from Linux i need to flash a new jffs image to mtdblock2 itself.

With the support from this mailing list i have copied mtd-utilities package into Linux. Now i have flash_eraseall and flash_cp commands.

But when i run flash_eraseall i gett the following error

flash_eraseall: /dev/mtdblock1: *unable to get MTD device info

*Please help on this!!!!!!!

Thanks
Rahanesh

Quoted 7 lines

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

------------------------------------------------------------------------
Looking for local information? Find it on Yahoo! Local <http://in.rd.yahoo.com/tagline_local_1/*http://in.local.yahoo.com/>

See the Web&#39;s breaking stories, chosen by people like you. Check out Yahoo! Buzz. http://in.buzz.yahoo.com/

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

#5 lore raw

Hi,

Even I do not know many things regarding your queries but I will try to tell what I know. Maybe someone from this group can add.

Quoted 2 lines

I thought Flashes are block devices. How come we treat this as char devices? Why should we treat as char device?

To mount a filesystem and all you need the devices as block device so I think mtdblock is for this. Using char device method you can directly control the MTD device like a RAM and there are some ioctls. But I think the read,write calls will of both will be eventually calling underlying MTD device driver's read and write.

Quoted 1 line

why minor mumber should be incremented by 2?

I do not know why the minor number is increment by 2. Maybe this is how it is in the char implementation inside kernel

Quoted 1 line

What happens when we do a mknod /dev/mtd0 c 90 0?

this is how we create device nodes for any device type in linux. Search about this in google.

Quoted 2 lines

Do we need to do anything with the /dev/mtdblock0 while erasing and reflashing ?

I do not think so.

-- Mohan

----- Original Message ----
From: Rahanesh <[email protected]>
To: Radha Mohan <[email protected]>
Cc: [email protected]
Sent: Monday, 24 August, 2009 3:20:02 PM
Subject: Re: Unale to get MTD device info

Hi Mohan,

That was really very helpful..

After doing this i am nw able to erase flash.

Few doubts:

I thought Flashes are block devices. How come we treat this as char devices? Why should we treat as char device?

why minor mumber should be incremented by 2?

What happens when we do a mknod /dev/mtd0 c 90 0?

Do we need to do anything with the /dev/mtdblock0 while erasing and reflashing ?

Thanks
Rahanesh

Quoted 98 lines · Radha Mohan

Hi,

Create char mtd devices

mknod /dev/mtd0 c 90 0
mknod /dev/mtd1 c 90 2
..
..
Note that the minor number increments by 2.
Before that you will need to confirm whether CONFIG_MTD_CHAR is set in your kernel or not. This will enable char device access to your mtdblock device. Or else you will not be able to write to mtd0 char device.

You can erase and copy anything to the mtd devices. You can use "flashcp" from the mtd-utils. Else you can write your own code to write to the flash. You can take help of the flashcp code in mtd-utils.

-- Mohan

________________________________
From: Rahanesh <[email protected]>
To: Radha Mohan <[email protected]>
Cc: [email protected]
Sent: Monday, 24 August, 2009 12:35:42 PM
Subject: Re: Unale to get MTD device info

Hi Radha Mohan ,

Thanks a lot for responding.

I have few doubts regarding your reply.

In the /dev/ partition of Linux i cannot see any mtd char device.. Only mtdblock is there.

Can i convert the block devices to character devices? if so how?

Is it possible for me to erase mtdblock0 and copy to mtdblock0 using any other utilities?

I am a newbie to all this. Please give your valuable suggestions

Thanks
Rahanesh

Quoted 42 lines · Radha Mohan

hi rahanesh,

The mtd-utils do not work on block devices like mtdblock0. Use mtd0 instead. The mtd0 is char device of mtdblock0.

-- Mohan

------------------------------------------------------------------------
*From:* Rahanesh <[email protected]>
*To:* [email protected]
*Sent:* Monday, 24 August, 2009 10:53:06 AM
*Subject:* Unale to get MTD device info

Hi all,

I have four mtdblocks in my flash .
mtdblock0 -> Primary bootloader
mtdblock1 -> uboot
mtdblock2 -> JFFS
mtdbloack3-> config

During Linux booting , it mounts mtdblock2 to a temp folder which can be seen as a part of ramdisk(root file system of linux)

Now from Linux i need to flash a new jffs image to mtdblock2 itself.

With the support from this mailing list i have copied mtd-utilities package into Linux. Now i have flash_eraseall and flash_cp commands.

But when i run flash_eraseall i gett the following error

flash_eraseall: /dev/mtdblock1: *unable to get MTD device info

*Please help on this!!!!!!!

Thanks
Rahanesh

Quoted 8 lines

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

------------------------------------------------------------------------
Looking for local information? Find it on Yahoo! Local
<http://in.rd.yahoo.com/tagline_local_1/*http://in.local.yahoo.com/>

Quoted 8 lines

See the Web's breaking stories, chosen by people like you. Check out Yahoo! Buzz. http://in.buzz.yahoo.com/

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

Looking for local information? Find it on Yahoo! Local http://in.local.yahoo.com/