From patchwork Thu Dec 21 22:59:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 852168 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Cyu1iRlA"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="S4vMb3HF"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z2nFY2qLVz9s7F for ; Fri, 22 Dec 2017 10:01:37 +1100 (AEDT) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2+wOEHWC86taIAWp+6cwCiCdyXBVCjesp+/ljZK7W9M=; b=Cyu1iRlAZrM6t8 E386O4PMTon5ND0YE/8zXOCr+b3CyDbFKfV10doegGH6GNqDQVt27tRz/A/Xx/qtmwnVgmtP6+/9V mbSD53sy8AfOZzeD/UcxblDorfdws4/8/54lbfX/26eiuPdGH1xcNVK90/o6BHjweIGyeoYwjWiQ1 INpoUd5abo5AV9JGnM5n2wuUno4hY/sLuhBmePf0VpRz7cUrK/K8Z4zuV5BNezBP0aMaMA6BU9VOZ 0GujbzC6GvEXlAIr2czFBmrCJtoFYxDeke/kwBJ3l19GgR6wy1y1YH1qxWhEe5Dc9RfjmngKsHKHy w2YRPBuG7TdyblQxTKXg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eS9qH-0007b7-1S; Thu, 21 Dec 2017 23:01:33 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::12]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eS9om-0005Vu-3T for lede-dev@lists.infradead.org; Thu, 21 Dec 2017 23:00:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1513897187; s=domk; d=heimpold.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject; bh=2auPhTTi8mZFayUrfKheyi4x6//RVXFAZ1eOfVRCToU=; b=S4vMb3HFOqYvZ4priR57sWL4KrI3jRnrvDpGz4kJgcThINN1QUB15y/fPUAk6PrFAL ZxrO8ITapmiK8NOgJxtJMskYgxnGommsVhSsmV29sQbUUsCjDEHloF4j4Dku8WjbicgD KutXRVfPZO3ZDhTuYHjyFN9ZQY0thngh5IAxg= X-RZG-AUTH: :O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZPUGwIpLOmsCM+BB/JuKj9RosYI7owD/XKfycfQ== X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr (p5DC3A286.dip0.t-ipconnect.de [93.195.162.134]) by smtp.strato.de (RZmta 42.14 DYNA|AUTH) with ESMTPSA id Y00a23tBLMxkSWP (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 21 Dec 2017 23:59:46 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id 5FC761CBA85; Thu, 21 Dec 2017 23:59:46 +0100 (CET) From: Michael Heimpold To: lede-dev@lists.infradead.org Date: Thu, 21 Dec 2017 23:59:29 +0100 Message-Id: <1513897174-20803-3-git-send-email-mhei@heimpold.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513897174-20803-1-git-send-email-mhei@heimpold.de> References: <1513897174-20803-1-git-send-email-mhei@heimpold.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171221_150000_580159_9A33500E X-CRM114-Status: UNSURE ( 9.44 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5300:0:0:12 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [LEDE-DEV] [PATCH 2/7] firmware-tools/ptgen: do not truncate the output file X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org At the moment, the image file operated on is always truncated to 512 bytes. This limits the usage of ptgen somewhat. This change allows to use ptgen on existing, larger image files. In this case, only the partition table is written/updated while the rest of the image file is left alone. Signed-off-by: Michael Heimpold --- tools/firmware-utils/src/ptgen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/firmware-utils/src/ptgen.c b/tools/firmware-utils/src/ptgen.c index 93d66eb..ff97cd5 100644 --- a/tools/firmware-utils/src/ptgen.c +++ b/tools/firmware-utils/src/ptgen.c @@ -166,7 +166,7 @@ static int gen_ptable(uint32_t signature, int nr) printf("%ld\n", (long)len * 512); } - if ((fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644)) < 0) { + if ((fd = open(filename, O_WRONLY|O_CREAT, 0644)) < 0) { fprintf(stderr, "Can't open output file '%s'\n",filename); return -1; }