All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Pintu Agarwal <pintu.ping@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Phillip Lougher <phillip@squashfs.org.uk>,
	Sean Nyekjaer <sean@geanix.com>,
	Kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: MTD: How to get actual image size from MTD partition
Date: Fri, 16 Jul 2021 09:16:12 +0200 (CEST)	[thread overview]
Message-ID: <456614823.32530.1626419772792.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <CAOuPNLjzyG_2wGDYmwgeoQuuQ7cykJ11THf8jMrOFXZ7vXheJQ@mail.gmail.com>

Pintu,

----- Ursprüngliche Mail -----
> Von: "Pintu Agarwal" <pintu.ping@gmail.com>
> My requirement:
> To find the checksum of a real image in runtime which is flashed in an
> MTD partition.
> 
> Problem:
> Currently, to find the checksum, we are using:
> $ md5sum /dev/mtd14
> This returns the proper checksum of the entire partition.
> But we wanted to find the checksum only for the actual image data
> which will be used by our C utility to validate the image.
> Here, we don't know the actual image size.
> We only know the "partition-size" and "erasesize".
> 
> So, is there a mechanism to somehow find the image size at runtime?

not really, UBI manages the MTD and does wearleveling, auto growing of volumes, etc...
So as soon you attach the image once, it is changed and the checksum won't match.
It may work if you don't attach UBI and your flash program tool keeps track of
what pages it wrote.

Thanks,
//richard

WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard@nod.at>
To: Pintu Agarwal <pintu.ping@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	 linux-mtd <linux-mtd@lists.infradead.org>,
	 linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	 Phillip Lougher <phillip@squashfs.org.uk>,
	 Sean Nyekjaer <sean@geanix.com>,
	 Kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: MTD: How to get actual image size from MTD partition
Date: Fri, 16 Jul 2021 09:16:12 +0200 (CEST)	[thread overview]
Message-ID: <456614823.32530.1626419772792.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <CAOuPNLjzyG_2wGDYmwgeoQuuQ7cykJ11THf8jMrOFXZ7vXheJQ@mail.gmail.com>

Pintu,

----- Ursprüngliche Mail -----
> Von: "Pintu Agarwal" <pintu.ping@gmail.com>
> My requirement:
> To find the checksum of a real image in runtime which is flashed in an
> MTD partition.
> 
> Problem:
> Currently, to find the checksum, we are using:
> $ md5sum /dev/mtd14
> This returns the proper checksum of the entire partition.
> But we wanted to find the checksum only for the actual image data
> which will be used by our C utility to validate the image.
> Here, we don't know the actual image size.
> We only know the "partition-size" and "erasesize".
> 
> So, is there a mechanism to somehow find the image size at runtime?

not really, UBI manages the MTD and does wearleveling, auto growing of volumes, etc...
So as soon you attach the image once, it is changed and the checksum won't match.
It may work if you don't attach UBI and your flash program tool keeps track of
what pages it wrote.

Thanks,
//richard

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

WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard@nod.at>
To: Pintu Agarwal <pintu.ping@gmail.com>
Cc: Kernelnewbies <kernelnewbies@kernelnewbies.org>,
	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: Fri, 16 Jul 2021 09:16:12 +0200 (CEST)	[thread overview]
Message-ID: <456614823.32530.1626419772792.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <CAOuPNLjzyG_2wGDYmwgeoQuuQ7cykJ11THf8jMrOFXZ7vXheJQ@mail.gmail.com>

Pintu,

----- Ursprüngliche Mail -----
> Von: "Pintu Agarwal" <pintu.ping@gmail.com>
> My requirement:
> To find the checksum of a real image in runtime which is flashed in an
> MTD partition.
> 
> Problem:
> Currently, to find the checksum, we are using:
> $ md5sum /dev/mtd14
> This returns the proper checksum of the entire partition.
> But we wanted to find the checksum only for the actual image data
> which will be used by our C utility to validate the image.
> Here, we don't know the actual image size.
> We only know the "partition-size" and "erasesize".
> 
> So, is there a mechanism to somehow find the image size at runtime?

