linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Where to define multiple volumes sizes in one MTD rootfs partition?
@ 2019-10-05  0:50 JH
  2019-10-05  8:43 ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: JH @ 2019-10-05  0:50 UTC (permalink / raw)
  To: linux-mtd

Hi,

My apology if my question is not related to this mailing list.

I set up following 6 MTD partitions in boot argument environment, the
rootfs is in mtd5 partition where it is currently created one ubi
volume for rootfs in ubi0.

MFG_NAND_PARTITION
"mtdparts=gpmi-nand:4m(boot),2m(ubootenv),2m(dtb),16m(kernel1),16m(kernel2),-(ubi)
"

NAND_ROOT_UBI "root=ubi0:rootfs_data rw ubi.mtd=5,2048 noinitrd
rootfstype=ubifs mem=256M rootwait=1"

Recently, one of my device is broken failed to boot up, I still don't
know what was the cause by hardware problem or software, to be
precaution in the future meltdown, I am going to separate all writing
data from ubi0 to to another ubi volume ubi1, to keep the rootfs in
ubi0 read only. How can I define the ubi0 volume size to 160 MB and
the ubi1 volume size to 30 MB?

NAND_ROOT_UBI "root=ubi0:rootfs_data ro storage=ubi1:rootfs_data rw
ubi.mtd=5,2048 noinitrd rootfstype=ubifs mem=256M rootwait=1"

Sorry if it is a wrong question to this mailing list.

Thank you.

Kind regards,

- jh

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: Where to define multiple volumes sizes in one MTD rootfs partition?
  2019-10-05  0:50 Where to define multiple volumes sizes in one MTD rootfs partition? JH
@ 2019-10-05  8:43 ` Richard Weinberger
  2019-10-11  9:38   ` JH
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2019-10-05  8:43 UTC (permalink / raw)
  To: JH; +Cc: linux-mtd

On Sat, Oct 5, 2019 at 2:51 AM JH <jupiter.hce@gmail.com> wrote:
> Recently, one of my device is broken failed to boot up, I still don't
> know what was the cause by hardware problem or software, to be
> precaution in the future meltdown, I am going to separate all writing
> data from ubi0 to to another ubi volume ubi1, to keep the rootfs in
> ubi0 read only. How can I define the ubi0 volume size to 160 MB and
> the ubi1 volume size to 30 MB?

Don't setup multiple UBI instances on the same chip.
The wear leveling domain should be as large as possible.

If you want to have multiple UBIFS filesystems, just create more UBI
volumes.

-- 
Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: Where to define multiple volumes sizes in one MTD rootfs partition?
  2019-10-05  8:43 ` Richard Weinberger
@ 2019-10-11  9:38   ` JH
  2019-10-14  4:57     ` JH
  0 siblings, 1 reply; 6+ messages in thread
From: JH @ 2019-10-11  9:38 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd

On 10/5/19, Richard Weinberger <richard.weinberger@gmail.com> wrote:
> On Sat, Oct 5, 2019 at 2:51 AM JH <jupiter.hce@gmail.com> wrote:
>> Recently, one of my device is broken failed to boot up, I still don't
>> know what was the cause by hardware problem or software, to be
>> precaution in the future meltdown, I am going to separate all writing
>> data from ubi0 to to another ubi volume ubi1, to keep the rootfs in
>> ubi0 read only. How can I define the ubi0 volume size to 160 MB and
>> the ubi1 volume size to 30 MB?
>
> Don't setup multiple UBI instances on the same chip.
> The wear leveling domain should be as large as possible.
>
> If you want to have multiple UBIFS filesystems, just create more UBI
> volumes.

Hmm, wandering for several days how to do it, reading lots of
documents, still not clear how could I make that work, let's say I
have following a volume configure file:

$ cat volume.conf

[kernel-volume]
mode=ubi
image=zImage
vol_id=1
vol_size=10MiB
vol_type=static
vol_name=kernel

[rootfs-volume]
mode=ubi
image=rootfs_data
vol_id=2
vol_size=110MiB
vol_type=static
vol_name=rootfs

[data-volume]
mode=ubi
image=rootfs_data
vol_id=3
vol_size=10MiB
vol_type=dynamic
vol_name=data
vol_flags=autoresize

$ ubinize -o rootfs.img -p 130MiB -m 512 -s 256 volume.conf

$ ubidetach -p /dev/mtd5
$ ubiformat /dev/mtd5 -y
$ ubiattach -m 5
$ ubimkvol /dev/ubi0 -s 130MiB -N rootfs_data

$ mount -t ubifs ubi0:rootfs_data /mnt

If I have a single ubi0 rootfs in /dev/mtd5, I can set
"root=ubi0:rootfs_data rw ubi.mtd=5,2048  noinitrd rootfstype=ubifs
mem=256M rootwait=1"

$ tar zxvf yocto-image-rootfs.tar.gz -C /mnt

It can boot from the a single rootfs volume.

But for multiple volumes in ubi0, I lost completely, how can it boot
from volume configure file with multiple volumes? Where the
volume.conf should be placed in Linux rootfs, in "/"? If it is correct
to copy volume.conf to /mnt (the "/"), how will it boot from NAND with
multiple volumes? That is most confusing parts, I could not see any
clear examples and statements in documents, appreciate kindly advice.

Thank you very much Richard.

Kind regards,

- jh



it works, but how it can boot from volume configure file?

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: Where to define multiple volumes sizes in one MTD rootfs partition?
  2019-10-11  9:38   ` JH
