public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Cannot write to ubi volume
@ 2008-06-04 15:49 iw3gtf
  2008-06-05  5:08 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: iw3gtf @ 2008-06-04 15:49 UTC (permalink / raw)
  To: linux-mtd

Hallo,

according to the ubi documentation it should be possible to 'write' in 
a, say, /dev/ubi1_0 (dynamic) volume device.
I tried the following without success:

root@giorgio [ ~ ]# ubimkvol /dev/ubi1 -N "rootfs" -s 32MiB 
Volume ID 0, size 265 LEBs (33648640 bytes, 32.1 MiB), LEB size 126976 
bytes (124.0 KiB), dynamic, name "rootfs", alignment 1
root@giorgio [ ~ ]# ls -al /dev/ubi*
crw-rw---- 1 root root 254,  0 1970-01-01 01:00 /dev/ubi0
crw-rw---- 1 root root 254,  2 1970-01-01 01:00 /dev/ubi0_1
crw-rw---- 1 root root 253,  0 1970-01-01 01:00 /dev/ubi1
crw-rw---- 1 root root 253,  1 2008-06-04 17:03 /dev/ubi1_0
crw-rw---- 1 root root  10, 63 1970-01-01 01:00 /dev/ubi_ctrl
root@giorgio [ ~ ]# dd if=/usr/local/tftp_root/k of=/dev/ubi1_0 
count=1960020 bs=1
dd: writing `/dev/ubi1_0': Operation not permitted
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.00690123 s, 0.0 kB/s
root@giorgio [ ~ ]# ubinfo /dev/ubi1_0
Volume ID:   0 (on ubi1)
Type:        dynamic
Alignment:   1
Size:        265 LEBs (33648640 bytes, 32.1 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 253:1

Am I completely wrong trying to write with a 'dd' ?
How should I proceed to write something into the volume ?
Is it possible to write something 'directly' in an ubi volume without 
explicitly formatting an image file (with 'ubinize' for example) ?

Excuse me if my questions are a bit silly or naive and thank you for 
your explanations.

giorgio



_________________________________________________________________

Non perdere altro tempo...corri incontro all'amore!  http://incontri.tiscali.it/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Cannot write to ubi volume
  2008-06-04 15:49 Cannot write to ubi volume iw3gtf
@ 2008-06-05  5:08 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2008-06-05  5:08 UTC (permalink / raw)
  To: iw3gtf@tiscali.it; +Cc: linux-mtd

Hi,

On Wed, 2008-06-04 at 17:49 +0200, iw3gtf@tiscali.it wrote:
> according to the ubi documentation it should be possible to 'write' in 
> a, say, /dev/ubi1_0 (dynamic) volume device.

Could you please point where exactly you have read this - these docs.
should be fixed.

Direct writes like you tried are prohibited and you have to use volume
update operation, or ubiupdatevol utility instead of dd:

ubiupdatevol /dev/ubi1_0 /usr/local/tftp_root/k

> Am I completely wrong trying to write with a 'dd' ?
Yes.

> How should I proceed to write something into the volume ?

ubiupdatevol

> Is it possible to write something 'directly' in an ubi volume without 
> explicitly formatting an image file (with 'ubinize' for example) ?

ubinize is needed if you want to pre-create a _raw_ flash image and
write it to _raw_ flash (e.g., /dev/mtd0). If you already have UBI
running and want to put arbitrary contents from file 'x' to the volume,
then you use 'ubiupdatevol <UBI volume device> x'. Or you may use thr
corresponding ioctl from your programs.

Direct writes with dd and the like are prohibited by design, mostly to
protect UBI from dumb users (and dumb users from themselves). Indeed,
direct writes are tricky and the user has to be very careful. However,
if you show the reasons why you have to have direct writes and cannot
live with volume update, we may allow them.

> Excuse me if my questions are a bit silly or naive and thank you for 
> your explanations.

No problem.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-05  5:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-04 15:49 Cannot write to ubi volume iw3gtf
2008-06-05  5:08 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox