From patchwork Thu Jun 8 08:18:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Lothar_Wa=C3=9Fmann?= X-Patchwork-Id: 772910 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wjyxB1Y5Pz9s81 for ; Thu, 8 Jun 2017 18:18:38 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CB970C21D87; Thu, 8 Jun 2017 08:18:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 996F9C21C5F; Thu, 8 Jun 2017 08:18:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E1601C21C5F; Thu, 8 Jun 2017 08:18:32 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.109]) by lists.denx.de (Postfix) with ESMTPS id 7AD31C21C26 for ; Thu, 8 Jun 2017 08:18:32 +0000 (UTC) Received: from [89.1.81.74] (helo=ipc1.ka-ro) by smtprelay08.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) (envelope-from ) id 1dIseF-0000y8-GW; Thu, 08 Jun 2017 10:18:31 +0200 Received: from lothar by ipc1.ka-ro with local (Exim 4.84_2 #2 (Debian)) id 1dIseF-00077I-5H; Thu, 08 Jun 2017 10:18:31 +0200 From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= To: Bin Meng , Chris Zankel , Simon Glass , Stefan Roese , York Sun , "mario.six@gdsys.cc" , u-boot@lists.denx.de, Vladimir Zapolskiy Date: Thu, 8 Jun 2017 10:18:25 +0200 Message-Id: <1496909905-27310-1-git-send-email-LW@KARO-electronics.de> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-Df-Sender: bHdAa2Fyby1lbGVjdHJvbmljcy5kZQ== Subject: [U-Boot] [PATCH] board_f: fix calculation of reloc_off X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" relocate_code() calculates the relocation offset wrt. the symbol __image_copy_start which happens to have the same value as CONFIG_TEXT_BASE on most systems. When creating an i.MX boot image with an integrated IVT it is convenient to have CONFIG_TEXT_BASE point to the start of the IVT that is prepended to the actual code. Thus CONFIG_TEXT_BASE will differ from __image_copy_start, while the calculation 'gd->relocaddr - __image_copy_start' still gives the right relocation offset. Signed-off-by: Lothar Waßmann Reviewed-by: Tom Rini --- common/board_f.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index d9431ee..e71a38e 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -610,13 +610,16 @@ static int setup_reloc(void) } #ifdef CONFIG_SYS_TEXT_BASE - gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE; -#ifdef CONFIG_M68K +#ifdef ARM + gd->reloc_off = gd->relocaddr - (unsigned long)__image_copy_start; +#elif defined(CONFIG_M68K) /* * On all ColdFire arch cpu, monitor code starts always * just after the default vector table location, so at 0x400 */ gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400); +#else + gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE; #endif #endif memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));