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 1chjL5-0002gg-C2 for barebox@lists.infradead.org; Sat, 25 Feb 2017 20:53:16 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sat, 25 Feb 2017 21:52:41 +0100 Message-Id: <20170225205242.18106-4-u.kleine-koenig@pengutronix.de> In-Reply-To: <20170225205242.18106-1-u.kleine-koenig@pengutronix.de> References: <20170225205242.18106-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/4] kwbimage_v1: add support to boot a mvebu image To: barebox@lists.infradead.org VGhpcyBqdXN0IHN0YXJ0cyB0aGUgbWFpbiBpbWFnZSBvZiB0aGUgbXZlYnUgaW1hZ2UgYXNzdW1p bmcgdGhhdCB0aGUKaGVhZGVyIGltYWdlcyBqdXN0IHNldHVwIHRoZSBSQU0uIFRoZSBwb3NpdGlv biBvZiB0aGUgaW50ZXJuYWwgcmVnaXN0ZXIKd2luZG93IGlzIHByb3ZpZGVkIGluIHRoZSBoZWFk ZXIgYXMgaW50cm9kdWNlZCBpbiB0aGUgcHJldmlvdXMgY29tbWl0LgoKU2lnbmVkLW9mZi1ieTog VXdlIEtsZWluZS1Lw7ZuaWcgPHUua2xlaW5lLWtvZW5pZ0BwZW5ndXRyb25peC5kZT4KLS0tCiBh cmNoL2FybS9tYWNoLW12ZWJ1L01ha2VmaWxlICAgICAgfCAgMSArCiBhcmNoL2FybS9tYWNoLW12 ZWJ1L2t3Ym9vdGltYWdlLmMgfCA4NCArKysrKysrKysrKysrKysrKysrKysrKysrKys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