Thread (5 messages) 5 messages, 3 authors, 2021-06-27

Re: Query: UBIFS: How to detect empty volumes

flat view

From: Richard Weinberger <hidden>
Date: 2021-06-27 08:42:28
Also in: linux-fsdevel, lkml

On Thu, Jun 24, 2021 at 6:09 PM Pintu Agarwal [off-list ref] wrote:
I have one basic query related to UBIFS volumes on a system with NAND partition.
There is no such thing as a UBIFS volume. Do you mean UBI volumes?
In short, how to detect a particular empty volume inside a system
partition while flashing the partition image?
What do you mean by system partition? A MTD partition?
Suppose I have one big system partition that consists of 4-5 ubi
volumes inside it with varying sizes.
Lets say:
-- System Partition (ubi image)
    - rootfs volume (ro, squashfs)
    - data volume (rw, ubifs)
    - firmware volume (ro, ubifs)
    - some-other volume (ro, squashfs)
So by system partition you mean the MTD partition that hosts UBI itself?
Consider that all these could be flashed together as part of
system.ubi image in a single shot from the bootloader.
Now, suppose, one of the volume image (say firmware) is missing or
remains empty (as you know we can have empty volumes).

So, during system image flashing, we wanted to detect if one of the
volume (firmware) is empty.
Since this is an important volume, so we wanted to detect if this
volume is empty/missing we will abort flashing the system partition.
As there is no point in booting the system without this partition.

So, I am exploring options, how can this be detected ?
Read from the volume after flashing. If you get only 0xFF bytes it is empty.
I mean is there any kind of magic number or header information which
we can read to detect a particular empty volume ?
Can we get any information from just "system.ubi" image to indicate
about the volume information ?
You'll need to perform a proper UBI scan on all blocks.
If for the sad volume no LEBs have been found it is empty.
Also it could be possible that 2 or more volumes are empty, but we are
only concerned about one particular volume (firmware), so how to
detect particular volume ?
I don't understand the use case. Is your image creation process so error prone
that you can't be sure whether critical parts got included or not?

-- 
Thanks,
//richard

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help