From patchwork Wed Dec 17 06:22:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yong X-Patchwork-Id: 42371 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 21D8626C90 for ; Wed, 17 Dec 2014 06:26:49 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf5852880wiv.5 for ; Tue, 16 Dec 2014 22:26:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=R648I/xUh8e+1Jt+XPITWQIYIIQZpluK+laf5J+OZJg=; b=cfv/aikMcjOAYmGncK/GEuKBjL3gfvH7zWNbJiZjXey85hifSpOTZRLAmYpP8fgSzV Q1q8fF6ev7n3RK5VqAAaHiiu8CG0LR7h/pl/jahIN2dkg6/szYN9TAkmu8I5hQkKFd5a sD0aoWENDJ65Koi8xkqBGKUKpiXH2MUP8hLp812xudMWnHaxtfLejNcUxJbBFPbyd6FI NwPhtjaJiO7o4/IMXDK/kQA/QUHMjZFhvlUZ290EtQgWQCNjxpJkF96JA1xnEWtezLFm Sb+StfPSoSFg3plhjtev6rQ8kO2xt0xy+VRzvZw7WbLuE9lJEUZW5hgph6rMK86iM5u3 JwWg== X-Gm-Message-State: ALoCoQlzeYc55jKuRK4YaV3ResQW1cpYsevqMo0ZLKldGTqsM70BpqyMWDG3BmnNQ4YLBZjsdm+e X-Received: by 10.180.99.227 with SMTP id et3mr1044521wib.3.1418797608382; Tue, 16 Dec 2014 22:26:48 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.37 with SMTP id g5ls965331lah.102.gmail; Tue, 16 Dec 2014 22:26:48 -0800 (PST) X-Received: by 10.112.167.200 with SMTP id zq8mr39540991lbb.61.1418797608259; Tue, 16 Dec 2014 22:26:48 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id l5si2810175lbs.94.2014.12.16.22.26.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 22:26:48 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id pn19so12578871lab.37 for ; Tue, 16 Dec 2014 22:26:48 -0800 (PST) X-Received: by 10.112.14.6 with SMTP id l6mr16679454lbc.91.1418797608164; Tue, 16 Dec 2014 22:26:48 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1261847lbb; Tue, 16 Dec 2014 22:26:47 -0800 (PST) X-Received: by 10.68.65.16 with SMTP id t16mr67023218pbs.70.1418797586264; Tue, 16 Dec 2014 22:26:26 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jv1si4011312pbc.205.2014.12.16.22.26.25; Tue, 16 Dec 2014 22:26:26 -0800 (PST) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751672AbaLQG0V (ORCPT + 1 other); Wed, 17 Dec 2014 01:26:21 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:1274 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751777AbaLQG0T (ORCPT ); Wed, 17 Dec 2014 01:26:19 -0500 Received: from 172.24.2.119 (EHLO szxeml421-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AYU15661; Wed, 17 Dec 2014 14:26:15 +0800 (CST) Received: from linux-4hy3.site (10.107.197.200) by szxeml421-hub.china.huawei.com (10.82.67.160) with Microsoft SMTP Server id 14.3.158.1; Wed, 17 Dec 2014 14:26:06 +0800 From: Sheng Yong To: CC: , Subject: [PATCH 16/16] ARM: 8079/1: zImage: identify kernel endianness Date: Wed, 17 Dec 2014 06:22:59 +0000 Message-ID: <1418797379-107848-17-git-send-email-shengyong1@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1418797379-107848-1-git-send-email-shengyong1@huawei.com> References: <1418797379-107848-1-git-send-email-shengyong1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.197.200] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.54912211.002B, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 78212d5f453f21b33fb9abf08c63b776 Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Nicolas Pitre commit 9696fcae9251610f5935a3823be40d1365649720 upstream With patch #8067/1 ("zImage: ensure header in LE format for BE8 kernels") applied, it is no longer possible to determine the endianness of a compiled kernel image. This normally shouldn't matter to the boot environment, except for those cases where the selection of a ramdisk or root filesystem with a matching endianness has to be automated. Let's add a flag to the zImage header indicating the actual endianness. Four bytes from offset 0x30 can be interpreted as follows: 04 03 02 01 big endian kernel 01 02 03 04 little endian kernel Anything else should be interpreted as "unknown", in which case it is most likely that patch #8067/1 was not applied either and the zImage magic number at offset 0x24 could be used instead to determine endianness. No zImage before this patch ever produced 0x01020304 nor 0x04030201 at offset 0x30 so there is no confusion possible. Signed-off-by: Nicolas Pitre Acked-by: Kevin Hilman Signed-off-by: Russell King --- arch/arm/boot/compressed/head.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index ac7ff2a..d087554 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -133,6 +133,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: