From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fOoTC-0002Ki-VW for barebox@lists.infradead.org; Fri, 01 Jun 2018 18:08:13 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Fri, 1 Jun 2018 20:07:50 +0200 Message-Id: <20180601180750.5436-4-u.kleine-koenig@pengutronix.de> In-Reply-To: <20180601180750.5436-1-u.kleine-koenig@pengutronix.de> References: <20180601180750.5436-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 4/4] scripts/kwboot: fix image check for v0 images To: barebox@lists.infradead.org U2luY2Uga3dib290IGNoZWNrcyB0aGUgY29udGVudHMgb2YgdGhlIGZpbGUgdG8gc2VuZCBpdCBv bmx5IHdvcmtzIGZvcgp2MSBpbWFnZXMgKG9yIHdpdGggLWYpLiBFeHRlbmQgdGhlIGNoZWNrIHRv IGtub3cgYWJvdXQgdjAgaW1hZ2VzLCB0b28uCgpGaXhlczogMzllYmQ3ZTczYmVjICgia3dib290 OiBkbyBhIGZpbGV0eXBlIGNoZWNrIGJlZm9yZSBzZW5kaW5nIHRoZSBpbWFnZSIpClNpZ25lZC1v ZmYtYnk6IFV3ZSBLbGVpbmUtS8O2bmlnIDx1LmtsZWluZS1rb2VuaWdAcGVuZ3V0cm9uaXguZGU+ Ci0tLQogc2NyaXB0cy9rd2Jvb3QuYyB8IDYzICsrKysrKysrKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrKystLS0tLS0tLQogMSBmaWxlIGNoYW5nZWQsIDUzIGluc2VydGlvbnMoKyksIDEw IG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