Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1061400pxv; Fri, 16 Jul 2021 00:17:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSc+jojxTEDrKh9NKvYmPhD1ff41SNgn8TSLdm8uWhKD/8vFT2dUVyXeNsebMbiBLGVMCy X-Received: by 2002:a50:b2c5:: with SMTP id p63mr12550107edd.5.1626419860686; Fri, 16 Jul 2021 00:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626419860; cv=none; d=google.com; s=arc-20160816; b=bcwtzywkyWjUGwh17itjBJ7kg0xnzd9i1v5Aei3Ed6zapkjPzmmvvQtcn0NGwXYZEC HBQLk3TEC9ooBBp/T0Pu1wiG/dUnxDIAnWs5K8sEAmyFbfoa5KMOC9UT3dd4Z/c8zEWd 2dQcVFqCCWRZLw0N4PRNMA2w/iHMfNgTOnCnelZDtfyxgk4Ik8X/Y0hl9cmsnwRSYsgp NifqKtQl4dhQ5l3/4cCnvCXzsOWZqvrvAsQtuO7o/LX/EgF2uHV1Tdd6JaACU2Qov9Pb pCsqmCTED3JD+hCImnno6+KwXfp7CFoeCghKDR1R4LCctD1i7ELGAWzLAS2cfUPGD734 RqeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=VoHNVLO7DJXzClTRt1VBnmkpJbWzePQhCfuGU5okbFc=; b=wZbnevXrMK+AqnNfFe7btDS2WmIn2oyo/VCfeG6AB+6KsidRU3+xfhMwi/E2gKlIeT 5UtZx7gPYyXKTYOtAKPGGp6UdUNt8/VMptavHAW9SO6WNGWRswpXtzMksDUnWAcXvZYr Po0/jVHgr5nbCBykPULUPcbbaUuXu/QdHp2hKoNdznCP0X3bfLDhaUB5E//uWppqHA9d E/yca3a5E4vNP4O6IkEpjgqg++QLJfNkQcofdONa2frpuNYPBi/ASS/b3IV/l1T7l9dr PJevJIwljLhNDMnqHtsU5n4xFruqrR95sDTsmoRvJHALTUUPbb6/gGbIv+8syiEEirQR u8ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id op26si11869908ejb.103.2021.07.16.00.17.17; Fri, 16 Jul 2021 00:17:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235762AbhGPHTK convert rfc822-to-8bit (ORCPT + 99 others); Fri, 16 Jul 2021 03:19:10 -0400 Received: from lithops.sigma-star.at ([195.201.40.130]:48144 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235689AbhGPHTJ (ORCPT ); Fri, 16 Jul 2021 03:19:09 -0400 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 8AD12616B568; Fri, 16 Jul 2021 09:16:13 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id wXv3S29yopAW; Fri, 16 Jul 2021 09:16:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 2C4C56169BB9; Fri, 16 Jul 2021 09:16:13 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id tSjbk7sNumXT; Fri, 16 Jul 2021 09:16:13 +0200 (CEST) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id F31C9616B568; Fri, 16 Jul 2021 09:16:12 +0200 (CEST) Date: Fri, 16 Jul 2021 09:16:12 +0200 (CEST) From: Richard Weinberger To: Pintu Agarwal Cc: linux-kernel , linux-mtd , linux-fsdevel , Phillip Lougher , Sean Nyekjaer , Kernelnewbies Message-ID: <456614823.32530.1626419772792.JavaMail.zimbra@nod.at> In-Reply-To: References: Subject: Re: MTD: How to get actual image size from MTD partition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF78 (Linux)/8.8.12_GA_3809) Thread-Topic: How to get actual image size from MTD partition Thread-Index: wRfeFLQcDSd8DiGHIt8B6zS4rgdF6w== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pintu, ----- Ursprüngliche Mail ----- > Von: "Pintu Agarwal" > 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