qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: Alistair Francis <alistair.francis@wdc.com>
Cc: Alistair Francis <alistair23@gmail.com>,
	Palmer Dabbelt <palmer@sifive.com>,
	"open list:RISC-V" <qemu-riscv@nongnu.org>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [RFC v1 3/5] hw/riscv: Extend the kernel loading support
Date: Wed, 19 Jun 2019 23:16:11 +0800	[thread overview]
Message-ID: <CAEUhbmXKv7-r3KyDGnq8ysmyccy1tVgBDqwLcf46U96BZOiKYw@mail.gmail.com> (raw)
In-Reply-To: <99fc8fe28f2a0493f248d50d32d4b1bc649536ab.1560904640.git.alistair.francis@wdc.com>

On Wed, Jun 19, 2019 at 8:56 AM Alistair Francis
<alistair.francis@wdc.com> wrote:
>
> Extend the RISC-V kernel loader to support uImage and Image files.
> A Linux kernel can now be booted with:
>
>     qemu-system-riscv64 -machine virt -bios fw_jump.elf -kernel Image
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  hw/riscv/boot.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
> index 392ca0cb2e..7f68035a3f 100644
> --- a/hw/riscv/boot.c
> +++ b/hw/riscv/boot.c
> @@ -67,13 +67,22 @@ target_ulong riscv_load_kernel(MachineState *machine,
>      uint64_t kernel_entry, kernel_high;
>
>      if (load_elf(kernel_filename, NULL, kernel_translate, machine,
> -                 &kernel_entry, NULL, &kernel_high,
> -                 0, EM_RISCV, 1, 0) < 0) {
> -        error_report("could not load kernel '%s'", kernel_filename);
> -        exit(1);
> +                 &kernel_entry, NULL, &kernel_high, 0, EM_RISCV, 1, 0) > 0) {
> +        return kernel_entry;
> +    }
> +
> +    if (load_uimage_as(kernel_filename, &kernel_entry, NULL, NULL,
> +                       kernel_translate, machine, NULL) > 0) {

We should not set the 'kernel_translate' here for uImage.

In fact, the whole kernel_translate() is not necessary.

> +        return kernel_entry;
> +    }
> +

Regards,
Bin


  reply	other threads:[~2019-06-19 15:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19  0:38 [Qemu-devel] [RFC v1 0/5] RISC-V: Add firmware loading support and default Alistair Francis
2019-06-19  0:38 ` [Qemu-devel] [RFC v1 1/5] hw/riscv: Split out the boot functions Alistair Francis
2019-06-19 15:16   ` Bin Meng
2019-06-19 18:24     ` Alistair Francis
2019-06-19  0:38 ` [Qemu-devel] [RFC v1 2/5] hw/riscv: Add support for loading a firmware Alistair Francis
2019-06-19 15:16   ` Bin Meng
2019-06-19 15:25     ` [Qemu-devel] [Qemu-riscv] " Jonathan Behrens
2019-06-19 15:30       ` Bin Meng
2019-06-19 21:00         ` Alistair Francis
2019-06-19  0:38 ` [Qemu-devel] [RFC v1 3/5] hw/riscv: Extend the kernel loading support Alistair Francis
2019-06-19 15:16   ` Bin Meng [this message]
2019-06-19 21:01     ` Alistair Francis
2019-06-19 22:06       ` Alistair Francis
2019-06-19  0:38 ` [Qemu-devel] [RFC v1 4/5] roms: Add OpenSBI version 0.3 Alistair Francis
2019-06-19  5:14   ` [Qemu-devel] [Qemu-riscv] " Anup Patel
2019-06-19 15:18     ` Bin Meng
2019-06-19 18:27       ` Alistair Francis
2019-06-21  5:41         ` Bin Meng
2019-06-21 22:41           ` Alistair Francis
2019-06-19  0:38 ` [Qemu-devel] [RFC v1 5/5] hw/riscv: Load OpenSBI as the default firmware Alistair Francis
2019-06-19  5:16   ` [Qemu-devel] [Qemu-riscv] " Anup Patel
2019-06-19 14:26 ` [Qemu-devel] [RFC v1 0/5] RISC-V: Add firmware loading support and default Bin Meng
2019-06-19 14:29   ` Alistair Francis
2019-06-19 14:42     ` Bin Meng
2019-06-19 18:23       ` Alistair Francis
2019-06-20  8:16         ` [Qemu-devel] [Qemu-riscv] " Andrea Bolognani
2019-06-20 17:59           ` Alistair Francis
2019-06-20 18:43             ` David Abdurachmanov
2019-06-21 12:35               ` Andrea Bolognani
2019-06-27 13:49                 ` Andrea Bolognani

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=CAEUhbmXKv7-r3KyDGnq8ysmyccy1tVgBDqwLcf46U96BZOiKYw@mail.gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=palmer@sifive.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    /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).