* Is ubiattach alone somehow damaging a partition?
@ 2016-03-09 10:43 john smith
2016-03-09 18:55 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: john smith @ 2016-03-09 10:43 UTC (permalink / raw)
To: linux-mtd
I have the following MTD devices on my board:
/ $ cat /proc/mtd
dev: size erasesize name
mtd0: 004e0000 00020000 "flash1.kernel"
mtd1: 07d80000 00020000 "flash1.rootfs0"
mtd2: 07d80000 00020000 "flash1.rootfs1"
mtd3: 10000000 00020000 "flash1"
I can boot Linux either from flash1.rootfs0 or flash1.rootfs1. When I
boot from flash1.rootfs0 I can successfully attach flash1.rootfs1
(mtd2):
/ $ ubiattach /dev/ubi_ctrl -m 2
[ 346.938374] UBI: attaching mtd2 to ubi0
[ 347.633530] UBI: scanning is finished
[ 347.654366] UBI: attached mtd2 (name "flash1.rootfs1", size 125 MiB) to ubi0
[ 347.661459] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 347.668263] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 347.674978] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 347.681875] UBI: good PEBs: 1001, bad PEBs: 3, corrupted PEBs: 0
[ 347.687893] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 347.695042] UBI: max/mean erase counter: 3/1, WL threshold: 4096,
image sequence number: 3369714212
[ 347.704102] UBI: available PEBs: 808, total reserved PEBs: 193,
PEBs reserved for bad PEB handling: 37
[ 347.713553] UBI: background thread "ubi_bgt0d" started, PID 1265
UBI device number 0, total 1001 LEBs (127102976 bytes, 121.2 MiB),
available 808 LEBs (102596608 bytes, 97.8 MiB), LEB size 126976 bytes
(124.0 KiB)
/ $ echo $?
0
All is good so far - no errors. However, after reboot I no longer can
boot from flash1.rootfs1. CFE says:
Could not load (null): Bad executable format
*** command status = -11
What might have happened to flash1.rootfs1? The same happens when I
detach mtd2 after attaching it.
--
<wempwer@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is ubiattach alone somehow damaging a partition?
2016-03-09 10:43 Is ubiattach alone somehow damaging a partition? john smith
@ 2016-03-09 18:55 ` Richard Weinberger
2016-03-09 20:52 ` john smith
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2016-03-09 18:55 UTC (permalink / raw)
To: john smith; +Cc: linux-mtd@lists.infradead.org
Hi!
On Wed, Mar 9, 2016 at 11:43 AM, john smith <wempwer@gmail.com> wrote:
> I have the following MTD devices on my board:
>
> / $ cat /proc/mtd
> dev: size erasesize name
> mtd0: 004e0000 00020000 "flash1.kernel"
> mtd1: 07d80000 00020000 "flash1.rootfs0"
> mtd2: 07d80000 00020000 "flash1.rootfs1"
> mtd3: 10000000 00020000 "flash1"
>
> I can boot Linux either from flash1.rootfs0 or flash1.rootfs1. When I
> boot from flash1.rootfs0 I can successfully attach flash1.rootfs1
> (mtd2):
>
> / $ ubiattach /dev/ubi_ctrl -m 2
> [ 346.938374] UBI: attaching mtd2 to ubi0
> [ 347.633530] UBI: scanning is finished
> [ 347.654366] UBI: attached mtd2 (name "flash1.rootfs1", size 125 MiB) to ubi0
> [ 347.661459] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
> [ 347.668263] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
> [ 347.674978] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
> [ 347.681875] UBI: good PEBs: 1001, bad PEBs: 3, corrupted PEBs: 0
> [ 347.687893] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
> [ 347.695042] UBI: max/mean erase counter: 3/1, WL threshold: 4096,
> image sequence number: 3369714212
> [ 347.704102] UBI: available PEBs: 808, total reserved PEBs: 193,
> PEBs reserved for bad PEB handling: 37
> [ 347.713553] UBI: background thread "ubi_bgt0d" started, PID 1265
> UBI device number 0, total 1001 LEBs (127102976 bytes, 121.2 MiB),
> available 808 LEBs (102596608 bytes, 97.8 MiB), LEB size 126976 bytes
> (124.0 KiB)
> / $ echo $?
> 0
>
> All is good so far - no errors. However, after reboot I no longer can
> boot from flash1.rootfs1. CFE says:
>
> Could not load (null): Bad executable format
> *** command status = -11
>
> What might have happened to flash1.rootfs1? The same happens when I
> detach mtd2 after attaching it.
Are both mtd1 and mtd2 supposed to carry UBI?
I'm not rally sure what you are trying to do...
If you ask UBI to attach to an mtd it will write to it.
--
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is ubiattach alone somehow damaging a partition?
2016-03-09 18:55 ` Richard Weinberger
@ 2016-03-09 20:52 ` john smith
2016-03-09 21:00 ` Richard Weinberger
2016-03-10 9:05 ` Artem Bityutskiy
0 siblings, 2 replies; 5+ messages in thread
From: john smith @ 2016-03-09 20:52 UTC (permalink / raw)
To: Richard Weinberger; +Cc: linux-mtd@lists.infradead.org
On 3/9/16, Richard Weinberger <richard.weinberger@gmail.com> wrote:
> Are both mtd1 and mtd2 supposed to carry UBI?
> I'm not rally sure what you are trying to do...
Hmm... probably not as kernel booting command does not contain
anything similar to this:
root=ubi:rootfs rootfstype=ubifs ubi.mtd=flash1.rootfs0
However, I just thought that I can use ubiattach to be able to mount
any given mtd device. I was looking for a way to get access to a
currently not used mtd device. If ubiattach is suitable for this,
then what may be?
> If you ask UBI to attach to an mtd it will write to it.
Where exactly? In do_attach() there is only open(), ioctl() and
close() called. Where will writing take place?
--
<wempwer@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is ubiattach alone somehow damaging a partition?
2016-03-09 20:52 ` john smith
@ 2016-03-09 21:00 ` Richard Weinberger
2016-03-10 9:05 ` Artem Bityutskiy
1 sibling, 0 replies; 5+ messages in thread
From: Richard Weinberger @ 2016-03-09 21:00 UTC (permalink / raw)
To: john smith; +Cc: linux-mtd@lists.infradead.org
Am 09.03.2016 um 21:52 schrieb john smith:
> On 3/9/16, Richard Weinberger <richard.weinberger@gmail.com> wrote:
>> Are both mtd1 and mtd2 supposed to carry UBI?
>> I'm not rally sure what you are trying to do...
>
> Hmm... probably not as kernel booting command does not contain
> anything similar to this:
>
> root=ubi:rootfs rootfstype=ubifs ubi.mtd=flash1.rootfs0
>
> However, I just thought that I can use ubiattach to be able to mount
> any given mtd device. I was looking for a way to get access to a
> currently not used mtd device. If ubiattach is suitable for this,
> then what may be?
>
>> If you ask UBI to attach to an mtd it will write to it.
>
> Where exactly? In do_attach() there is only open(), ioctl() and
> close() called. Where will writing take place?
We need to clarify some bits first.
UBI is kind of a volume manager on top of MTD. It offers also wear leveling
and other NAND related stuff.
Think of an LVM for flash.
Attaching and MTD to UBI means instantiating UBI and making the data
stored by UBI available.
UBI volumes can be used by high level users. The most prominent user is UBIFS.
A filesystem on top of UBI.
If you attach an MTD, UBI owns it and is obligated to write the metadata and/or
erase blocks.
For the gory details see drivers/mtd/ubi/attach.c.
So, what exactly is the expected result and what happens?
I'm still not sure what you are trying to do.
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Is ubiattach alone somehow damaging a partition?
2016-03-09 20:52 ` john smith
2016-03-09 21:00 ` Richard Weinberger
@ 2016-03-10 9:05 ` Artem Bityutskiy
1 sibling, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2016-03-10 9:05 UTC (permalink / raw)
To: john smith, Richard Weinberger; +Cc: linux-mtd@lists.infradead.org
On Wed, 2016-03-09 at 21:52 +0100, john smith wrote:
> On 3/9/16, Richard Weinberger <richard.weinberger@gmail.com> wrote:
> >
> > Are both mtd1 and mtd2 supposed to carry UBI?
> > I'm not rally sure what you are trying to do...
> Hmm... probably not as kernel booting command does not contain
> anything similar to this:
>
> root=ubi:rootfs rootfstype=ubifs ubi.mtd=flash1.rootfs0
>
> However, I just thought that I can use ubiattach to be able to mount
> any given mtd device. I was looking for a way to get access to a
> currently not used mtd device. If ubiattach is suitable for this,
> then what may be?
Yeah, as Richard said, this is a bit vague description.
If you know what LVM is, what you are saying is something like:
"I just thought that I can use vgimport to be able to mount any block
device. I was looking for a way to get access to a currently not used
block devices. If vgimport is suitable for this, then what may be?"
Indeed, try to express what you want to achieve, and them may be it
becomes clearer to us.
Artem.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-10 9:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 10:43 Is ubiattach alone somehow damaging a partition? john smith
2016-03-09 18:55 ` Richard Weinberger
2016-03-09 20:52 ` john smith
2016-03-09 21:00 ` Richard Weinberger
2016-03-10 9:05 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox