Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4300578pxv; Mon, 19 Jul 2021 23:44:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoo4tnKHkjXJ8jSPDnzQAvXz1ZPZWi+FRjnvHzEkurartgLnnQ/VFy4AEkjQzbg7RM23nu X-Received: by 2002:a05:6402:3454:: with SMTP id l20mr38627695edc.170.1626763475122; Mon, 19 Jul 2021 23:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626763475; cv=none; d=google.com; s=arc-20160816; b=IRAdm65cJychisy7So0CHIuY4Zh5cQ/ZNwE/BNlMJnJm+f33/DVVCycDbwDfNgN6d2 Bx4DdcbrkutDfsBpnusirJNOJd9pOoH8qpMBRHjXCSRpgXwgczNEDtD2K1s5su01C/v1 iUUMV8pk4H6jbIi9l5H0bUd1i6t+DuzuRqDyPfEFyJLjBpkU+k8AV1skVTYdH95RujGR kz93ghlCJK2NEPoLc4i3t+QMDMLr6ZE/zpTG30goxsiGhwwLH2Bb7Hm3iuyTYJn4fzbv ohKI8wh0PXKEMcxO/YxAx5Nlhk5gD99HVlic3X1TNB7M8Nn7C5GwM4CUvfE86kk+JNsI bNHg== 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=9WqDK582AvivevcqtCTtfzF5lOJwygg3xSEJZA2/kdo=; b=VgvLE4yCvv0MLg5gleoL2sVteBpd9Q4HcHhqiyhdT2MfGSfhvpZL/zKWUZxMnByYuS s568hw6KibZs8q7mlrtrmRBSaDfNfDoebjiBvL1eMUJInITeb5LdnL6J8dzfQzPkhl0g qZuEDAuMXDdTbtrrLJnx4W0+ewegJQXIm3atpcYMAJsKzOlQ+R8eoQRQZ3lpBEA7NCHJ SaIyFPLYSrkL5QFZ9pA6RnArpsCMgIt9IJcCNxepM68L89tIifYPL9WKoj5fqzvxtaIU vJWtv7isIxProQ/u6vMEjNWY3ZdjpSwP95sKbPwZhfiO89gaqbOxoKdq7Dup3zMxStG+ eivg== 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 g16si23742961edv.472.2021.07.19.23.44.11; Mon, 19 Jul 2021 23:44:35 -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 S242570AbhGTF7o convert rfc822-to-8bit (ORCPT + 99 others); Tue, 20 Jul 2021 01:59:44 -0400 Received: from lithops.sigma-star.at ([195.201.40.130]:40882 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236659AbhGTF7j (ORCPT ); Tue, 20 Jul 2021 01:59:39 -0400 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 38E546169BC2; Tue, 20 Jul 2021 08:40:16 +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 2vmFpKXdmr5S; Tue, 20 Jul 2021 08:40:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id C12B36169BD2; Tue, 20 Jul 2021 08:40:15 +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 NPuSyuIQ7j5f; Tue, 20 Jul 2021 08:40:15 +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 88A5B6169BC2; Tue, 20 Jul 2021 08:40:15 +0200 (CEST) Date: Tue, 20 Jul 2021 08:40:15 +0200 (CEST) From: Richard Weinberger To: Pintu Agarwal Cc: Greg KH , linux-kernel , linux-mtd , linux-fsdevel , Phillip Lougher , Sean Nyekjaer , Kernelnewbies Message-ID: <1556211076.48404.1626763215205.JavaMail.zimbra@nod.at> In-Reply-To: References: <568938486.33366.1626452816917.JavaMail.zimbra@nod.at> <1458549943.44607.1626686894648.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: c6zZTS0QxRlvwgld28+UkRfD2UKnsA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Ursprüngliche Mail ----- > Von: "Pintu Agarwal" > Okay thank you. > We have tried dm-verity with squashfs (for our rootfs) but we are > facing some mounting issues. > [...] > [ 4.697757] device-mapper: init: adding target '0 96160 verity 1 > /dev/mtdblock34 /dev/mtdblock39 4096 4096 12020 8 sha256 > d7b8a7d0c01b9aec888930841313a81603a50a2a7be44631c4c813197a50d681 > aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7' > [ 4.704771] device-mapper: verity: sha256 using implementation > "sha256-generic" > [...] > [ 4.727366] device-mapper: init: dm-0 is ready > [ 4.912558] VFS: Cannot open root device "dm-0" or > unknown-block(253,0): error -5 > > The same works with ext4 emulation. > So, not sure if there are any changes missing w.r.t. squashfs on 4.14 kernel ? I don't know. > Anyways, I will create a separate thread for dm-verity issue and keep > this thread still open for UBI image size issue. > We may use dm-verify for rootfs during booting, but still we need to > perform integrity check for other nand partitions and UBI volumes. > > So, instead of calculating the checksum for the entire partition, is > it possible to perform checksum only based on the image size ? > Right now, we are still exploring what are the best possible > mechanisms available for this. I still don't fully understand what you are trying to achieve. Is it about cryptographic integrity of your storage or detecting errors after the flashing process? But let me advertise ubiblock a second time. If you place your squashfs on a UBI static volume, UBI knows the exact length and you can checksum it more easily. Thanks, //richard