Discussion:
/proc/mtd file does not show partitions
Midhun Agnihotram
2007-06-20 06:20:35 UTC
Permalink
Hi All,

We want to use the on board flash as our file system on our
Development Kit (CSB535FS). We have defined the partitions in the
respective file and the kernel creates the partitions while bootig.

RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
Cirrus Logic CS8900A driver for Linux (V0.02)
eth0: CS8900A rev E detected
physmap flash device: 800000 at c8000000
phys_mapped_flash: Found 1 x16 devices at 0x0 in 16-bit bank
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
RedBoot partition parsing not available
mtd: Giving out device 0 to phys_mapped_flash
Probing flash00 at physical address 0xc8000000 (16-bit bankwidth)
flash00: Found 1 x16 devices at 0x0 in 16-bit bank
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Done probing.
Setting mtd_parts to csbxxx_partitions.
Should be adding devices or partitions now.
Going to call add_mtd_partitions.
csbxxx: using static partition definition
Creating 3 MTD partitions on "flash00":
0x00000000-0x00200000 : "U-Boot flash"
mtd: Giving out device 1 to U-Boot flash
0x00200000-0x00400000 : "Kernel flash"
mtd: Giving out device 2 to Kernel flash
0x00400000-0x00800000 : "RootFS flash"
mtd: Giving out device 3 to RootFS flash


I boot with a Ramdisk. I have created the required mtd entries in
the Ramdisk's /dev folder. On the target's linux prompt, when I do a
cat /proc/mtd, it says that the file does not exist. Who is supposed
to create this file? Is it not the kernel which creates this file when
the partitions are created? I am pretty new to MTD. What is the
problem here?

Thanks,
Midhun.
hinko.kocevar
2007-06-20 11:38:01 UTC
Permalink
Post by Midhun Agnihotram
Hi All,
We want to use the on board flash as our file system on our
Development Kit (CSB535FS). We have defined the partitions in the
respective file and the kernel creates the partitions while bootig.
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
Cirrus Logic CS8900A driver for Linux (V0.02)
eth0: CS8900A rev E detected
physmap flash device: 800000 at c8000000
phys_mapped_flash: Found 1 x16 devices at 0x0 in 16-bit bank
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
RedBoot partition parsing not available
mtd: Giving out device 0 to phys_mapped_flash
Probing flash00 at physical address 0xc8000000 (16-bit bankwidth)
flash00: Found 1 x16 devices at 0x0 in 16-bit bank
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Done probing.
Setting mtd_parts to csbxxx_partitions.
Should be adding devices or partitions now.
Going to call add_mtd_partitions.
csbxxx: using static partition definition
0x00000000-0x00200000 : "U-Boot flash"
mtd: Giving out device 1 to U-Boot flash
0x00200000-0x00400000 : "Kernel flash"
mtd: Giving out device 2 to Kernel flash
0x00400000-0x00800000 : "RootFS flash"
mtd: Giving out device 3 to RootFS flash
I boot with a Ramdisk. I have created the required mtd entries in
the Ramdisk's /dev folder. On the target's linux prompt, when I do a
cat /proc/mtd, it says that the file does not exist. Who is supposed
to create this file?
/usr/src/linux/drivers/mtd/mtdcore.c iff CONFIG_PROC_FS is enabled.
Silly question - do you have any files in /proc? Is procfs mounted?


best regards,
hinko
--
?ETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: hinko.kocevar at cetrtapot.si
Http: www.cetrtapot.si
Midhun Agnihotram
2007-06-21 05:01:00 UTC
Permalink
Hi,

Update: We have now moved from Ramfs to JFFS2.
Post by hinko.kocevar
Post by Midhun Agnihotram
cat /proc/mtd, it says that the file does not exist. Who is supposed
to create this file?
/usr/src/linux/drivers/mtd/mtdcore.c iff CONFIG_PROC_FS is enabled.
Silly question - do you have any files in /proc? Is procfs mounted?
CONFIG_PROC_FS is enabled in the kernel configuration. I do have
/proc/mounts file.
# cat /proc/mounts
rootfs / rootfs rw 0 0

