qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, "Cédric Le Goater" <clg@kaod.org>
Subject: Re: [RFC PATCH] qemu-options: bring the kernel and image options together
Date: Thu, 23 Jun 2022 13:43:51 +0100	[thread overview]
Message-ID: <CAFEAcA-bisQy_WmRTi-L37XhGNtvdL4XnLj5+=HfbRqj6cQJsA@mail.gmail.com> (raw)
In-Reply-To: <20220622145052.4012981-1-alex.bennee@linaro.org>

On Wed, 22 Jun 2022 at 15:53, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> How to control the booting of QEMU is often a source of confusion for
> users. Bring the options that control this together in the manual
> pages and add some verbiage to describe when each option is
> appropriate.

https://stackoverflow.com/a/58434837/4499941 is my answer to
this common user question, though it's a bit more conversational
in tone than we want for the manual :-)

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Cc: Cédric Le Goater <clg@kaod.org>
> ---
>  qemu-options.hx | 80 ++++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 62 insertions(+), 18 deletions(-)
>
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 377d22fbd8..9b0242f0ef 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -1585,13 +1585,6 @@ SRST
>      Use file as SecureDigital card image.
>  ERST
>
> -DEF("pflash", HAS_ARG, QEMU_OPTION_pflash,
> -    "-pflash file    use 'file' as a parallel flash image\n", QEMU_ARCH_ALL)
> -SRST
> -``-pflash file``
> -    Use file as a parallel flash image.
> -ERST
> -
>  DEF("snapshot", 0, QEMU_OPTION_snapshot,
>      "-snapshot       write to temporary files instead of disk image files\n",
>      QEMU_ARCH_ALL)
> @@ -3680,12 +3673,51 @@ DEFHEADING()
>
>  #endif
>
> -DEFHEADING(Linux/Multiboot boot specific:)
> +DEFHEADING(Boot Image or Kernel specific:)
> +SRST
> +There are broadly 4 ways you can boot a system with QEMU.
> +
> + - specify a firmware and let it control finding a kernel
> + - specify a firmware and pass a hint to the kernel to boot
> + - direct kernel image boot
> + - manually load files into the guests address space

"guest's"

> +
> +The last method

Do you mean the third method? The last method isn't usually
used to load kernels, but rather bare-metal binaries.

 is useful for quickly testing kernels but as there is
> +no firmware to pass configuration information to the kernel it must
> +either be built for the exact configuration or be handed a DTB blob
> +which tells the kernel what drivers it needs.

This is all somewhat architecture specific: you don't necessarily
need to do either of those if the hardware is probeable.


You should also mention that all of this is board specific.

> +
> +ERST
> +
> +SRST
> +
> +For x86 machines ``-bios`` will generally do the right thing with
> +whatever it is given. For non-x86 machines the more strict ``-pflash``
> +option needs an image that is sized for the flash device for the given
> +machine type.

-bios works for some non-x86 machine types too.

Ideally we would:
 * have all our machine types have some documentation
 * have the documentation for each machine type say whether
   it supports -bios or not, and what it does

> +
> +ERST
> +
> +DEF("bios", HAS_ARG, QEMU_OPTION_bios, \
> +    "-bios file      set the filename for the BIOS\n", QEMU_ARCH_ALL)
> +SRST
> +``-bios file``
> +    Set the filename for the BIOS.
> +ERST
> +
> +DEF("pflash", HAS_ARG, QEMU_OPTION_pflash,
> +    "-pflash file    use 'file' as a parallel flash image\n", QEMU_ARCH_ALL)
> +SRST
> +``-pflash file``
> +    Use file as a parallel flash image.
> +ERST
> +
>  SRST
> -When using these options, you can use a given Linux or Multiboot kernel
> -without installing it in the disk image. It can be useful for easier
> -testing of various kernels.
>
> +The kernel options were designed to work with Linux kernels although
> +other things (like hypervisors) can be packaged up as a kernel
> +executable image. The exact format of a executable image is usually
> +architecture specific.
>
>  ERST
>
> @@ -3725,6 +3757,25 @@ SRST
>      kernel on boot.
>  ERST
>
> +SRST
> +
> +Finally you can also manually load images directly into the address
> +space of the guest. This is most useful for developers who already
> +know the layout of their guest and take care to ensure something sane
> +will happen when the reset vector executes.

We should say that this is the favoured option for "I want to
run a bare-metal binary", and we should also say that this
option works the same way on any architecture and machine.

> +
> +The generic loader can be invoked by using the loader device:
> +
> +``-device loader,addr=<addr>,data=<data>,data-len=<data-len>[,data-be=<data-be>][,cpu-num=<cpu-num>]``
> +
> +there is also the guest loader which operates in a similar way but
> +tweaks the DTB so a hypervisor loaded via ``-kernel`` can find where
> +the guest image is:
> +
> +``-device guest-loader,addr=<addr>[,kernel=<path>,[bootargs=<arguments>]][,initrd=<path>]``
> +
> +ERST
> +
>  DEFHEADING()

thanks
-- PMM


      parent reply	other threads:[~2022-06-23 12:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 14:50 [RFC PATCH] qemu-options: bring the kernel and image options together Alex Bennée
2022-06-23  6:22 ` Cédric Le Goater
2022-06-23 10:21   ` Alex Bennée
2022-06-28  6:11     ` Cédric Le Goater
2022-06-23 12:43 ` Peter Maydell [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='CAFEAcA-bisQy_WmRTi-L37XhGNtvdL4XnLj5+=HfbRqj6cQJsA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=clg@kaod.org \
    --cc=qemu-devel@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).