qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5 2/2] aarch64: Allow -kernel option to take a gzip-compressed kernel.
Date: Tue, 05 Aug 2014 11:00:50 +0100	[thread overview]
Message-ID: <8738dbl0gx.fsf@linaro.org> (raw)
In-Reply-To: <1407152873-16772-3-git-send-email-rjones@redhat.com>


Richard W.M. Jones writes:

> 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 <rjones@redhat.com>
> ---
>  hw/arm/boot.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index 3d1f4a2..1d541db 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -444,6 +444,7 @@ static void do_cpu_reset(void *opaque)
>  void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
>  {
>      CPUState *cs = CPU(cpu);
> +    int allow_compressed_kernels = 0;
>      int kernel_size;
>      int initrd_size;
>      int is_linux = 0;
> @@ -465,6 +466,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
>          primary_loader = bootloader_aarch64;
>          kernel_load_offset = KERNEL64_LOAD_ADDR;
>          elf_machine = EM_AARCH64;
> +        allow_compressed_kernels = 1;
>      } else {
>          primary_loader = bootloader;
>          kernel_load_offset = KERNEL_LOAD_ADDR;
> @@ -510,6 +512,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 (allow_compressed_kernels && 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,

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée

      reply	other threads:[~2014-08-05 10:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 11:47 [Qemu-devel] [PATCH v5 0/2] aarch64: Allow -kernel option to take a gzip-compressed kernel Richard W.M. Jones
2014-08-04 11:47 ` [Qemu-devel] [PATCH v5 1/2] loader: Add load_image_gzipped function Richard W.M. Jones
2014-08-05  9:52   ` Alex Bennée
2014-08-05  9:57   ` Alex Bennée
2014-08-05 10:01     ` Richard W.M. Jones
2014-08-04 11:47 ` [Qemu-devel] [PATCH v5 2/2] aarch64: Allow -kernel option to take a gzip-compressed kernel Richard W.M. Jones
2014-08-05 10:00   ` Alex Bennée [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738dbl0gx.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).