From patchwork Tue Mar 31 09:40:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 456555 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 69EC114007D for ; Tue, 31 Mar 2015 20:42:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 47CD3B37C7; Tue, 31 Mar 2015 11:42:19 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5K7YLaybv0wj; Tue, 31 Mar 2015 11:42:19 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 38BBAB37C5; Tue, 31 Mar 2015 11:41:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 687A04A04E for ; Tue, 31 Mar 2015 11:41:33 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XKmb3zS5FCAz for ; Tue, 31 Mar 2015 11:41:33 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by theia.denx.de (Postfix) with ESMTPS id 2EF2C4A047 for ; Tue, 31 Mar 2015 11:41:33 +0200 (CEST) Received: from localhost.localdomain (unknown [IPv6:2001:470:1f13:25f:8d19:7a28:f95e:c17a]) (Authenticated sender: aribaud.smtp) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 6CAB1D48044; Tue, 31 Mar 2015 11:39:42 +0200 (CEST) From: "Albert ARIBAUD (3ADEV)" To: u-boot@lists.denx.de Date: Tue, 31 Mar 2015 11:40:50 +0200 Message-Id: <1427794851-3461-9-git-send-email-albert.aribaud@3adev.fr> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427794851-3461-8-git-send-email-albert.aribaud@3adev.fr> References: <1427794851-3461-1-git-send-email-albert.aribaud@3adev.fr> <1427794851-3461-2-git-send-email-albert.aribaud@3adev.fr> <1427794851-3461-3-git-send-email-albert.aribaud@3adev.fr> <1427794851-3461-4-git-send-email-albert.aribaud@3adev.fr> <1427794851-3461-5-git-send-email-albert.aribaud@3adev.fr> <1427794851-3461-6-git-send-email-albert.aribaud@3adev.fr> <1427794851-3461-7-git-send-email-albert.aribaud@3adev.fr> <1427794851-3461-8-git-send-email-albert.aribaud@3adev.fr> Cc: "Albert ARIBAUD \(3ADEV\)" Subject: [U-Boot] [PATCH v7 8/9] Introduce CONFIG_SPL_PANIC_ON_RAW_IMAGE X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" introduce CONFIG_SPL_PANIC_ON_RAW_IMAGE. An SPL which define this will panic() if the image it has loaded does not have a mkimage signature. Signed-off-by: Albert ARIBAUD (3ADEV) --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None README | 10 ++++++++++ common/spl/spl.c | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/README b/README index 5d57eb9..204f2c3 100644 --- a/README +++ b/README @@ -3610,6 +3610,16 @@ FIT uImage format: CONFIG_SPL_STACK Adress of the start of the stack SPL will use + CONFIG_SPL_PANIC_ON_RAW_IMAGE + When defined, SPL will panic() if the image it has + loaded does not have a signature. + Defining this is useful when code which loads images + in SPL cannot guarantee that absolutely all read errors + will be caught. + An example is the LPC32XX MLC NAND driver, which will + consider that a completely unreadable NAND block is bad, + and thus should be skipped silently. + CONFIG_SPL_RELOC_STACK Adress of the start of the stack SPL will use after relocation. If unspecified, this is equal to diff --git a/common/spl/spl.c b/common/spl/spl.c index cd75bbc..8e1fb40 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -101,10 +101,22 @@ void spl_parse_image_header(const struct image_header *header) (int)sizeof(spl_image.name), spl_image.name, spl_image.load_addr, spl_image.size); } else { +#ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE + /* + * CONFIG_SPL_PANIC_ON_RAW_IMAGE is defined when the + * code which loads images in SPL cannot guarantee that + * absolutely all read errors will be reported. + * An example is the LPC32XX MLC NAND driver, which + * will consider that a completely unreadable NAND block + * is bad, and thus should be skipped silently. + */ + panic("** no mkimage signature but raw image not supported"); +#else /* Signature not found - assume u-boot.bin */ debug("mkimage signature not found - ih_magic = %x\n", header->ih_magic); spl_set_header_raw_uboot(); +#endif } }