not really, UBI manages the MTD and does wearleveling, auto growing of volumes, etc...
So as soon you attach the image once, it is changed and the checksum won't match.
It may work if you don't attach UBI and your flash program tool keeps track of
what pages it wrote.

Thanks,
//richard

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

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

Thread overview: 69+ 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  6:42 ` Pintu Agarwal
2021-07-16  6:42 ` Pintu Agarwal
2021-07-16  7:16 ` Richard Weinberger [this message]
2021-07-16  7:16   ` Richard Weinberger
2021-07-16  7:16   ` Richard Weinberger
2021-07-16 15:41 ` Greg KH
2021-07-16 15:41   ` Greg KH
2021-07-16 15:41   ` Greg KH
2021-07-16 16:26   ` Richard Weinberger
2021-07-16 16:26     ` Richard Weinberger
2021-07-16 16:26     ` Richard Weinberger
2021-07-19  9:09     ` Pintu Agarwal
2021-07-19  9:09       ` Pintu Agarwal
2021-07-19  9:09       ` Pintu Agarwal
2021-07-19  9:28       ` Richard Weinberger
2021-07-19  9:28         ` Richard Weinberger
2021-07-19  9:28         ` Richard Weinberger
2021-07-20  6:17         ` Pintu Agarwal
2021-07-20  6:17           ` Pintu Agarwal
2021-07-20  6:17           ` Pintu Agarwal
2021-07-20  6:40           ` Richard Weinberger
2021-07-20  6:40             ` Richard Weinberger
2021-07-20  6:40             ` Richard Weinberger
2021-07-20  8:01             ` Pintu Agarwal
2021-07-20  8:01               ` Pintu Agarwal
2021-07-20  8:01               ` Pintu Agarwal
2021-07-21 20:54               ` Richard Weinberger
2021-07-21 20:54                 ` Richard Weinberger
2021-07-21 20:54                 ` Richard Weinberger
2021-07-22 11:10                 ` Pintu Agarwal
2021-07-22 11:10                   ` Pintu Agarwal
2021-07-22 11:10                   ` Pintu Agarwal
2021-07-27 21:16                   ` Richard Weinberger
2021-07-27 21:16                     ` Richard Weinberger
2021-07-27 21:16                     ` Richard Weinberger
2021-07-29 11:17                     ` Ezequiel Garcia
2021-07-29 11:17                       ` Ezequiel Garcia
2021-07-29 11:17                       ` Ezequiel Garcia
2021-07-29 11:45                       ` Richard Weinberger
2021-07-29 11:45                         ` Richard Weinberger
2021-07-29 11:45                         ` Richard Weinberger
2021-07-29 12:03                         ` Ezequiel Garcia
2021-07-29 12:03                           ` Ezequiel Garcia
2021-07-29 12:03                           ` Ezequiel Garcia
2021-07-29 17:11                           ` Pintu Agarwal
2021-07-29 17:11                             ` Pintu Agarwal
2021-07-29 17:11                             ` Pintu Agarwal
2021-08-20 18:24                             ` Pintu Agarwal
2021-08-20 18:24                               ` Pintu Agarwal
2021-08-20 18:24                               ` Pintu Agarwal
2021-08-22 14:21                               ` Ezequiel Garcia
2021-08-22 14:21                                 ` Ezequiel Garcia
2021-08-22 14:21                                 ` Ezequiel Garcia
2021-08-30 15:58                                 ` Pintu Agarwal
2021-08-30 15:58                                   ` Pintu Agarwal
2021-08-30 15:58                                   ` Pintu Agarwal
2021-10-29 16:12                                   ` Pintu Agarwal
2021-10-29 16:12                                     ` Pintu Agarwal
2021-10-29 16:12                                     ` Pintu Agarwal
2021-10-29 16:48                                     ` Ezequiel Garcia
2021-10-29 16:48                                       ` Ezequiel Garcia
2021-10-29 16:48                                       ` Ezequiel Garcia
2021-11-08 13:51                                       ` Pintu Agarwal
2021-11-08 13:51                                         ` Pintu Agarwal
2021-11-08 13:51                                         ` Pintu Agarwal
2021-11-12 13:58                                         ` Ezequiel Garcia
2021-11-12 13:58                                           ` Ezequiel Garcia
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=456614823.32530.1626419772792.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.