From patchwork Thu Jun 16 14:14:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 100648 X-Patchwork-Delegate: jwboyer@gmail.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 6301AB82C1 for ; Fri, 17 Jun 2011 00:15:24 +1000 (EST) Received: by ozlabs.org (Postfix) id 5D793B74B1; Fri, 17 Jun 2011 00:14:44 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from mail-fx0-f42.google.com (mail-fx0-f42.google.com [209.85.161.42]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 95D9FB7049 for ; Fri, 17 Jun 2011 00:14:42 +1000 (EST) Received: by mail-fx0-f42.google.com with SMTP id 1so1329329fxm.15 for ; Thu, 16 Jun 2011 07:14:42 -0700 (PDT) Received: by 10.223.21.7 with SMTP id h7mr1175014fab.72.1308233682646; Thu, 16 Jun 2011 07:14:42 -0700 (PDT) Received: from localhost ([178.23.216.97]) by mx.google.com with ESMTPS id q14sm844409faa.27.2011.06.16.07.14.41 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 16 Jun 2011 07:14:41 -0700 (PDT) From: Michal Simek To: linuxppc-dev@ozlabs.org Subject: [RFC PATCH 5/7] powerpc: Consider a non-zero boot address when computing the bootwrapper start Date: Thu, 16 Jun 2011 16:14:26 +0200 Message-Id: <1308233668-24166-6-git-send-email-monstr@monstr.eu> X-Mailer: git-send-email 1.5.5.1 In-Reply-To: <1308233668-24166-5-git-send-email-monstr@monstr.eu> References: <1308233668-24166-1-git-send-email-monstr@monstr.eu> <1308233668-24166-2-git-send-email-monstr@monstr.eu> <1308233668-24166-3-git-send-email-monstr@monstr.eu> <1308233668-24166-4-git-send-email-monstr@monstr.eu> <1308233668-24166-5-git-send-email-monstr@monstr.eu> Cc: arnd@arndb.de, tmarri@apm.com, suzuki@in.ibm.com, john.williams@petalogix.com X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org From: John Williams There's no fundamental reason the bootwrapper can't boot off a non-zero base, we just need to make sure we account for it in the link. Do this by adding the (up-aligned) kernel size to membase, and using that as the link address. Signed-off-by: John Williams --- arch/powerpc/boot/wrapper | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper index e148053..594aa02 100755 --- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper @@ -139,9 +139,16 @@ tmp=$tmpdir/zImage.$$.o ksection=.kernel:vmlinux.strip isection=.kernel:initrd -# default auto-calculate link_address to make room for the kernel +# physical offset of kernel image +membase=`${CROSS}objdump -p "$kernel" | grep -m 1 LOAD | awk '{print $7}'` + +# auto-calculate link_address to make room for the kernel # round up kernel image size to nearest megabyte -link_address=`${CROSS}size -x ${kernel} | grep ${kernel} | awk '{printf("0x%08x", and($4 + 0x0fffff, 0xfffe0000))}'` + +# don't forget to add membase for non-zero kernel boot +membase_dec=`printf "%d" $membase` + +link_address=`${CROSS}size -x ${kernel} | grep ${kernel} | awk -v membase=$membase_dec '{printf("0x%08x", membase + and($4 + 0x0fffff, 0xfffe0000))}'` case "$platform" in pseries) @@ -259,9 +266,6 @@ if [ -n "$version" ]; then uboot_version="-n Linux-$version" fi -# physical offset of kernel image -membase=`${CROSS}objdump -p "$kernel" | grep -m 1 LOAD | awk '{print $7}'` - case "$platform" in uboot) rm -f "$ofile"