From patchwork Wed Jun 18 21:35:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 4379521 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C6BF0BEEAA for ; Wed, 18 Jun 2014 21:37:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D2BD920306 for ; Wed, 18 Jun 2014 21:37:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA249202FE for ; Wed, 18 Jun 2014 21:37:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WxNW4-0001Gc-Gn; Wed, 18 Jun 2014 21:35:36 +0000 Received: from mail-qc0-f176.google.com ([209.85.216.176]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WxNW0-0001CL-FR for linux-arm-kernel@lists.infradead.org; Wed, 18 Jun 2014 21:35:33 +0000 Received: by mail-qc0-f176.google.com with SMTP id w7so1390915qcr.21 for ; Wed, 18 Jun 2014 14:35:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; bh=bB/7wCQh6fZcCwd9nGjMSf+fjyIz8h6UCZmojKO7sS4=; b=jL+A9OeYO6dpn/AdNNhD5jMJpXA9wj1UYOVEwDRDpLKToVeYDbExLFdVJrSsiVxncn ypeDzGQZn3XI6IcPfOkcYLIYFZTUREOqIpDHbxXPS616TWhvByN52dQHYfBuFz048tgg qJfKalGdZeJtpjv5s1tSA4LZ3CCtHEaAZ4yPCvVEciQ4nugJQrdeRvSSl78gjD/jOU34 r0mec9FY+dhfa2pFSTo6m/dyPte3KpOcc8hwsq9KXEvbPcIy92XyQzhTdIeW/0Ka/MzK QhEDnuLnLciCA16/TOTny7YrCG3ho74FAsSLwDxbq2zS65wU5Kv4Wt57g/wCjP6wGGdp PGgg== X-Gm-Message-State: ALoCoQn5Zl6l+TftioQbcrnyKuafokbMmEqVcajCAMPIRnvfsWjm+dSnnEmoGe2ucKtS8RQOVs9z X-Received: by 10.140.95.105 with SMTP id h96mr1369254qge.2.1403127310801; Wed, 18 Jun 2014 14:35:10 -0700 (PDT) Received: from xanadu.home (modemcable177.143-130-66.mc.videotron.ca. [66.130.143.177]) by mx.google.com with ESMTPSA id u1sm5149779qae.29.2014.06.18.14.35.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Jun 2014 14:35:09 -0700 (PDT) Date: Wed, 18 Jun 2014 17:35:08 -0400 (EDT) From: Nicolas Pitre To: Kevin Hilman Subject: Re: [PATCH] ARM: zImage: ensure header in LE format for BE8 kernels In-Reply-To: Message-ID: References: <1397147232-28516-1-git-send-email-taras.kondratiuk@linaro.org> <53A1D701.8060404@codeaurora.org> <53A1D8FE.6030404@codeaurora.org> User-Agent: Alpine 2.11 (LFD 23 2013-08-11) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140618_143532_612287_9D2F38B1 X-CRM114-Status: GOOD ( 22.21 ) X-Spam-Score: -0.7 (/) Cc: Thomas Petazzoni , Russell King , Jason Cooper , Victor Kamensky , Taras Kondratiuk , Stephen Boyd , LKML , Ben Dooks , Olof Johansson , Linaro Networking , linux-arm-kernel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 18 Jun 2014, Kevin Hilman wrote: > On Wed, Jun 18, 2014 at 11:22 AM, Stephen Boyd wrote: > > On 06/18/14 11:21, Kevin Hilman wrote: > >> On Wed, Jun 18, 2014 at 11:14 AM, Stephen Boyd wrote: > >>> On 06/18/14 10:55, Kevin Hilman wrote: > >>>> All of that to say, with this patch applied, I need a new (and > >>>> reliable) way to determine the endianness of a kernel just by looking > >>>> at the zImage. Recommendations welcome. > >>> Assuming that you have the .config configured to be built into the > >>> kernel you could use extract-ikconfig > >>> > >>> $ ./scripts/extract-ikconfig zImage | grep CONFIG_CPU_ENDIAN_BE8 > >> Unfortunately, I can't rely on having that built in since I want the > >> boot tools to be as generic as possible. > >> > >> > > > > Yeah ok. Perhaps you can look for the 'setend be' instruction right > > after the magic values instead. > > Yeah, that works, as long as I can always assume that instruction will > be at the same offset (currently at 0x30). Well... then you also have to test for the Thumb2 variant. And that forces this instruction to always be there. If we're to "officialize" this, I'd much prefer we add another magic value like this: > > Kevin > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index c95feab6ce..413fd94b53 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -128,6 +128,7 @@ start: .word _magic_sig @ Magic numbers to help the loader .word _magic_start @ absolute load/run zImage address .word _magic_end @ zImage end address + .word 0x04030201 @ endianness flag THUMB( .thumb ) 1: