読み取り/書き込みアクセス用に/ dev / mtd2を開こうとしたとき:権限が拒否されました。

読み取り/書き込みアクセス用に/ dev / mtd2を開こうとしたとき:権限が拒否されました。

MTD2およびMTD3パーティションが書き込み禁止になっているようです。オペレーティングシステムは、ARM Cortex A 9プロセッサのSDカードから起動します。

root@Xilinx-ZC702-2013_3:~# mount /dev/mmcblk0p1 /mnt/
root@Xilinx-ZC702-2013_3:~#
root@Xilinx-ZC702-2013_3:~# cd /mnt/flash/
root@Xilinx-ZC702-2013_3:/mnt/flash#
root@Xilinx-ZC702-2013_3:/mnt/flash# ls
BOOT.BIN      image.ub      rootfs.jffs2
root@Xilinx-ZC702-2013_3:/mnt/flash# flashcp -v image.ub /dev/mtd2
While trying to open /dev/mtd2 for read/write access: Permission denied
root@Xilinx-ZC702-2013_3:/mnt/flash#

私もこれを試しました:

root@Xilinx-ZC702-2013_3:/mnt/flash# flash_eraseall -j /dev/mtd2
flash_eraseall has been replaced by `flash_erase <mtddev> 0 0`; please use it
flash_erase: error!: /dev/mtd2
             error 13 (Permission denied)

追加情報は次のとおりです。

root@Xilinx-ZC702-2013_3:/mnt/flash# mtdinfo
Count of MTD devices:           4
Present MTD devices:            mtd0, mtd1, mtd2, mtd3
Sysfs interface supported:      yes

root@Xilinx-ZC702-2013_3:~# cat /proc/mtd
    dev:    size   erasesize  name
    mtd0: 00500000 00010000 "boot"
    mtd1: 00020000 00010000 "bootenv"
    mtd2: 001202c0 00010000 "image"
    mtd3: 00500000 00010000 "jffs2"

返品:

