flash_eraseall - Cant write to /dev/mtd11 - permission denied please Help!!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

flash_eraseall - Cant write to /dev/mtd11 - permission denied please Help!!

Jump to solution
9,051 Views
alfonsokame
Contributor III

Hello,

I ve got a P1021rdb-PC board and I have to configure so that it boots from the EEPROM SPI Flash.

I want to write the SPI bootloader to the corresponding

Here is what I do:

cat /pro/ c/mtd

dev:    size   erasesize  name

mtd0: 00040000 00020000 "NOR Vitesse-7385 Firmware"

mtd1: 00040000 00020000 "NOR DTB Image"

mtd2: 00380000 00020000 "NOR Linux Kernel Image"

mtd3: 00b00000 00020000 "NOR JFFS2 Root File System"

mtd4: 00100000 00020000 "NOR U-Boot Image"

mtd5: 00100000 00004000 "NAND U-Boot Image"

mtd6: 00100000 00004000 "NAND DTB Image"

mtd7: 00400000 00004000 "NAND Linux Kernel Image"

mtd8: 00400000 00004000 "NAND Compressed RFS Image"

mtd9: 00700000 00004000 "NAND JFFS2 Root File System"

mtd10: 00f00000 00004000 "NAND Writable User area"

mtd11: 000a0000 00010000 "SPI Flash U-Boot Image"

mtd12: 00060000 00010000 "SPI Flash DTB Image"

mtd13: 00400000 00010000 "SPI Flash Linux Kernel Image"

mtd14: 00400000 00010000 "SPI Flash Compressed RFSImage"

mtd15: 00700000 00010000 "SPI Flash JFFS2 RFS"


root@p1021rdb:~# ls /dev/mtd*s -l

crw------- 1 root root 90,  0 Jan  1  1970 /dev/mtd0

crw------- 1 root root 90,  1 Jan  1  1970 /dev/mtd0ro

crw------- 1 root root 90,  2 Jan  1  1970 /dev/mtd1

crw------- 1 root root 90, 20 Jan  1  1970 /dev/mtd10

crw------- 1 root root 90, 21 Jan  1  1970 /dev/mtd10ro

crw------- 1 root root 90, 22 Jan  1  1970 /dev/mtd11

crw------- 1 root root 90, 23 Jan  1  1970 /dev/mtd11ro

crw------- 1 root root 90, 24 Jan  1  1970 /dev/mtd12

crw------- 1 root root 90, 25 Jan  1  1970 /dev/mtd12ro

crw------- 1 root root 90, 26 Jan  1  1970 /dev/mtd13

crw------- 1 root root 90, 27 Jan  1  1970 /dev/mtd13ro

crw------- 1 root root 90, 28 Jan  1  1970 /dev/mtd14

crw------- 1 root root 90, 29 Jan  1  1970 /dev/mtd14ro

crw------- 1 root root 90, 30 Jan  1  1970 /dev/mtd15

crw------- 1 root root 90, 31 Jan  1  1970 /dev/mtd15ro

crw------- 1 root root 90,  3 Jan  1  1970 /dev/mtd1ro

crw------- 1 root root 90,  4 Jan  1  1970 /dev/mtd2

crw------- 1 root root 90,  5 Jan  1  1970 /dev/mtd2ro

crw------- 1 root root 90,  6 Jan  1  1970 /dev/mtd3

crw------- 1 root root 90,  7 Jan  1  1970 /dev/mtd3ro

crw------- 1 root root 90,  8 Jan  1  1970 /dev/mtd4

crw------- 1 root root 90,  9 Jan  1  1970 /dev/mtd4ro

crw------- 1 root root 90, 10 Jan  1  1970 /dev/mtd5

crw------- 1 root root 90, 11 Jan  1  1970 /dev/mtd5ro

crw------- 1 root root 90, 12 Jan  1  1970 /dev/mtd6

crw------- 1 root root 90, 13 Jan  1  1970 /dev/mtd6ro

