From patchwork Tue Aug 19 18:09:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 35656 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5659B2034C for ; Tue, 19 Aug 2014 18:16:33 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf56637573pab.8 for ; Tue, 19 Aug 2014 11:16:26 -0700 (PDT) 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:date:message-id:in-reply-to :references:mime-version:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=PptWTKoLjknpsCSSHVd/HU7hIAKPIBKQuoTwqw5VW/8=; b=mBQN4mBib4eZEfS6sovJ6/joI6Gpfq5/jlrvYDUdhO5cefSU5IEXxtDXvUsjUK5CaL 2Em3ha5QmJjZ5CdvDkx2QVP+GHR5xJCTbWGsHvEjrl/Tw+OAr54pE8AhqZe8LqIJ8OKi uzz6kY1DRheUagRs30UxqFmxlxpLRLXlYX5gZK1wz6Tf0gX1I+KdUd5t4Tx9ix9EYIx3 WoMNsutBFQX7zPULvD4e8aPvv20OKYy+Uc7EExbhp6SiDEzKdO6pM4HPuZ7GaTk+VE52 0DYb3FmQKttEN7YuHkEyeMV47OgNt+Ic6PZlnkNtVDEqwxKHx5YbVbawoFntN3AeBLq8 tWOA== X-Gm-Message-State: ALoCoQkJk0lAaTI9UGOfoy6UIXS3lVPa4LfoAsHR5eEv5mv0VL41zFs1xLN0qljEMQEnz1bMNfqY X-Received: by 10.68.190.130 with SMTP id gq2mr18314032pbc.3.1408472186299; Tue, 19 Aug 2014 11:16:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.141 with SMTP id s13ls2818933qga.6.gmail; Tue, 19 Aug 2014 11:16:26 -0700 (PDT) X-Received: by 10.52.137.51 with SMTP id qf19mr863800vdb.97.1408472186166; Tue, 19 Aug 2014 11:16:26 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id x1si3947895vdh.89.2014.08.19.11.16.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 11:16:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so7853617vcb.35 for ; Tue, 19 Aug 2014 11:16:26 -0700 (PDT) X-Received: by 10.52.94.108 with SMTP id db12mr8096142vdb.8.1408472186078; Tue, 19 Aug 2014 11:16:26 -0700 (PDT) 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.221.37.5 with SMTP id tc5csp260443vcb; Tue, 19 Aug 2014 11:16:25 -0700 (PDT) X-Received: by 10.140.44.67 with SMTP id f61mr52903748qga.44.1408472185311; Tue, 19 Aug 2014 11:16:25 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l67si30113891qge.91.2014.08.19.11.16.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 11:16:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:52467 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJnxI-0000pu-P8 for patch@linaro.org; Tue, 19 Aug 2014 14:16:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJns6-000169-2O for qemu-devel@nongnu.org; Tue, 19 Aug 2014 14:11:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJnrz-00042X-6A for qemu-devel@nongnu.org; Tue, 19 Aug 2014 14:11:01 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:42051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJnry-0003wv-W5 for qemu-devel@nongnu.org; Tue, 19 Aug 2014 14:10:55 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1XJnqr-0000ib-7L for qemu-devel@nongnu.org; Tue, 19 Aug 2014 19:09:45 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 19 Aug 2014 19:09:42 +0100 Message-Id: <1408471784-2652-18-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1408471784-2652-1-git-send-email-peter.maydell@linaro.org> References: <1408471784-2652-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 81.2.115.146 Subject: [Qemu-devel] [PULL 17/19] aarch64: Allow -kernel option to take a gzip-compressed kernel. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@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.220.176 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 From: "Richard W.M. Jones" On aarch64 it is the bootloader's job to uncompress the kernel. UEFI and u-boot bootloaders do this automatically when the kernel is gzip-compressed. However the qemu -kernel option does not do this. The following command does not work: qemu-system-aarch64 [...] -kernel /boot/vmlinuz because it tries to execute the gzip-compressed data. This commit lets gzip-compressed kernels be uncompressed transparently. Currently this is only done when emulating aarch64. Signed-off-by: Richard W.M. Jones Reviewed-by: Alex Bennée Reviewed-by: Peter Crosthwaite Reviewed-by: Alex Bennée Message-id: 1407831259-2115-3-git-send-email-rjones@redhat.com Signed-off-by: Peter Maydell --- hw/arm/boot.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 1241761..e32f2f4 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -514,6 +514,13 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) kernel_size = load_uimage(info->kernel_filename, &entry, NULL, &is_linux); } + /* On aarch64, it's the bootloader's job to uncompress the kernel. */ + if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64) && kernel_size < 0) { + entry = info->loader_start + kernel_load_offset; + kernel_size = load_image_gzipped(info->kernel_filename, entry, + info->ram_size - kernel_load_offset); + is_linux = 1; + } if (kernel_size < 0) { entry = info->loader_start + kernel_load_offset; kernel_size = load_image_targphys(info->kernel_filename, entry,