@ 2019-10-14  4:57     ` JH
  2019-10-15 19:17       ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: JH @ 2019-10-14  4:57 UTC (permalink / raw)
  To: linux-mtd

Hi,

Sorry, if it is not right the mailing list to ask helps for multiple
volumes in a single ubi0 instance, any advice please?

Thank you.

Kind regards,

- jh

On 10/11/19, JH <jupiter.hce@gmail.com> wrote:
> On 10/5/19, Richard Weinberger <richard.weinberger@gmail.com> wrote:
>> On Sat, Oct 5, 2019 at 2:51 AM JH <jupiter.hce@gmail.com> wrote:
>>> Recently, one of my device is broken failed to boot up, I still don't
>>> know what was the cause by hardware problem or software, to be
>>> precaution in the future meltdown, I am going to separate all writing
>>> data from ubi0 to to another ubi volume ubi1, to keep the rootfs in
>>> ubi0 read only. How can I define the ubi0 volume size to 160 MB and
>>> the ubi1 volume size to 30 MB?
>>
>> Don't setup multiple UBI instances on the same chip.
>> The wear leveling domain should be as large as possible.
>>
>> If you want to have multiple UBIFS filesystems, just create more UBI
>> volumes.
>
> Hmm, wandering for several days how to do it, reading lots of
> documents, still not clear how could I make that work, let's say I
> have following a volume configure file:
>
> $ cat volume.conf
>
> [kernel-volume]
> mode=ubi
> image=zImage
> vol_id=1
> vol_size=10MiB
> vol_type=static
> vol_name=kernel
>
> [rootfs-volume]
> mode=ubi
> image=rootfs_data
> vol_id=2
> vol_size=110MiB
> vol_type=static
> vol_name=rootfs
>
> [data-volume]
> mode=ubi
> image=rootfs_data
> vol_id=3
> vol_size=10MiB
> vol_type=dynamic
> vol_name=data
> vol_flags=autoresize
>
> $ ubinize -o rootfs.img -p 130MiB -m 512 -s 256 volume.conf
>
> $ ubidetach -p /dev/mtd5
> $ ubiformat /dev/mtd5 -y
> $ ubiattach -m 5
> $ ubimkvol /dev/ubi0 -s 130MiB -N rootfs_data
>
> $ mount -t ubifs ubi0:rootfs_data /mnt
>
> If I have a single ubi0 rootfs in /dev/mtd5, I can set
> "root=ubi0:rootfs_data rw ubi.mtd=5,2048  noinitrd rootfstype=ubifs
> mem=256M rootwait=1"
>
> $ tar zxvf yocto-image-rootfs.tar.gz -C /mnt
>
> It can boot from the a single rootfs volume.
>
> But for multiple volumes in ubi0, I lost completely, how can it boot
> from volume configure file with multiple volumes? Where the
> volume.conf should be placed in Linux rootfs, in "/"? If it is correct
> to copy volume.conf to /mnt (the "/"), how will it boot from NAND with
> multiple volumes? That is most confusing parts, I could not see any
> clear examples and statements in documents, appreciate kindly advice.
>
> Thank you very much Richard.
>
> Kind regards,
>
> - jh
>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: Where to define multiple volumes sizes in one MTD rootfs partition?
  2019-10-14  4:57     ` JH