I am sorry - I exactly do not know what you mean by whether procfs
is mounted. I have /proc folder in the file system that I use. I do
not exclusively mount it anywhere. So when the filesystem is mounted
and the linux prompt comes up, the proc directory exists. Do I need to
do anything more?

Also when I mount the JFFS2 file system (which is in my flash), I
get the following errors.

Empty flash at 0x0000fffc ends at 0x00010000
Empty flash at 0x0002fffc ends at 0x00030000
Empty flash at 0x0004fffc ends at 0x00050000
Empty flash at 0x0006fffc ends at 0x00070000
Empty flash at 0x0008fffc ends at 0x00090000
Empty flash at 0x000afffc ends at 0x000b0000
Empty flash at 0x000cfffc ends at 0x000d0000
Empty flash at 0x000efffc ends at 0x000f0000
Empty flash at 0x0010fffc ends at 0x00110000
Empty flash at 0x0012fffc ends at 0x00130000
Empty flash at 0x0014fffc ends at 0x00150000
Empty flash at 0x0016ffe8 ends at 0x00170000
Empty flash at 0x0018fffc ends at 0x00190000
Empty flash at 0x001afffc ends at 0x001b0000
Empty flash at 0x001cfffc ends at 0x001d0000
Empty flash at 0x001efffc ends at 0x001f0000
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 84K
init: can't log to /dev/tty5
starting pid 670, tty '/dev/ttyS0': '/bin/ash'