ct 90, 14 Jan  1  1970 /dev/mtd7

crw------- 1 root root 90, 15 Jan  1  1970 /dev/mtd7ro

crw------- 1 root root 90, 16 Jan  1  1970 /dev/mtd8

crw------- 1 root root 90, 17 Jan  1  1970 /dev/mtd8ro

crw------- 1 root root 90, 18 Jan  1  1970 /dev/mtd9

crw------- 1 root root 90, 19 Jan  1  1970 /dev/mtd9ro

brw-rw---- 1 root disk 31,  0 Jan  1  1970 /dev/mtdblock0

brw-rw---- 1 root disk 31,  1 Jan  1  1970 /dev/mtdblock1

brw-rw---- 1 root disk 31, 10 Jan  1  1970 /dev/mtdblock10

brw-rw---- 1 root disk 31, 11 Jan  1  1970 /dev/mtdblock11

brw-rw---- 1 root disk 31, 12 Jan  1  1970 /dev/mtdblock12

brw-rw---- 1 root disk 31, 13 Jan  1  1970 /dev/mtdblock13

brw-rw---- 1 root disk 31, 14 Jan  1  1970 /dev/mtdblock14

brw-rw---- 1 root disk 31, 15 Jan  1  1970 /dev/mtdblock15

brw-rw---- 1 root disk 31,  2 Jan  1  1970 /dev/mtdblock2

brw-rw---- 1 root disk 31,  3 Jan  1  1970 /dev/mtdblock3

brw-rw---- 1 root disk 31,  4 Jan  1  1970 /dev/mtdblock4

brw-rw---- 1 root disk 31,  5 Jan  1  1970 /dev/mtdblock5

brw-rw---- 1 root disk 31,  6 Jan  1  1970 /dev/mtdblock6

brw-rw---- 1 root disk 31,  7 Jan  1  1970 /dev/mtdblock7

brw-rw---- 1 root disk 31,  8 Jan  1  1970 /dev/mtdblock8

brw-rw---- 1 root disk 31,  9 Jan  1  1970 /dev/mtdblock9

root@p1021rdb:~# flash_eraseall /dev/mtd11

flash_eraseall has been replaced by `flash_erase <mtddev> 0 0`; please use it

flash_erase: error!: /dev/mtd11

             error 13 (Permission denied)


These Character devices (mtdxx) have even minor number. They seem to be OK. What I m missing here??


even "cat /dev/null > /dev/mtd11" doesnt work


Please Help!!


Thank you very much in advance!!


Tags (3)
1 Solution
4,450 Views
scottwood
NXP Employee
NXP Employee

The U-Boot partition is read-only by default.  If you want to write to it from Linux, you need to remove the read-only property in the relevant device tree node.

View solution in original post

3 Replies
4,450 Views
alfonsokame
Contributor III

Hi Scott,

thanks for the reply!!. You ve pointed out exactly what i was missing! Now I am able to run U-Boot from SPI flash. However, I have some problems as U-boot runs the ramdisk image that has been successfully tftped at an address. At one point, the system hangs. Here is the log

U-Boot 2011.12-00064-gbfb0c9a (Nov 15 2012 - 23:28:50)

CPU0:  P1021E, Version: 1.1, (0x80ec0111)

Core:  E500, Version: 5.1, (0x80212051)

Clock Configuration:

       CPU0:800  MHz, CPU1:800  MHz,

       CCB:400  MHz,

       DDR:333.333 MHz (666.667 MT/s data rate) (Asynchronous), LBC:25   MHz

       QE:400  MHz

L1:    D-cache 32 kB enabled

       I-cache 32 kB enabled

Board: P1021RDB CPLD: V4.1 PCBA: V4.0

Error reading i2c boot information!

I2C:   ready

SPI:   ready

DRAM:  DDR: failed to read SPD from address 82  :smileyalert:

Error in DDR bus width configuration!    :smileyalert:

16 MiB (DDR3, 32-bit, CL=6, ECC off)

