From patchwork Tue Jan 26 12:10:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Shimizu X-Patchwork-Id: 8120831 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AB502BEEE5 for ; Tue, 26 Jan 2016 12:11:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD9472026C for ; Tue, 26 Jan 2016 12:11:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B266D201BC for ; Tue, 26 Jan 2016 12:11:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965212AbcAZMLK (ORCPT ); Tue, 26 Jan 2016 07:11:10 -0500 Received: from mail-pf0-f171.google.com ([209.85.192.171]:36829 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965188AbcAZMLI (ORCPT ); Tue, 26 Jan 2016 07:11:08 -0500 Received: by mail-pf0-f171.google.com with SMTP id n128so98299803pfn.3 for ; Tue, 26 Jan 2016 04:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=UHE1aofdeLf4AkZIH44rpkyd0naMLP4rE+MXr+7PWzE=; b=KIAm5aDLZ2NTg98L+d4VoKjCzeJClQN4KpYdP+uf7CHx2M1SmJk5tdyCiuaTyI/9vY zBMRaN9Ts4j4P+b6WAIY6BnSMnd8qxc0zWCz26AfBraOobt5CQ6Ge5F7/4CKOeGimD7L AER7c4rCTBbJ1+WMjXaxS58Vk8zBx9IyZs3iEKNQ92xWoVsn3VRymxB6oqUli84wse/R G8e3BdaG6O+FGn3obRmQZ75OyA63rfI0YleOA+4Mc3cY3PtveflVoJHIJbu8lCLgUNhu U7enCL803cqdoSgt2aDCdga57g1OeXyMvVduqNgDQLzXtXY9GskjDU0gaOKO0MZizmWo Gj5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=UHE1aofdeLf4AkZIH44rpkyd0naMLP4rE+MXr+7PWzE=; b=SLt/gmhedl8+lqMJyZ8BVcBJENFFtaaL6O4jkx9HuIXuYv/3bX9UlRTaUtJeqI9D6+ xXxj+jMa8r/I66LUsNaIEG1W3cNZc2VmbaKrH/oN4jPJ+BCJk6gtsDADdHSQLkzJh9uq mJt2jeT1VV8YaBEYxwiYSOheaXsDSjqgKcMOkli2noxNeOWb+9PKxD7m1mt5VlDgrQ7f SoLAsdYrV2LG6q9bQ1B4mnDR164cbPK41ypeEqF2xWew6HW59qKArUuPQqpoaprnSp4A A9u5zqTbNHx5fzH1E9VOkMcRKlhpXigL/h4d8FcX7/MKYFSr4R98puhJ+0FqHBVE5UPb bRYQ== X-Gm-Message-State: AG10YOR5avgaC8GtGQ0zlmxZE4X9hbgDqSeITAqCbQTo0x7gyK65B72UjM2eTSrxGzuGpQ== X-Received: by 10.98.2.216 with SMTP id 207mr33292865pfc.3.1453810267958; Tue, 26 Jan 2016 04:11:07 -0800 (PST) Received: from FlatStation.localet.com. (ai126173007219.46.access-internet.ne.jp. [126.173.7.219]) by smtp.gmail.com with ESMTPSA id q89sm1588143pfa.70.2016.01.26.04.11.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Jan 2016 04:11:07 -0800 (PST) From: Roger Shimizu To: Michal Marek , Russell King Cc: Roger Shimizu , linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org Subject: [RFC] scripts: make extract-vmlinux support ARM vmlinuz Date: Tue, 26 Jan 2016 21:10:36 +0900 Message-Id: <1453810236-2082-1-git-send-email-rogershimizu@gmail.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 vmlinuz on ARM seems is not an ELF, so scripts/extract-vmlinux need to support such case. This fix is tested on amd64 and armel platform. Signed-off-by: Roger Shimizu --- Dear Michal and Russell, I'm studying ARM booting process, and happened to find scripts/extract-vmlinux in kernel tree is broken on ARM for long time. [0][1] [0]: https://bugs.launchpad.net/linaro-ubuntu/+bug/1050453 [1]: https://bugs.linaro.org/show_bug.cgi?id=461 The patch I created looks like dirty hack, and I don't know the status of whether vmlinuz is ELF or not on other platforms, so I make this as "RFC". Please comment. Thank you! Cheers, Roger scripts/extract-vmlinux | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/extract-vmlinux b/scripts/extract-vmlinux index 5061abcc2540..d569eb8c8efe 100755 --- a/scripts/extract-vmlinux +++ b/scripts/extract-vmlinux @@ -15,7 +15,15 @@ check_vmlinux() # Use readelf to check if it's a valid ELF # TODO: find a better to way to check that it's really vmlinux # and not just an elf - readelf -h $1 > /dev/null 2>&1 || return 1 + case "$2" in + 0|"") + readelf -h $1 > /dev/null 2>&1 || return 1 + ;; + 1|*) + # For ARCH like ARM, vmlinux is not ELF, so we only do the check + # when $2 is 0 or NULL + ;; + esac cat $1 exit 0 @@ -31,7 +39,7 @@ try_decompress() do pos=${pos%%:*} tail -c+$pos "$img" | $3 > $tmp 2> /dev/null - check_vmlinux $tmp + test $? -eq 0 && check_vmlinux $tmp 1 done } @@ -53,7 +61,7 @@ check_vmlinux $img # That didn't work, so retry after decompression. try_decompress '\037\213\010' xy gunzip -try_decompress '\3757zXZ\000' abcde unxz +try_decompress '\3757zXZ\000' abcde "unxz --single-stream" try_decompress 'BZh' xy bunzip2 try_decompress '\135\0\0\0' xxx unlzma try_decompress '\211\114\132' xy 'lzop -d'