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 1dwwwg-0000gP-Lq for barebox@lists.infradead.org; Tue, 26 Sep 2017 20:59:14 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Tue, 26 Sep 2017 22:58:42 +0200 Message-Id: <20170926205843.5910-2-u.kleine-koenig@pengutronix.de> In-Reply-To: <20170926205843.5910-1-u.kleine-koenig@pengutronix.de> References: <20170926205843.5910-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] state: new backend format "rawcompat" To: barebox@lists.infradead.org VGhpcyBpcyB0aGUgZm9ybWF0IHRoYXQgd2FzIGluaXRpYWxseSB1c2VkIGR1cmluZyBkZXZlbG9w bWVudCBvZiB0aGUKc3RhdGUgZnJhbWV3b3JrLiBTb21lIGVhcmx5IGFkb3B0ZXJzIHN0aWxsIHN0 aWNrIHRvIHRoaXMgb25lLgoKU2lnbmVkLW9mZi1ieTogVXdlIEtsZWluZS1Lw7ZuaWcgPHUua2xl aW5lLWtvZW5pZ0BwZW5ndXRyb25peC5kZT4KLS0tCiBjb21tb24vc3RhdGUvTWFrZWZpbGUgICAg ICAgICAgICAgICAgICAgfCAgIDEgKwogY29tbW9uL3N0YXRlL2JhY2tlbmRfZm9ybWF0X3Jhd2Nv bXBhdC5jIHwgMTQ1ICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrCiBjb21tb24vc3Rh dGUvc3RhdGUuYyAgICAgICAgICAgICAgICAgICAgfCAgIDMgKwogY29tbW9uL3N0YXRlL3N0YXRl LmggICAgICA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