Forum Discussion
Altera_Forum
Honored Contributor
20 years agoBingo. I must have missed the class on partition<->minor device numbering... Based on other threads here and this (http://www.enseirb.fr/~kadionik/embedded/uclinux/mtd/howto_mtd.html)
I was under the distinct impression that partition N mapped directly to minor number N (aka mtdN/mtdblockN). I now see that when MTD says: 0x00700000-0x00800000 : "Flash FS" mtd: Giving out device 2 to Flash FS I should access the partition via /dev/mtd4 (rw) and /dev/mtd5 (ro). I've spent several days trying to access it as /dev/mtd2 (which refers to my MTD_WRITEABLE-flagged partition# 1). Now I can open the partition (via /dev/mtd4), but I can't do much with it:# mkdir /var/flash# mount -t jffs2 /dev/mtdblock4 /var/flash -n mount: wrong fs type, bad option, bad superblock on /dev/mtdblock4, or too many mounted file systems AND# cp jffs2.img /dev/mtd4 MTD_open MTD_write Badness in local_bh_enable at /cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/ com.microtronix.nios2linux.kernel_1.4.0/linux-2.6.x/kernel/softirq.c:140 Stack from 00c53e54:<0> <0> 00166734<0> 0000ffc4<0> 000ec400<0> 00000000<0> 00000000<0> 00369e68... AND# erase /dev/mtd4 Trying to open /dev/mtd4 MTD_open Erase Total 1 Units MTD_ioctl MTD_ioctl Performing Flash Erase of length 65536 at offset 0x0MTD_ioctl (System hangs here...) Cheers! Mike --- Quote Start --- partition = minor >> 1 partition is read only = minor & 1 partition is read/write = ~(minor & 1) irrespective of your char mode device inode attributes. E.g.: crw------- 1 root root 90, 0 Jan 1 1970 /dev/mtd0 crw------- 1 root root 90, 1 Jan 1 1970 /dev/mtd0_ro crw------- 1 root root 90, 2 Jan 1 1970 /dev/mtd1 crw------- 1 root root 90, 3 Jan 1 1970 /dev/mtd1_ro crw------- 1 root root 90, 4 Jan 1 1970 /dev/mtd2 crw------- 1 root root 90, 5 Jan 1 1970 /dev/mtd2_ro crw------- 1 root root 90, 6 Jan 1 1970 /dev/mtd3 crw------- 1 root root 90, 7 Jan 1 1970 /dev/mtd3_ro Regards, --Scott <div align='right'><{post_snapback}> (index.php?act=findpost&pid=10416)</div> --- Quote End --- --- Quote End ---