root@Xilinx-ZC702-2013_3:/mnt/flash# mtd_debug info /dev/mtd3
mtd.type = MTD_NORFLASH
mtd.flags = MTD_BIT_WRITEABLE
mtd.size = 5242880 (5M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

root@Xilinx-ZC702-2013_3:/mnt/flash# mtd_debug info /dev/mtd2
mtd.type = MTD_NORFLASH
mtd.flags = MTD_BIT_WRITEABLE
mtd.size = 1180352 (1M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

root@Xilinx-ZC702-2013_3:/mnt/flash# mtd_debug info /dev/mtd1
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 131072 (128K)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

root@Xilinx-ZC702-2013_3:/mnt/flash# mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 5242880 (5M)
mtd.erasesize = 65536 (64K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0

root@Xilinx-ZC702-2013_3:/mnt/flash#

この問題をどのように解決できますか?

dmesg 出力

ここに問題があると思います。

4 ofpart partitions found on MTD device spi32766.0
    Creating 4 MTD partitions on "spi32766.0":
    0x000000000000-0x000000500000 : "boot"
    0x000000500000-0x000000520000 : "bootenv"
    0x000000520000-0x0000006402c0 : "image"
    mtd: partition "image" doesn't end on an erase block -- force read-only
    0x0000006402c0-0x000000b402c0 : "jffs2"
    mtd: partition "jffs2" doesn't start on an erase block boundary -- force read-on                                                                             ly

完全なdmesg出力はここに提供されます。

Booting Linux on physical CPU 0x0
Linux version 3.8.11 (root@xilinx) (gcc version 4.7.3 (Sourcery CodeBench Lite 2                                                                             013.05-40) ) #3 SMP PREEMPT Mon Apr 7 19:02:27 IST 2014
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: Xilinx Zynq Platform, model: .
Memory policy: ECC disabled, Data cache writealloc
On node 0 totalpages: 262144
free_area_init_node: node 0, pgdat c0bed1c0, node_mem_map c0c0a000
  Normal zone: 1520 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 193040 pages, LIFO batch:31
  HighMem zone: 528 pages used for memmap
  HighMem zone: 67056 pages, LIFO batch:15
PERCPU: Embedded 7 pages/cpu @c1415000 s6592 r8192 d13888 u32768
pcpu-alloc: s6592 r8192 d13888 u32768 alloc=8*4096
pcpu-alloc: [0] 0 [0] 1
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260096
Kernel command line: console=ttyPS0,115200
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
__ex_table already sorted, skipping sort
Memory: 1024MB = 1024MB total
Memory: 1027124k/1027124k available, 21452k reserved, 270336K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
    lowmem  : 0xc0000000 - 0xef800000   ( 760 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc04effd4   (5024 kB)
      .init : 0xc04f0000 - 0xc0bbf9c0   (6975 kB)
      .data : 0xc0bc0000 - 0xc0bedee0   ( 184 kB)
       .bss : 0xc0bedee0 - 0xc0c09670   ( 110 kB)
Preemptible hierarchical RCU implementation.
NR_IRQS:16 nr_irqs:16 16
MIO pin 47 not assigned(00001220)
xslcr mapped to f0002000
Zynq clock init
sched_clock: 16 bits at 54kHz, resolution 18432ns, wraps every 1207ms
ps7-ttc #0 at f0004000, irq=43
Console: colour dummy device 80x30
Calibrating delay loop... 1332.01 BogoMIPS (lpj=6660096)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x35eec0 - 0x35eef4
L310 cache controller enabled
l2x0: 8 ways, CACHE_ID 0x000000c0, AUX_CTRL 0x72360000, Cache size: 524288 B
CPU1: Booted secondary processor
Brought up 2 CPUs
SMP: Total of 2 processors activated (2664.03 BogoMIPS).
devtmpfs: initialized
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xf004e000
bio: create slab <bio-0> at 0
GPIO IRQ not connected
XGpio: /amba@0/gpio@41200000: registered, base is 252
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource xttcps_clocksource
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP: reno registered
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
bounce pool size: 64 pages
jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
msgmni has been set to 1478
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 82) is a xuartps
console [ttyPS0] enabled
xdevcfg f8007000.ps7-dev-cfg: ioremap f8007000 to f00c8000 with size 100
st: Version 20101219, fixed bufsize 32768, s/g segs 256
osst :I: Tape driver with OnStream support version 0.99.4
osst :I: $Id: osst.c,v 1.73 2005/01/01 21:13:34 wriede Exp $
SCSI Media Changer driver v0.25
xqspips e000d000.ps7-qspi: master is unqueued, this is deprecated
m25p80 spi32766.0: found n25q128, expected n25q128
m25p80 spi32766.0: n25q128 (16384 Kbytes)
4 ofpart partitions found on MTD device spi32766.0
Creating 4 MTD partitions on "spi32766.0":
0x000000000000-0x000000500000 : "boot"
0x000000500000-0x000000520000 : "bootenv"
0x000000520000-0x0000006402c0 : "image"
mtd: partition "image" doesn't end on an erase block -- force read-only
0x0000006402c0-0x000000b402c0 : "jffs2"
mtd: partition "jffs2" doesn't start on an erase block boundary -- force read-on                                                                             ly
xqspips e000d000.ps7-qspi: at 0xE000D000 mapped to 0xF00CA000, irq=51
libphy: XEMACPS mii bus: probed
xemacps e000b000.ps7-ethernet: invalid address, use assigned
xemacps e000b000.ps7-ethernet: MAC updated 96:ec:fa:13:9f:95
xemacps e000b000.ps7-ethernet: pdev->id -1, baseaddr 0xe000b000, irq 54
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ULPI transceiver vendor/product ID 0x0424/0x0007
Found SMSC USB3320 ULPI transceiver.
ULPI integrity check: passed.
xusbps-ehci xusbps-ehci.0: Xilinx PS USB EHCI Host Controller
xusbps-ehci xusbps-ehci.0: new USB bus registered, assigned bus number 1
xusbps-ehci xusbps-ehci.0: irq 53, io mem 0x00000000
xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Xilinx PS USB EHCI Host Controller
usb usb1: Manufacturer: Linux 3.8.11 ehci_hcd
usb usb1: SerialNumber: xusbps-ehci.0
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
i2c /dev entries driver
xi2cps e0004000.ps7-i2c: 400 kHz mmio e0004000 irq 57
i2c i2c-0: Added multiplexed i2c bus 1
i2c i2c-0: Added multiplexed i2c bus 2
i2c i2c-0: Added multiplexed i2c bus 3
at24 3-0054: 1024 byte 24c08 EEPROM, writable, 1 bytes/write
i2c i2c-0: Added multiplexed i2c bus 4
i2c i2c-0: Added multiplexed i2c bus 5
i2c i2c-0: Added multiplexed i2c bus 6
i2c i2c-0: Added multiplexed i2c bus 7
i2c i2c-0: Added multiplexed i2c bus 8
pca954x 0-0074: registered 8 multiplexed busses for I2C switch pca9548
xadcps f8007100.ps7-xadc: enabled:      yes     reference:      external
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: Invalid maximum block size, assuming 512 bytes
mmc0: SDHCI controller on e0100000.ps7-sdio [e0100000.ps7-sdio] using ADMA
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
NET: Registered protocol family 10
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
NET: Registered protocol family 40
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
Registering SWP/SWPB emulation handler
Freeing init memory: 6972K
mmc0: new high speed SDHC card at address 1234
mmcblk0: mmc0:1234 SA04G 3.67 GiB

mmcblk0:p1

ベストアンサー1

奇妙なカーネルの動作を見るときにdmesg最初に確認する必要があるのは次のとおりです。あなたの場合は重要な兆候を提供します。

4 ofpart partitions found on MTD device spi32766.0
    Creating 4 MTD partitions on "spi32766.0":
    0x000000000000-0x000000500000 : "boot"
    0x000000500000-0x000000520000 : "bootenv"
    0x000000520000-0x0000006402c0 : "image"
    mtd: partition "image" doesn't end on an erase block -- force read-only
    0x0000006402c0-0x000000b402c0 : "jffs2"
    mtd: partition "jffs2" doesn't start on an erase block boundary -- force read-only

表示される消去ブロックサイズは/proc/mtd64KiB(0x10000)です。 「イメージ」パーティション(0x1202c0)のサイズは、実際には削除ブロックサイズの倍数ではありません。最も近いもの(少し小さいですが)は0x120000(1152KiB)で、2番目に大きいものは0x130000(1216KiB)です。

おすすめ記事