BusyBox v1.6.0 (2007-06-15 12:34:28 IST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# Erase at 0x003e0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x003c0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x003a0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00380000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00360000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00340000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00320000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00300000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x002e0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x002c0000 failed immediately: -EROFS. Is the sector locked?

The JFFS2 file system is not writable (although we have mounted it
in read write mode). It does not allow us to write or delete. The boot
args are as follows:

mem=48M console=ttyS0,115200 console=tty0 root=/dev/mtdblock4 rw
rootfstype=jffs2 init=/sbin/init ip=on

What could be the problem??

Thanks a lot for your help,
Midhun.
hinko.kocevar
2007-06-21 08:35:45 UTC
Permalink
Post by Midhun Agnihotram
Hi,
Update: We have now moved from Ramfs to JFFS2.
Post by hinko.kocevar
Post by Midhun Agnihotram
cat /proc/mtd, it says that the file does not exist. Who is supposed
to create this file?
/usr/src/linux/drivers/mtd/mtdcore.c iff CONFIG_PROC_FS is enabled.
Silly question - do you have any files in /proc? Is procfs mounted?
CONFIG_PROC_FS is enabled in the kernel configuration. I do have
/proc/mounts file.
Is this the only file?!
Post by Midhun Agnihotram
# cat /proc/mounts
rootfs / rootfs rw 0 0
I am sorry - I exactly do not know what you mean by whether procfs
is mounted. I have /proc folder in the file system that I use. I do
not exclusively mount it anywhere. So when the filesystem is mounted
and the linux prompt comes up, the proc directory exists. Do I need to
do anything more?
Probably add something like this to the /etc/fstab:
proc /proc proc defaults 0 0

... or for testing on the booted system run:
mount -t proc proc /proc
Post by Midhun Agnihotram
Also when I mount the JFFS2 file system (which is in my flash), I
get the following errors.
Empty flash at 0x0000fffc ends at 0x00010000
Empty flash at 0x0002fffc ends at 0x00030000
Empty flash at 0x0004fffc ends at 0x00050000
Empty flash at 0x0006fffc ends at 0x00070000
Empty flash at 0x0008fffc ends at 0x00090000
Empty flash at 0x000afffc ends at 0x000b0000
Empty flash at 0x000cfffc ends at 0x000d0000
Empty flash at 0x000efffc ends at 0x000f0000
Empty flash at 0x0010fffc ends at 0x00110000
Empty flash at 0x0012fffc ends at 0x00130000
Empty flash at 0x0014fffc ends at 0x00150000
Empty flash at 0x0016ffe8 ends at 0x00170000
Empty flash at 0x0018fffc ends at 0x00190000
Empty flash at 0x001afffc ends at 0x001b0000
Empty flash at 0x001cfffc ends at 0x001d0000
Empty flash at 0x001efffc ends at 0x001f0000
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 84K
init: can't log to /dev/tty5
starting pid 670, tty '/dev/ttyS0': '/bin/ash'
BusyBox v1.6.0 (2007-06-15 12:34:28 IST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
# Erase at 0x003e0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x003c0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x003a0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00380000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00360000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00340000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00320000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x00300000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x002e0000 failed immediately: -EROFS. Is the sector locked?
Erase at 0x002c0000 failed immediately: -EROFS. Is the sector locked?
The JFFS2 file system is not writable (although we have mounted it
in read write mode). It does not allow us to write or delete. The boot
mem=48M console=ttyS0,115200 console=tty0 root=/dev/mtdblock4 rw
rootfstype=jffs2 init=/sbin/init ip=on
What could be the problem??
Please search the archives of the list for similar reports. As it seems
JFFS2 is not guilty of you not being able to write to flash - the
problem lies at a lower level...
Maybe
http://www.infradead.org/pipermail/linux-mtd/2003-October/008643.html
will help.

Best regards,
hinko
--
?ETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: hinko.kocevar at cetrtapot.si
Http: www.cetrtapot.si
Midhun Agnihotram
2007-06-25 06:36:02 UTC
Permalink
Hi,
Post by hinko.kocevar
Maybe
http://www.infradead.org/pipermail/linux-mtd/2003-October/008643.html
will help.
I have tried as per your suggestion. One of the errors is gone now
(Empty flash at 0x0000fffc ends at 0x00010000..etc). But the second
error still exists (Erase at 0x003e0000 failed immediately: -EROFS. Is
the sector locked?.. etc..).

I am using the mtd-utils of Redhat. When I say

# ./mkfs.jffs2 -l -o rootfs-jffs2.img -r rootfs -e 0x20000 -p 0x400000

The rootfs image created is of 1MB, even though the pad option has
been enabled to create an image size of 4MB.

When I create a directory on the target, it says as follows:

# mkdir midhun
mkdir: cannot create directory 'midhun': No space left on device


It seems like the pad option is not working or I made mistake in
the syntax (It did not give any error though). I am not able to write
as the file system is full.

Is it so ?? Or is it some other problem??

Midhun.
Midhun Agnihotram
2007-06-25 09:35:58 UTC
Permalink
Hi,
Post by Midhun Agnihotram
The rootfs image created is of 1MB, even though the pad option has
been enabled to create an image size of 4MB.
I am able to create a 4MB filesystem now. I had changed the -p
option to --pad as follows:

# ./mkfs.jffs2 -l -o rootfs-jffs2.img -r rootfs -e 0x20000 --pad=0x400000

And lo..It worked fine. The errors which used come as soon as the
kernel loading ends are all gone. But there is still one problem. It
says the file system is read-only and does not allow me to create a
folder.

# mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw)
/proc on /proc type proc (rw)
# mkdir midhun
Write of 68 bytes at 0x000e482c failed. returned -30, retlen 3270162828
Write of 68 bytes at 0x000e4870 failed. returned -30, retlen 3270162828
mkdir: cannot create directory 'midhun': Read-only file system

My boot arguments are :

mem=48M console=ttyS0,115200 console=tty0 root=/dev/mtdblock4 rw
rootfstype=jffs2 init=/sbin/init ip=on

Why is it saying that the filesystem is read-only?? The mount
command says that every file system mounted is rw. But still I am not
able to write. What is the problem??

Thanks,
Midhun.
Midhun Agnihotram
2007-06-25 11:50:33 UTC
Permalink
Hi,
Post by Midhun Agnihotram
# mkdir midhun
Write of 68 bytes at 0x000e482c failed. returned -30, retlen 3270162828
Write of 68 bytes at 0x000e4870 failed. returned -30, retlen 3270162828
mkdir: cannot create directory 'midhun': Read-only file system
My file system is now writable. The change required was to mark the
.mask_flags = 0 instead of .mask_flags = MTD_WRITEABLE for my
partition.

Midhun.

Loading...