From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from inx.pm.waw.pl ([195.116.170.130]) by bombadil.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SQmrO-0005rB-Sq for barebox@lists.infradead.org; Sat, 05 May 2012 21:49:51 +0000 From: Krzysztof Halasa Date: Sat, 05 May 2012 23:46:26 +0200 Message-ID: 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-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] ARM: Changes to bootz. To: barebox@lists.infradead.org Rml4ZWQgYm9vdHogY29tbWFuZCB0byBhbHdheXMgY2hlY2sgaWYgdGhlIHpJbWFnZSBmaXRzIGNv bXBsZXRlbHkKaW4gdGhlIGZpcnN0IDEyOCBNQiBvZiBSQU0uCkFsbG93cyBvcGVyYXRpb24gd2l0 aCBtb3JlIHRoYW4gMTI4IE1CIFJBTS4KV2UgZG9uJ3QgdHJ5IHRvIGZyZWUoKSBtZW1tYXBwZWQg ekltYWdlIGFueW1vcmUuCkVuZGlhbm5lc3Mgc3dhcHBpbmcgaXMgbm93IHBvc3NpYmxlIHdpdGgg bWVtbWFwcGFibGUgekltYWdlLCB0b28uCgpTaWduZWQtb2ZmLWJ5OiBLcnp5c3p0b2YgSGHFgmFz YSA8a2hjQHBtLndhdy5wbD4KCmRpZmYgLS1naXQgYS9hcmNoL2FybS9saWIvYm9vdHouYyBiL2Fy Y2gvYXJtL2xpYi9ib290ei5jCmluZGV4IGYzOTRhNmIuLmMxMWY0M2EgMTAwNjQ0Ci0tLSBhL2Fy Y2gvYXJtL2xpYi9ib290ei5jCisrKyBiL2FyY2gvYXJtL2xpYi9ib290ei5jCkBAIC0yMSwxNCAr MjEsMjAgQEAgc3RydWN0IHppbWFnZV9oZWFkZXIgewogCiAjZGVmaW5lIF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