From patchwork Thu Mar 19 09:02:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B6rg_Krause?= X-Patchwork-Id: 451787 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 1423214010F for ; Thu, 19 Mar 2015 20:03:20 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 451B492109; Thu, 19 Mar 2015 09:03:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lZSMrPDxmKRx; Thu, 19 Mar 2015 09:03:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 9F1A3920F5; Thu, 19 Mar 2015 09:03:16 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 70BAB1C2805 for ; Thu, 19 Mar 2015 09:03:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6CC21320EE for ; Thu, 19 Mar 2015 09:03:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P6+1SycAUIHo for ; Thu, 19 Mar 2015 09:03:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx02.posteo.de (mx02.posteo.de [89.146.194.165]) by silver.osuosl.org (Postfix) with ESMTPS id D2F5831399 for ; Thu, 19 Mar 2015 09:03:13 +0000 (UTC) Received: from dovecot03.posteo.de (unknown [185.67.36.28]) by mx02.posteo.de (Postfix) with ESMTPS id 08BE11EB2F84; Thu, 19 Mar 2015 10:03:10 +0100 (CET) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3l72ML0zn8z5vNC; Thu, 19 Mar 2015 10:03:10 +0100 (CET) Received: from nzxt.fritz.box (nzxt.localdomain [192.168.178.46]) (Authenticated sender: joerg.krause@embedded.rocks) by embedded.rocks (Postfix) with ESMTPSA id 8BBD998043A; Thu, 19 Mar 2015 10:03:09 +0100 (CET) From: =?UTF-8?q?J=C3=B6rg=20Krause?= To: buildroot@buildroot.org Date: Thu, 19 Mar 2015 10:02:56 +0100 Message-Id: <1426755776-25244-1-git-send-email-joerg.krause@embedded.rocks> X-Mailer: git-send-email 2.3.3 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] boot/uboot: add support for i.MX28 NAND format X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Allow to generate 'u-boot.nand', Freescale i.MX28 SB format with a header for booting from NAND flash. There are two possibilities when preparing an image writable to NAND flash: 1) The NAND was not written at all yet or the BCB (Boot Control Blocks) is broken. In this case, the NAND image 'u-boot.nand' needs to written. 2) The NAND flash was already written with a good BCB. This applies after 'u-boot.nand' was correctly written. There is no need to write the BCB again. In this case, the bootloader can be upgraded by writing 'u-boot.sb'. To satisfy both cases 'u-boot.nand' as well as the make target 'u-boot.sb' are copied to the binaries directory. mxsboot for NAND images needs all three parameters typed in as integer values (hex values do not work). The default values choosen are typical sizes for a NAND flash. For more information see: http://www.denx-cs.de/doku/?q=m28evkrunuboot This patch is motivated by "[PATCH 1/2] boot/uboot: add support for i.MX28 SD format" http://patchwork.ozlabs.org/patch/451565/ Signed-off-by: Jörg Krause --- boot/uboot/Config.in | 43 +++++++++++++++++++++++++++++++++++++++++++ boot/uboot/uboot.mk | 11 +++++++++++ 2 files changed, 54 insertions(+) diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in index 03e6acc..aaf9dc6 100644 --- a/boot/uboot/Config.in +++ b/boot/uboot/Config.in @@ -117,6 +117,49 @@ config BR2_TARGET_UBOOT_FORMAT_SB depends on BR2_arm bool "u-boot.sb" +config BR2_TARGET_UBOOT_FORMAT_NAND + depends on BR2_arm + bool "u-boot.nand" + help + This is Freescale i.MX28 SB format, with a header for booting from an + NAND flash. + + U-boot includes an mxsboot tool to generate this format, starting + from v2011.12. + + See doc/README.mxs. + +if BR2_TARGET_UBOOT_FORMAT_NAND + +config BR2_TARGET_UBOOT_FORMAT_NAND_PAGE_SIZE + int "NAND page size" + default 2048 + help + The NAND page size of the targets NAND flash in bytes and as an + integer value. + + The value provided here is passed to the -w option of mxsboot. + +config BR2_TARGET_UBOOT_FORMAT_NAND_OOB_SIZE + int "NAND OOB size" + default 64 + help + The NAND OOB size of the targets NAND flash in bytes and as an + integer value. + + The value provided here is passed to the -o option of mxsboot. + +config BR2_TARGET_UBOOT_FORMAT_NAND_ERASE_SIZE + int "NAND erase size" + default 131072 + help + The NAND erase size of the targets NAND flash in bytes and as an + integer value. + + The value provided here is passed to the -e option of mxsboot. + +endif + config BR2_TARGET_UBOOT_FORMAT_CUSTOM bool "Custom (specify below)" help diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk index a9ba054..15c5a84 100644 --- a/boot/uboot/uboot.mk +++ b/boot/uboot/uboot.mk @@ -49,6 +49,9 @@ else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y) UBOOT_BIN = u-boot.sb UBOOT_MAKE_TARGET = $(UBOOT_BIN) UBOOT_DEPENDENCIES += host-elftosb +else ifeq ($(BR2_TARGET_UBOOT_FORMAT_NAND),y) +UBOOT_BIN = u-boot.nand +UBOOT_MAKE_TARGET = u-boot.sb else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y) UBOOT_BIN = $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME)) else @@ -116,6 +119,12 @@ define UBOOT_BUILD_CMDS $(TARGET_CONFIGURE_OPTS) \ $(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \ $(UBOOT_MAKE_TARGET) + $(if $(BR2_TARGET_UBOOT_FORMAT_NAND), + $(@D)/tools/mxsboot \ + -w $(BR2_TARGET_UBOOT_FORMAT_NAND_PAGE_SIZE) \ + -o $(BR2_TARGET_UBOOT_FORMAT_NAND_OOB_SIZE) \ + -e $(BR2_TARGET_UBOOT_FORMAT_NAND_ERASE_SIZE) \ + nand $(@D)/u-boot.sb $(@D)/u-boot.nand) endef define UBOOT_BUILD_OMAP_IFT @@ -125,6 +134,8 @@ endef define UBOOT_INSTALL_IMAGES_CMDS cp -dpf $(@D)/$(UBOOT_BIN) $(BINARIES_DIR)/ + $(if $(BR2_TARGET_UBOOT_FORMAT_NAND), + cp -dpf $(@D)/$(UBOOT_MAKE_TARGET) $(BINARIES_DIR)) $(if $(BR2_TARGET_UBOOT_SPL), cp -dpf $(@D)/$(call qstrip,$(BR2_TARGET_UBOOT_SPL_NAME)) $(BINARIES_DIR)/) $(if $(BR2_TARGET_UBOOT_ENVIMAGE),