Flash: 16 MiB

L2:    256 KB enabled

NAND:  32 MiB

MMC:  FSL_SDHC: 0

SF: Detected S25FL128P_64K with page size 64 KiB, total 16 MiB

Firmware 'Microcode version 0.0.1 for P1021 r1.0' for 1021 V1.0

QE: uploading microcode 'Microcode for P1021 r1.0' version 0.0.1

PCIe1: Root Complex of mini PCIe SLOT, no link, regs @ 0xffe0a000

PCIe1: Bus 00 - 00

PCIe2: Endpoint of PCIe SLOT, no link, regs @ 0xffe09000

PCIe2: Bus 01 - 01

In:    serial

Out:   serial

Err:   serial

Net:   eTSEC2 is in sgmii mode.

uploading VSC7385 microcode from ef020000

PHY reset timed out

eTSEC1, eTSEC2, eTSEC3

Hit any key to stop autoboot: 10  0

=> run ramboot

Speed: 1000, full duplex

Using eTSEC1 device

TFTP from server 10.a.b.c; our IP address is 10.d.e.f

Filename 'rootfs.ext2.gz.u-boot'.

Load address: 0x2000000

Loading: *#################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #################################################################

     #######################

done

Bytes transferred = 28954008 (1b9cd98 hex)

Speed: 1000, full duplex

Using eTSEC1 device

TFTP from server 10.a.b.c; our IP address is 10.d.e.f

Filename 'uImage-p1021rdb.bin'.

Load address: 0x1000000

Loading: *#################################################################

     #################################################################

     #################################################################

     ####################################################

done

Bytes transferred = 3620878 (37400e hex)

Speed: 1000, full duplex

Using eTSEC1 device

TFTP from server 10.a.b.c; our IP address is 10.d.e.f

Filename 'uImage-p1021rdb.dtb'.

Load address: 0xc00000

Loading: *##

done

Bytes transferred = 25245 (629d hex)

## Booting kernel from Legacy Image at 01000000 ...

   Image Name:   Linux-3.0.34-rt55-02404-g1a39570

   Created:      2012-11-30  13:55:59 UTC

   Image Type:   PowerPC Linux Kernel Image (gzip compressed)

   Data Size:    3620814 Bytes = 3.5 MiB

   Load Address: 00000000

   Entry Point:  00000000

   Verifying Checksum ... OK

## Loading init Ramdisk from Legacy Image at 02000000 ...

   Image Name:   fsl-image-core-p1021rdb-20121116

   Created:      2012-11-16   9:09:58 UTC

   Image Type:   PowerPC Linux RAMDisk Image (gzip compressed)

   Data Size:    28953944 Bytes = 27.6 MiB :smileyalert:

   Load Address: 00000000

   Entry Point:  00000000

   Verifying Checksum ... OK

## Flattened Device Tree blob at 00c00000

   Booting using the fdt blob at 0x00c00000

   Uncompressing Kernel Image ... OK

ERROR: Failed to allocate 0x1b9cd58 bytes below 0xffffffff.

ramdisk - allocation error  :smileyalert:


Then, the system hangs here

It seems like I can't load the 27MB Ramdisk file using SPI-Uboot. Is it due to the DDR Configuration in the Uboot.bin file? Wrong DDR Bus Width configuration??

What should I do to fix this?

Please Help


Thank you very much



0 Kudos
4,450 Views
scottwood
NXP Employee
NXP Employee

You seem to have a problem with the DDR configuration:

DRAM:  DDR: failed to read SPD from address 82  :smileyalert:

Error in DDR bus width configuration!    :smileyalert:

16 MiB (DDR3, 32-bit, CL=6, ECC off)


This is a separate problem that should be posted under its own title, so that the relevant people will see it.

0 Kudos
4,451 Views
scottwood
NXP Employee
NXP Employee

The U-Boot partition is read-only by default.  If you want to write to it from Linux, you need to remove the read-only property in the relevant device tree node.