From patchwork Tue Oct 28 09:36:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roese X-Patchwork-Id: 404134 X-Patchwork-Delegate: sr@denx.de 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 688CB14003E for ; Tue, 28 Oct 2014 20:36:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 88D23A7480; Tue, 28 Oct 2014 10:36:45 +0100 (CET) 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 V7T5Db4qmqzI; Tue, 28 Oct 2014 10:36:45 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CC764A748D; Tue, 28 Oct 2014 10:36:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 89F6CA73EA for ; Tue, 28 Oct 2014 10:36:16 +0100 (CET) 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 sD+RlPzu-jXD for ; Tue, 28 Oct 2014 10:36:16 +0100 (CET) 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 mo4-p04-ob.smtp.rzone.de (mo4-p04-ob.smtp.rzone.de [81.169.146.223]) by theia.denx.de (Postfix) with ESMTPS id 4D8BCA7404 for ; Tue, 28 Oct 2014 10:36:12 +0100 (CET) X-RZG-CLASS-ID: mo04 X-RZG-AUTH: :IW0NeWC7b/q2i6W/qstXb1SBUuFnrGohfvxEndrDXKjzPMsB3oimjD61I4fPQhgcxm53 Received: from stefan-work.domain_not_set.invalid (b9168f0d.cgn.dg-w.de [185.22.143.13]) by post.strato.de (RZmta 35.10 SBL|AUTH) with ESMTPA id 207132q9S9a9agm; Tue, 28 Oct 2014 10:36:09 +0100 (CET) From: Stefan Roese To: u-boot@lists.denx.de Date: Tue, 28 Oct 2014 10:36:04 +0100 Message-Id: <1414488968-12744-6-git-send-email-sr@denx.de> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1414488968-12744-1-git-send-email-sr@denx.de> References: <1414488968-12744-1-git-send-email-sr@denx.de> Cc: Yehuda Yitschak , Tawfik Bayouk , Eran Ben-Avi Subject: [U-Boot] [PATCH v1 5/9] tools: kwbimage: Support u-boot.img padding to CONFIG_SYS_SPI_U_BOOT_OFFS X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This is used on the AXP boards, to pad u-boot.img to the desired offset in SPI flash (only this boot target supported right now). This offset is used by the SPL then to load u-boot.img into SDRAM and execute it there. Signed-off-by: Stefan Roese --- tools/kwbimage.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/kwbimage.c b/tools/kwbimage.c index 1120e9b..9f37a36 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -15,6 +15,7 @@ #include #include #include "kwbimage.h" +#include #define ALIGN_SUP(x, a) (((x) + (a - 1)) & ~(a - 1)) @@ -845,6 +846,16 @@ static int kwbimage_generate(struct image_tool_params *params, sizeof(struct ext_hdr_v0); } else { alloc_len = image_headersz_v1(params, NULL); +#if defined(CONFIG_SYS_SPI_U_BOOT_OFFS) + if (alloc_len > CONFIG_SYS_SPI_U_BOOT_OFFS) { + fprintf(stderr, "Error: Image header (incl. SPL image) too big!\n"); + fprintf(stderr, "header=0x%x CONFIG_SYS_SPI_U_BOOT_OFFS=0x%x!\n", + alloc_len, CONFIG_SYS_SPI_U_BOOT_OFFS); + fprintf(stderr, "Increase CONFIG_SYS_SPI_U_BOOT_OFFS!\n"); + } else { + alloc_len = CONFIG_SYS_SPI_U_BOOT_OFFS; + } +#endif } hdr = malloc(alloc_len);