[#5490] copy mtd.img file to /dev/mtd2 fails

Document created by Aaronwu Employee on Sep 4, 2013
Version 1Show Document
  • View in full screen mode

[#5490] copy mtd.img file to /dev/mtd2 fails

Submitted By: Mingquan Pan

Open Date

2009-09-03 19:09:22     Close Date

2009-10-10 05:13:37

Priority:

Medium     Assignee:

Graf Yang

Status:

Closed     Fixed In Release:

N/A

Found In Release:

2010R1     Release:

Category:

N/A     Board:

N/A

Processor:

BF537     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:

Fixed

Uboot version or rev.:

    Toolchain version or rev.:

09r1-rc9

App binary format:

N/A     

Summary: copy mtd.img file to /dev/mtd2 fails

Details:

 

copy mtd.img file to /dev/mtd2 fails, and it can't find the device after doing copy operation.

 

root:/> flash_eraseall  /dev/mtd2

Erasing 64 Kibyte @ 230000 -- 100 % complete.

root:/> cat /rootfs/test

testing

root:/> mkfs.jffs2 -r /rootfs -o mtd.img

root:/> cp mtd.img /dev/mtd2

root:/> flash_eraseall  /dev/mtd2

flash_eraseall: /dev/mtd2: unable to get MTD device info

root:/>

root:/> version

kernel:    Linux release 2.6.30.5-ADI-2010R1-pre-svn7263, build #16 Fri Sep 4 09:51:16 CST 2009

toolchain: bfin-uclinux-gcc release gcc version 4.1.2 (ADI svn)

user-dist: release svn-8819, build #100 Fri Sep 4 09:49:31 CST 2009

root:/>

 

pass version: linux 7251, uclinux-dist: 8786

failed version: linux: 7258  uclinux-dist: 8803

 

Follow-ups

 

--- Graf Yang                                                2009-09-30 02:02:51

It is a bug of cp, it make the /dev/mtd2 to be a common file.

 

# cat file > /dev/mtd2 can work.

busybox-1.14.3 have not this bug.

 

I have fire a bug to busybox,

https://bugs.busybox.net/show_bug.cgi?id=631

 

--- Mike Frysinger                                           2009-09-30 02:07:47

busybox is operating correctly as configured.  if you want the old behavior,

disable the CONFIG_FEATURE_NON_POSIX_CP option in the busybox config.

 

--- Graf Yang                                                2009-09-30 02:28:02

As busybox said,

With this option, "cp file symlink" will delete symlink and create a

regular file. This does not conform to POSIX, but prevents a symlink attack.

Similarly, "cp file device" will not send file's data to the device.

 

so it works correctly.

 

If we want to use cp to copy files to device we'd close,

uClinux Distribution Configuration,

BusyBox  --->

Busybox Settings  --->

Busybox Library Tuning  --->

[ ] Non-POSIX, but safer, copying to special nodes

 

 

--- Mingquan Pan                                             2009-10-10 05:13:37

Yeah, the copy is ok after disabling this config. So close.

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

No Files Were Found

Attachments

    Outcomes