From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Scjt8-0006ZD-SN for barebox@lists.infradead.org; Thu, 07 Jun 2012 21:05:05 +0000 From: Sascha Hauer Date: Thu, 7 Jun 2012 23:04:58 +0200 Message-Id: <1339103098-32102-5-git-send-email-s.hauer@pengutronix.de> In-Reply-To: <1339103098-32102-1-git-send-email-s.hauer@pengutronix.de> References: <1339103098-32102-1-git-send-email-s.hauer@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-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: =?UTF-8?q?=5BPATCH=204/4=5D=20ARM=20mxs=3A=20add=20bcb=20command=20to=20create=20=27boot=20control=20block=27=20for=20NAND=20boot?= To: barebox@lists.infradead.org Cc: wsa@pengutronix.de, Wolfram Sang RnJvbTogV29sZnJhbSBTYW5nIDx3LnNhbmdAcGVuZ3V0cm9uaXguZGU+CgpXZSB3cml0ZSBhIHBy b3BlciBGQ0IsIGJ1dCBubyBEQkJUIHNpbmNlIGl0IGlzIHVucmVzb2x2ZWQgaG93IHRvIGtlZXAg aXQKaW4gc3luYyB3aXRoIExpbnV4LWJhc2VkIEJCVHMuIEFsc28sIHdlIGltcGx5IHNlYXJjaGNv dW50ID0gNCBhbmQgc3RyaWRlCj0gNjQgKHdoaWNoIGlzIHRoZSBkZWZhdWx0KSB1bnRpbCB3ZSBj YW4gdmVyaWZ5IHZpYSBvY290cC4KClNpZ25lZC1vZmYtYnk6IFdvbGZyYW0gU2FuZyA8dy5zYW5n QHBlbmd1dHJvbml4LmRlPgotLS0KIGFyY2gvYXJtL21hY2gtbXhzL0tjb25maWcgIHwgIC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