render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

Blame 0002-aarch64-Allow-kernel-option-to-take-a-gzip-compresse.patch

46f3a5
From f06e2812a6813c8c93fee50bd8beb5ae5d8cb871 Mon Sep 17 00:00:00 2001
4ced99
From: "Richard W.M. Jones" <rjones@redhat.com>
723d95
Date: Tue, 19 Aug 2014 18:56:28 +0100
723d95
Subject: [PATCH] aarch64: Allow -kernel option to take a gzip-compressed
4ced99
 kernel.
4ced99
MIME-Version: 1.0
4ced99
Content-Type: text/plain; charset=UTF-8
4ced99
Content-Transfer-Encoding: 8bit
4ced99
4ced99
On aarch64 it is the bootloader's job to uncompress the kernel.  UEFI
4ced99
and u-boot bootloaders do this automatically when the kernel is
4ced99
gzip-compressed.
4ced99
4ced99
However the qemu -kernel option does not do this.  The following
4ced99
command does not work:
4ced99
4ced99
  qemu-system-aarch64 [...] -kernel /boot/vmlinuz
4ced99
4ced99
because it tries to execute the gzip-compressed data.
4ced99
4ced99
This commit lets gzip-compressed kernels be uncompressed
4ced99
transparently.
4ced99
4ced99
Currently this is only done when emulating aarch64.
4ced99
4ced99
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
4ced99
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
723d95
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
723d95
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
723d95
Message-id: 1407831259-2115-3-git-send-email-rjones@redhat.com
723d95
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
723d95
(cherry picked from commit 6f5d3cbe8892367026526a7deed0ceecc700a7ad)
4ced99
---
723d95
 hw/arm/boot.c | 7 +++++++
723d95
 1 file changed, 7 insertions(+)
4ced99
4ced99
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
723d95
index 3d1f4a2..b7d60aa 100644
4ced99
--- a/hw/arm/boot.c
4ced99
+++ b/hw/arm/boot.c
723d95
@@ -510,6 +510,13 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
4ced99
         kernel_size = load_uimage(info->kernel_filename, &entry, NULL,
4ced99
                                   &is_linux);
4ced99
     }
4ced99
+    /* On aarch64, it's the bootloader's job to uncompress the kernel. */
723d95
+    if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64) && kernel_size < 0) {
4ced99
+        entry = info->loader_start + kernel_load_offset;
4ced99
+        kernel_size = load_image_gzipped(info->kernel_filename, entry,
4ced99
+                                         info->ram_size - kernel_load_offset);
4ced99
+        is_linux = 1;
4ced99
+    }
4ced99
     if (kernel_size < 0) {
4ced99
         entry = info->loader_start + kernel_load_offset;
4ced99
         kernel_size = load_image_targphys(info->kernel_filename, entry,