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.87 #1 (Red Hat Linux)) id 1ccdoJ-00074A-Lq for barebox@lists.infradead.org; Sat, 11 Feb 2017 19:58:21 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sat, 11 Feb 2017 20:57:51 +0100 Message-Id: <20170211195752.13616-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 1/2] scripts: kwboot: fix image check for padded images To: barebox@lists.infradead.org Cc: bodhi V2hlbiB0aGVyZSBpcyBzb21lIHBhZGRpbmcgYmV0d2VlbiBoZWFkZXIgYW5kIHBheWxvYWQgdGhl IGNsYWltCgoJaGVhZGVyX3NpemUgKyBpbWFnZV9zaXplID09IGZpbGVfc2l6ZQoKZmFpbHMuIFJl bGF4IHRoZSBjaGVjayBhY2NvcmRpbmdseSB0bzoKCgloZWFkZXJfc2l6ZSA8PSBpbWFnZV9vZmZz ZXQgJiYKCWltYWdlX29mZnNldCArIGltYWdlX3NpemUgPT0gZmlsZV9zaXplCgpTaWduZWQtb2Zm LWJ5OiBVd2UgS2xlaW5lLUvDtm5pZyA8dS5rbGVpbmUta29lbmlnQHBlbmd1dHJvbml4LmRlPgot LS0KIHNjcmlwdHMva3dib290LmMgfCAxNiArKysrKysrKysrKystLS0tCiAxIGZpbGUgY2hhbmdl ZCwgMTIgaW5zZXJ0aW9ucygrKSwgNCBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9zY3JpcHRz L2t3Ym9vdC5jIGIvc2NyaXB0cy9rd2Jvb3QuYwppbmRleCA5ZTQxODFlNTM5YWM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