From patchwork Thu Aug 18 02:16:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Lippers-Hollmann X-Patchwork-Id: 660310 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sF8tQ0dZdz9t1G for ; Thu, 18 Aug 2016 12:19:26 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1baCtV-0007QI-7T; Thu, 18 Aug 2016 02:17:21 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1baCtR-0007MF-O2 for lede-dev@lists.infradead.org; Thu, 18 Aug 2016 02:17:19 +0000 Received: from mir ([79.203.31.206]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LzKmP-1b5MGd2Tpp-014TU0; Thu, 18 Aug 2016 04:16:54 +0200 Date: Thu, 18 Aug 2016 04:16:53 +0200 From: Stefan Lippers-Hollmann To: Jo-Philipp Wich Message-ID: <20160818041653.2cb1de46@mir> In-Reply-To: <20160817234128.14b92e77@mir> References: <20160817234128.14b92e77@mir> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Provags-ID: V03:K0:PzuElCtnQ9D5G2sjMK/t9XRssBGUtI75lqrmQ+Ek39sOlU4cLQT kYp3G+LdKG23ID9ewy5dmfyqk0pURJxJ3yqnAMux7VXvLLz5SbXPf9AqVuoFesQ0ZnZCYXg 8BGnG/rjkHtbrGGKMHH36kDquZSBNTp53oqRmt8o71dh2PpxQW3hICfsCcHlKHuWllTikk/ HI3E5/NrllrWNCYu1rAlw== X-UI-Out-Filterresults: notjunk:1; V01:K0:VWSUV3folbg=:779VYHv03bDlujDTJHQYTM /9+OzuwX57SH6k9hGBbXPWAIli/h7l9+MdHG9UgmqPuGC6H4g7fQHckmmBC1BeBLROx46+8zg rcAysgxBLPzk8NZUSiLs0vRwgfAYkSG+DXvR+dwqofb1bTg43b4OtgcCLziVQQG91mPDDiLSH hTxAHoT92xRVri0sl3Qm/7/h8zppva+xftQvCCeXIckDAfptmrWEcyHSLT5nro+X3xISEEgw6 9aL78TZglEtitxJJt9KvefipfLx85JZ6qwnNXOlFDqBF3LZjp/CPMJtzwiX9fh+zc/sGlbbLg Syj5tSwR3E0jNlokiJJjZ3b+YNR2PM+RGUDuSvqXIxFPPLcXWxtT79r4+e8uD8cyuZeZO6EQn LC7XJYJBW7nEfd+MdF78FaWYOG+NgZJ2rhTtSyHJlRFFqGZCZytMoM7uv9M7//D5ba0q5gIrJ 1cTAy0CGQVwNIbAUwdwRoipQLUBGhNJQcvcxKDQ+LnRWHXQh4aPKQCdiaKhVrbMMJFpT/luEF p+pwXbbgN7F1XudwKlvOv9CvzZW9AVhWzxKyWEZRdhf+7XOdMooLHrbiaUuBawxp4NPSDq3By 4gDY38pLx6L4tphtETJKBNvwn1Ot1oAUrxG2a6L3ppHay1MeZPp3HGH4/td+aRbPL7ojxr1vm rLVgmJkuNzi1Aj96z7sD1iH+V3Unf22gcE3US57wSDyU9Gb20xnfrosLVKpwiDKCruM9f2868 Ip0EDTPAZY8TPyRqMf/R5Cy7ZDzmvgtz/7IA+Md4QA8fWVTt+QZPukMuD5o= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160817_191718_205203_1A85687A X-CRM114-Status: GOOD ( 11.31 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.227.15.18 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.15.18 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (s.l-h[at]gmx.de) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH v2] build: reintroduce md5 checksums for generated firmware images X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lede-dev@lists.infradead.org Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Commit 83175687c81bee594885d0738cfd488673f5a3fb "build: remove image specific checksum code" dropped the generation of md5 checksums in favour of only shipping sha256 ones. A default Lede installation however doesn't enable busybox' sha256sum applet, which makes confirming the checksum on the device itself (e.g. for transmission errors to the device) more difficult than necessary, this patch reintroduces the generation of MD5 checksums for all firmware images. Signed-off-by: Stefan Lippers-Hollmann --- It would be simpler to call md5sum rather than openssl to generate the MD5 checksums, but in order to keep the prereqs small, I re-used openssl for this task as well, given that it's needed for the SHA256 checksums already. This adds roughly 3.6 seconds to the build times for ar71xx (589 files) v2: make sure to exclude {md5,sha256}sums from checksum files Makefile | 1 + rules.mk | 9 ++++++++- target/imagebuilder/files/Makefile | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 59320d4..51a2e38 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,7 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages fi checksum: FORCE + $(call md5sums,$(BIN_DIR)) $(call sha256sums,$(BIN_DIR)) prepare: .config $(tools/stamp-install) $(toolchain/stamp-install) diff --git a/rules.mk b/rules.mk index de24778..a3d296b 100644 --- a/rules.mk +++ b/rules.mk @@ -371,10 +371,17 @@ define file_copy $(CP) $(1) $(2) endef +# Calculate md5sum of any plain file within a given directory +# $(1) => Input directory +define md5sums + (cd $(1); find . -maxdepth 1 -type f -not -name 'md5sums' -not -name 'sha256sums' -printf "%P\n" | sort | \ + xargs openssl dgst -md5 | sed -ne 's!^MD5(\(.*\))= \(.*\)$$!\2 *\1!p' > md5sums) +endef + # Calculate sha256sum of any plain file within a given directory # $(1) => Input directory define sha256sums - (cd $(1); find . -maxdepth 1 -type f -not -name 'sha256sums' -printf "%P\n" | sort | \ + (cd $(1); find . -maxdepth 1 -type f -not -name 'md5sums' -not -name 'sha256sums' -printf "%P\n" | sort | \ xargs openssl dgst -sha256 | sed -ne 's!^SHA256(\(.*\))= \(.*\)$$!\2 *\1!p' > sha256sums) endef diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 493012f..15c34ed 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -174,6 +174,7 @@ build_image: FORCE checksum: FORCE @echo @echo Calculating checksums... + @$(call md5sums,$(BIN_DIR)) @$(call sha256sums,$(BIN_DIR)) clean: