From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3E5AC43381 for ; Thu, 21 Mar 2019 07:55:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88C0D218B0 for ; Thu, 21 Mar 2019 07:55:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PT/VqyZ/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88C0D218B0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sigma-star.at Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=HaOx3MgBjLTtRyNTAXY5wyDg3+ETxO5yOE6osReORIs=; b=PT/VqyZ/7PhWuyZUbH9pxXiNbo WR8RCm51fuIKN0+E+shZwVH/NSGjCKFy8antz9wwLUyNfY+hmXV0TzU7KU4AghnoE/+nRs2jLBHEZ y7UJJscKQV/hUSdLKm8F81TScUlkKlZUZDRHydbFVJd39N9AjWNPaBtq0IsP0u120XV0zNsEzu8z+ yKpIGoGv09WyEGoc30WhWxk89W04SaAmt+2y019NrkDmMuQ5n0AZYoLhLgFccSS5mgQ/BN4EJvewq eUgMX97xL9pcCMbLPVsu5rmZgQiWvg+O2Y163dSlkzU/0jFTijdQp8Bmt6XTsavuohMBrjevv5WeF PrJEy3dw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6sXW-0000eV-9F; Thu, 21 Mar 2019 07:55:02 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6sXS-0000YC-Mz for linux-mtd@lists.infradead.org; Thu, 21 Mar 2019 07:55:00 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id A6FC318021992; Thu, 21 Mar 2019 08:54:52 +0100 (CET) Subject: Re: nandwrite vs. flashcp when writing image to mtd device To: Shibin George , "linux-mtd@lists.infradead.org" References: From: David Oberhollenzer Openpgp: preference=signencrypt Autocrypt: addr=david.oberhollenzer@sigma-star.at; prefer-encrypt=mutual; keydata= mQENBFZyf0YBCADHyKhABhxthCC9n48pvsuk5p3IEdYXMs8Apenh1N/Z4cViAz/d/nSCZ+FG FX/PSubEzq8AilZLejchAltaORCvA1Y6FgTlpcdJ6gHDfStDbJL/vk5N8aL7YNF7VfjTRntB tKbhKcrG05nbdNjIioAm04pt9rx5mV5KMbf22/FdZpOSSsC6/N7b/cFH9+fx8kwi4pNFuJwr BkWRuQ7rEtCoSpd22t+Vh9qA7kymW9gWY405258jnN65jBO7ElqU2CCuGRPg6uryAHV3RVCB 9j9AE3H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kJCb7oB1ZraIBNBPtPPVUhbwLie4uW/LVt+8rBKz3W9KEDOsT0ZCG/pW8Ld+EpDR9l0fm qoVHaw8PhLAtez+B7HS7Hv7iJPDtX85kFYpud8kIPENXVn9EjZudyMWgZb2LhYlcavNcszgR 7In6ift5SNySojCOfAV0iKZb8QUXWktLleY8kQ8jltOsSRTuO4PDfzvtCQDixUw4tQ7WLwDT qyUpot0oG03vtSG4LIRCdxI= Organization: sigma star gmbh Message-ID: <32029ac2-c9c3-93a0-3195-0829387ceeac@sigma-star.at> Date: Thu, 21 Mar 2019 08:54:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190321_005458_903239_199A9401 X-CRM114-Status: GOOD ( 11.02 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org Hi, flashcp is a rather crude program and hasn't seen any improvements in way over a decade. All it does is round the size of your input file up to the reported block size, erases that range and then writes the input file. It directly opens the device file, works on the raw fd and does 2 ioctls to retrieve the erase size and erase that range. The size of 6815744 happens to be the reported block size of 262144 * 26. Erasing multiple blocks in one go is supported by the erase ioctl, it is also what libmtd does internally. However, flashcp is completely oblivious of bad blocks, OOB size and other fun stuff. nandwrite is somewhat more sophisticated. It is aware of all of the above and has a lot of extra command line options for fine grained control over those things. It also uses libmtd to access the flash which in turn is aware of a lot of newer ioctls and provides a number of fallback code paths. So yes, I would recommend using nandwrite for writing images to nand flashes. Regards, David ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/