From patchwork Fri Sep 30 19:53:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 117197 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 46A0FB6F6F for ; Sat, 1 Oct 2011 05:53:24 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8F401286AE; Fri, 30 Sep 2011 21:53:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 nvx209WPWJqE; Fri, 30 Sep 2011 21:53:21 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 58B682868C; Fri, 30 Sep 2011 21:53:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 68F8028695 for ; Fri, 30 Sep 2011 21:53:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 0QTUZp6GsypG for ; Fri, 30 Sep 2011 21:53:16 +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 avon.wwwdotorg.org (avon.wwwdotorg.org [70.85.31.133]) by theia.denx.de (Postfix) with ESMTPS id 2936B28679 for ; Fri, 30 Sep 2011 21:53:14 +0200 (CEST) Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id CE14C62E0; Fri, 30 Sep 2011 13:53:13 -0600 (MDT) Received: from localhost.localdomain (searspoint.nvidia.com [216.228.112.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id BAC04E4100; Fri, 30 Sep 2011 13:53:12 -0600 (MDT) From: Stephen Warren To: U-Boot Mailing List Date: Fri, 30 Sep 2011 13:53:02 -0600 Message-Id: <1317412383-7731-1-git-send-email-swarren@nvidia.com> X-Mailer: git-send-email 1.7.0.4 X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean Cc: Tom Warren Subject: [U-Boot] [PATCH 1/2] image: Support relative-addresses property in FIT images X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 uImage files contain absolute "load" and "entry" addresses. Such a concept is incompatible with using the same kernel image on multiple SoCs, each with a potentially different SDRAM base. To support that, augment the FIT image syntax with a "relative-addresses" property, which indicates that the "load" and "entry" properties are an offset from SDRAM, rather than an absolute address. In theory, a similar change could be made to the legacy uImage format. However, representing the a "relative-addresses" flag in that format is problematic, so I have ignored that possibility for now. Signed-off-by: Stephen Warren --- common/image.c | 14 ++++++++++++++ doc/uImage.FIT/source_file_format.txt | 3 +++ include/image.h | 1 + 3 files changed, 18 insertions(+), 0 deletions(-) diff --git a/common/image.c b/common/image.c index d38ce4a..e62fc76 100644 --- a/common/image.c +++ b/common/image.c @@ -2299,6 +2299,13 @@ int fit_image_get_load (const void *fit, int noffset, ulong *load) } *load = uimage_to_cpu (*data); + +#ifndef USE_HOSTCC + data = fdt_getprop(fit, noffset, FIT_REL_ADDRS_PROP, &len); + if (data != NULL) + *load += getenv_bootm_low(); +#endif + return 0; } @@ -2327,6 +2334,13 @@ int fit_image_get_entry (const void *fit, int noffset, ulong *entry) } *entry = uimage_to_cpu (*data); + +#ifndef USE_HOSTCC + data = fdt_getprop(fit, noffset, FIT_REL_ADDRS_PROP, &len); + if (data != NULL) + *entry += getenv_bootm_low(); +#endif + return 0; } diff --git a/doc/uImage.FIT/source_file_format.txt b/doc/uImage.FIT/source_file_format.txt index 6d20707..c2ae67e 100644 --- a/doc/uImage.FIT/source_file_format.txt +++ b/doc/uImage.FIT/source_file_format.txt @@ -183,6 +183,9 @@ the '/images' node should have the following layout: Optional nodes: - hash@1 : Each hash sub-node represents separate hash or checksum calculated for node's data according to specified algorithm. + - relative-addresses : Indicates the the values of the load and entry + properties are to be interpreted as relative to the base of SDRAM, rather + than as an absolute values. 5) Hash nodes diff --git a/include/image.h b/include/image.h index 352e4a0..aefba5d 100644 --- a/include/image.h +++ b/include/image.h @@ -538,6 +538,7 @@ static inline int image_check_target_arch (const image_header_t *hdr) #define FIT_COMP_PROP "compression" #define FIT_ENTRY_PROP "entry" #define FIT_LOAD_PROP "load" +#define FIT_REL_ADDRS_PROP "relative-addresses" /* configuration node */ #define FIT_KERNEL_PROP "kernel"