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.85_2 #1 (Red Hat Linux)) id 1c6wGG-0006wa-IY for barebox@lists.infradead.org; Wed, 16 Nov 2016 09:12:09 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Wed, 16 Nov 2016 10:11:39 +0100 Message-Id: <20161116091139.15674-3-u.kleine-koenig@pengutronix.de> In-Reply-To: <20161116091139.15674-1-u.kleine-koenig@pengutronix.de> References: <20161116091139.15674-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 3/3] scripts/kwbimage: fix handling of binary header To: barebox@lists.infradead.org QSBiaW5hcnkgaGVhZGVyIGlzIDEyIGJ5dGVzICsgKDQgYnl0ZXMgKiBOdW1iZXIgb2YgQXJndW1l bnRzKSBiaWdnZXIKdGhhbiB0aGUgYWN0dWFsIGJpbmFyeS4gQmVmb3JlIHRoaXMgY29tbWl0IGlt YWdlIGV4dHJhY3Rpb24gd2FzIHdyb25nIGFuCm1hZGUgYmluYXJ5LjAgdG9vIGJpZyBieSBmb3Vy IGJ5dGVzIGF0IHRoZSBlbmQgKHdoaWNoIHdlcmUgMCBpbiBhbGwgdXN1YWwKY2FzZXMpLiBJbWFn ZSBjcmVhdGlvbiBoYWQgdGhlIHNhbWUgcHJvYmxlbSB3aGljaCByZXN1bHRlZCBpbiBicm9rZW4K aW1hZ2VzIHdoZW4gdGhlIGJpbmFyeSBkb2Vzbid0IGVuZCBpbiA0IGJ5dGVzIGNvbnRhaW5pbmcg MC4KCkZ1cnRoZXIgaGFuZGxlIGJpbmFyaWVzIHdpdGggYSBs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