@ 2019-10-15 19:17       ` Richard Weinberger
  2019-10-29  6:00         ` JH
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2019-10-15 19:17 UTC (permalink / raw)
  To: JH; +Cc: linux-mtd

On Mon, Oct 14, 2019 at 6:57 AM JH <jupiter.hce@gmail.com> wrote:
>
> Hi,
>
> Sorry, if it is not right the mailing list to ask helps for multiple
> volumes in a single ubi0 instance, any advice please?

I'm a little lost in your questions.

If you have more than one volume on UBI, you get an /dev/ubiX_Y for each
volume. Where X is the UBI number, usually 0 and Y the volume number.
You can have an UBIFS on both volumes.

-- 
Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: Where to define multiple volumes sizes in one MTD rootfs partition?
  2019-10-15 19:17       ` Richard Weinberger
@ 2019-10-29  6:00         ` JH
  0 siblings, 0 replies; 6+ messages in thread
From: JH @ 2019-10-29  6:00 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd

Hi Richard,

On 10/16/19, Richard Weinberger <richard.weinberger@gmail.com> wrote:
> On Mon, Oct 14, 2019 at 6:57 AM JH <jupiter.hce@gmail.com> wrote:
>>
>> Hi,
>>
>> Sorry, if it is not right the mailing list to ask helps for multiple
>> volumes in a single ubi0 instance, any advice please?
>
> I'm a little lost in your questions.
>
> If you have more than one volume on UBI, you get an /dev/ubiX_Y for each
> volume. Where X is the UBI number, usually 0 and Y the volume number.
> You can have an UBIFS on both volumes.

Sorry for not being clear about the question, I double checked the
document, it is better not to set kernel in MTD partition, but to UBI
volume partition, let me rephrase it.

Let's say I have following MTD partitions:

MFG_NAND_PARTITION
"mtdparts=gpmi-nand:4m(boot),2m(ubootenv),2m(dtb),-(ubi)"

So the volume partitions will be in mtd3 and ubi0.

/dev/ubi0_0 kernel
/dev/ubi0_1 rootfs
/dev/ubi0_2 data

It seems to me there are two ways to create UBI volumes, one is to
directly use MTD tools (correct me if it is wrong):

ubimkvol /dev/ubi0_0 -s 10MiB -N kernel_data
ubimkvol /dev/ubi0_1 -s 130MiB -N rootfs_data
ubimkvol /dev/ubi0_2 -s 10MiB -N storage_data

Another way as many document also suggested to use volume configure
file and ubinize to create and to read volume configure file, which I
don't know how to do it. Appreciate if anyone used kernel in UBI
volume partition and show the tips of how to use ubinize to create and
to read the volume configure file.

If the kernel is in one MTD partition and a single volume in rootfs of
another MTD partition, I can define following boot command to boot the
rootfs from the NAND.

bootargs "root=ubi0:rootfs_data rw ubi.mtd=5,2048 noinitrd
rootfstype=ubifs mem=256M rootwait=1"

For multiple UBIFS volume partitions in ubi0, especially when one ubi
volume is for kernel, how can I boot the kernel volume partition
first, then to rootfs volume partition? I am sure the following setup
boot args is wrong,could anyone correct it please?

bootargs "kernel=ubi0:kernel_data root=ubi0:rootfs_data rw
ubi.mtd=5,2048 noinitrd rootfstype=ubifs mem=256M rootwait=1"

Thank you.

Kind regards,

- jh

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2019-10-29  6:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-05  0:50 Where to define multiple volumes sizes in one MTD rootfs partition? JH
2019-10-05  8:43 ` Richard Weinberger
2019-10-11  9:38   ` JH
2019-10-14  4:57     ` JH
2019-10-15 19:17       ` Richard Weinberger
2019-10-29  6:00         ` JH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).