linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard.weinberger@gmail.com>
To: Pintu Agarwal <pintu.ping@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
	Kernelnewbies <kernelnewbies@kernelnewbies.org>,
	Greg KH <greg@kroah.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	Sean Nyekjaer <sean@geanix.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Phillip Lougher <phillip@squashfs.org.uk>
Subject: Re: MTD: How to get actual image size from MTD partition
Date: Tue, 27 Jul 2021 23:16:25 +0200	[thread overview]
Message-ID: <CAFLxGvywv29u6DJZrJxnJJmUDSQ4xpbT0u5LNKY1uGKyQom+WA@mail.gmail.com> (raw)
In-Reply-To: <CAOuPNLhCMT7QTF+QadJyGDFNshH9VjEAzWStRpe8itw7HXve=A@mail.gmail.com>

On Thu, Jul 22, 2021 at 1:11 PM Pintu Agarwal <pintu.ping@gmail.com> wrote:
>
> On Thu, 22 Jul 2021 at 02:24, Richard Weinberger <richard@nod.at> wrote:
> >
> > ----- Ursprüngliche Mail -----
> > >> But let me advertise ubiblock a second time.
> > > Sorry, I could not understand about the ubiblock request. Is it
> > > possible to elaborate little more ?
> > > We are already using squashfs on top of our UBI volumes (including
> > > rootfs mounting).
> > > This is the kernel command line we pass:
> > > rootfstype=squashfs root=/dev/mtdblock44 ubi.mtd=40,0,30
> > > And CONFIG_MTD_UBI_BLOCK=y is already enabled in our kernel.
> > > Do we need to do something different for ubiblock ?
> >
> > From that command line I understand that you are *not* using squashfs on top of UBI.
> > You use mtdblock. ubiblock is a mechanism to turn an UBI volume into a read-only
> > block device.
> > See: http://www.linux-mtd.infradead.org/doc/ubi.html#L_ubiblock
> >
> Okay, you mean to say, we should use this ?
> ubi.mtd=5 ubi.block=0,0 root=/dev/ubiblock0_0
> Instead of this:
> root=/dev/mtdblock44 ubi.mtd=40,0,30

Yes. But it is not only about a different command line. It is a
different concept.
You use a emulated block device on top of UBI, and not directly on top
of an MTD part.

> Sorry, I could not get this part. How static volume can give image len ?
> You mean there is some interface available in kernel to get actual image len ?

use the ubinfo tool. Static volumes know exactly how much they are filled.

> > > Also, how can we get the checksum of the entire UBI volume content
> > > (ignoring the erased/empty/bad block content) ?
> >
> > Just read from the volume. /dev/ubiX_Y.
> >
> I think this also will give the entire volume size, but we still don't know how
> many pages have real data ?

"ubiinfo /dev/ubiX_Y" will tell you if the volume is of type static.

> For example:
> Suppose, my raw partition/volume is of size 10MB
> But my actual data inside it is of size ~3MB (may be split across?)
> Then, how can we get the actual size of the data content ?

See above.

> You mean to say: /dev/ubiX_Y should contain only data blocks ?

Yes. An UBI volume contains only "user data".

-- 
Thanks,
//richard

  reply	other threads:[~2021-07-27 21:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16  6:42 MTD: How to get actual image size from MTD partition Pintu Agarwal
2021-07-16  7:16 ` Richard Weinberger
2021-07-16 15:41 ` Greg KH
2021-07-16 16:26   ` Richard Weinberger
2021-07-19  9:09     ` Pintu Agarwal
2021-07-19  9:28       ` Richard Weinberger
2021-07-20  6:17         ` Pintu Agarwal
2021-07-20  6:40           ` Richard Weinberger
2021-07-20  8:01             ` Pintu Agarwal
2021-07-21 20:54               ` Richard Weinberger
2021-07-22 11:10                 ` Pintu Agarwal
2021-07-27 21:16                   ` Richard Weinberger [this message]
2021-07-29 11:17                     ` Ezequiel Garcia
2021-07-29 11:45                       ` Richard Weinberger
2021-07-29 12:03                         ` Ezequiel Garcia
2021-07-29 17:11                           ` Pintu Agarwal
2021-08-20 18:24                             ` Pintu Agarwal
2021-08-22 14:21                               ` Ezequiel Garcia
2021-08-30 15:58                                 ` Pintu Agarwal
2021-10-29 16:12                                   ` Pintu Agarwal
2021-10-29 16:48                                     ` Ezequiel Garcia
2021-11-08 13:51                                       ` Pintu Agarwal
2021-11-12 13:58                                         ` Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFLxGvywv29u6DJZrJxnJJmUDSQ4xpbT0u5LNKY1uGKyQom+WA@mail.gmail.com \
    --to=richard.weinberger@gmail.com \
    --cc=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=phillip@squashfs.org.uk \
    --cc=pintu.ping@gmail.com \
    --cc=richard@nod.at \
    --cc=sean@geanix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).