Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4540pxv; Wed, 21 Jul 2021 13:56:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKMiE540jxvkYNQzceXZzeALlOn6d63J/WWlhci3iOXjZVrl5gfAusncyyUztRT63tjlWU X-Received: by 2002:a05:6402:1d2d:: with SMTP id dh13mr32562671edb.90.1626901014662; Wed, 21 Jul 2021 13:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626901014; cv=none; d=google.com; s=arc-20160816; b=Jj4kxEZngSJtDTRnOH/yUWb1o+F83szSu2A9dNKvlw9tKkp01dExKzwzehr49oDi82 g4j4bx+vbQCJJ84tuyOziekI1B5SiEwFgbGFH0kFWVZRo9JgwJl5+xAZId7XHbbQ+LJy 2Ml7PdOGsa+y5yfsaBHe8lDpNDEVHRiW7KwN0Qi/fK64whbBHQHCwA8WHqJW2NQNQudf iMFx0uV9cIjg8+dMKhlODAzvP3se2p/Ele3u4ayNo+lTq+dKd5MdXeNffK1BJAZxlFMv 6yN+woYjd3a7OuTLmOHf8ZIcVfBEBFavxPPk6itP+YINBhXJ4hU31ncwEeqtN6NN3htH jIEQ== 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=5nxGstEAePJBrLK8GIGCUg81S4fgSJ/ITh5eeF14WR4=; b=s73xX4H9X5+mJAA9eIVVO5e9MNqTKay6IYItzesaEkpAboFJQ6r+HbsDPAbxSkAU7u Duoo3fdxfstpYImDpfmNG2MErGKMB9U54Vi19v+J7uOi5Q6D+EnxlFB5JD+zZaJW52Nh eHaqdCsSPaYqVs/LGAr2h8mJFRTBqnjPdmXjNBRFvqPnEL2l+JGBRI7U4UVY+pZffK5O mEYYGrP/TP8jP/nASBGwoe9cl/bZsGIzc/JE4YY58Cr1cNrWULYfCDS2cGAwayrTaYQD U6WPEq48zE8n9ZfsY25WXB/BehdjqikyjD5clYHcMRPsADFNRRyvW2amNmJWszaqyTAy i5xw== 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 gq3si24973676ejb.543.2021.07.21.13.56.08; Wed, 21 Jul 2021 13:56:54 -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 S229666AbhGUUNz convert rfc822-to-8bit (ORCPT + 99 others); Wed, 21 Jul 2021 16:13:55 -0400 Received: from lithops.sigma-star.at ([195.201.40.130]:44328 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbhGUUNz (ORCPT ); Wed, 21 Jul 2021 16:13:55 -0400 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 4FA38606BA4F; Wed, 21 Jul 2021 22:54:29 +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 OeNpA8TbCsvM; Wed, 21 Jul 2021 22:54:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 88A0960A59D3; Wed, 21 Jul 2021 22:54:28 +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 JgBGLF30wa6X; Wed, 21 Jul 2021 22:54:28 +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 55876606BA4F; Wed, 21 Jul 2021 22:54:28 +0200 (CEST) Date: Wed, 21 Jul 2021 22:54:28 +0200 (CEST) From: Richard Weinberger To: Pintu Agarwal Cc: Greg KH , linux-kernel , linux-mtd , linux-fsdevel , Phillip Lougher , Sean Nyekjaer , Kernelnewbies Message-ID: <2132615832.4458.1626900868118.JavaMail.zimbra@nod.at> In-Reply-To: References: <568938486.33366.1626452816917.JavaMail.zimbra@nod.at> <1458549943.44607.1626686894648.JavaMail.zimbra@nod.at> <1556211076.48404.1626763215205.JavaMail.zimbra@nod.at> 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 - FF90 (Linux)/8.8.12_GA_3809) Thread-Topic: How to get actual image size from MTD partition Thread-Index: BowgerheV9p1zguM4N2pUdD/cVsfMg== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- 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 >> If you place your squashfs on a UBI static volume, UBI knows the exact length >> and you can checksum it >> more easily. > Yes, we use squashfs on UBI volumes, but our volume type is still dynamic. > Also, you said, UBI knows the exact length, you mean the whole image length ? > How can we get this length at runtime ? You need a static volume for that. If you update a static volume the length is known by UBI. > 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. > Or, you mean to say, the whole checksum logic is in-built inside the > UBI layer and users don't need to worry about the integrity at all ? Static volumes have a crc32 checksum over the whole content. Of course this offers no cryptographic integrity. See: http://www.linux-mtd.infradead.org/doc/ubi.html#L_overview Thanks, //richard