qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Stafford Horne" <shorne@gmail.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Linux OpenRISC" <linux-openrisc@vger.kernel.org>
Subject: Re: or1k -M virt -hda and net.
Date: Wed, 8 Jan 2025 16:57:47 -0600	[thread overview]
Message-ID: <c5efb6af-5fef-4938-aac9-c9c8b75a9a69@landley.net> (raw)
In-Reply-To: <6e5f24cf-02bf-1cf0-2d0d-e683866cc3d3@eik.bme.hu>

On 1/8/25 07:01, BALATON Zoltan wrote:
> On Tue, 7 Jan 2025, Rob Landley wrote:
>> What's the alternative to -hda you suggest for that?
>>
>> Can I do "./run-qemu.sh -drive file=blah.img" without the rest? 
>> Perhaps specify all the details in the script and then optionally add 
>> an extra argument at the end? I couldn't get that to work:
>>
>> $ root/or1k/run-qemu.sh -netdev user,id=net0 -device virtio-net- 
>> device,netdev=net0 -drive format=raw,id=hd0 -device virtio-blk- 
>> device,drive=hd0 -drive file=README
> 
> You need '-drive if=none,id=hd0,format=raw,file=README' as a single 
> option not split into two.

I'm not always specifying an -hda. Sometimes it does, and sometimes it 
runs without it. I would like to have everything EXCEPT the media 
specified, so it can be inserted into a ready drive or run without it.

That's what -hda traditionally does.

> With if=none -drive won't auto-create a  device

$ root/or1k/run-qemu.sh -netdev user,id=net0 -device 
virtio-net-device,netdev=net0 -drive if=none,id=hd0,format=raw
qemu-system-or1k: -drive if=none,id=hd0,format=raw: A block device must 
be specified for "file"

> so you then also need a corresponding -device option for the 
> drive that you seem to have already above.

$ root/or1k/run-qemu.sh -netdev user,id=net0 -device 
virtio-net-device,netdev=net0 -device virtio-blk-device
qemu-system-or1k: -device virtio-blk-device: drive property not set
$ root/or1k/run-qemu.sh -netdev user,id=net0 -device 
virtio-net-device,netdev=net0 -device virtio-blk-device,drive=hd0
qemu-system-or1k: -device virtio-blk-device,drive=hd0: Property 
'virtio-blk-device.drive' can't find value 'hd0'
$ root/or1k/run-qemu.sh -netdev user,id=net0 -device 
virtio-net-device,netdev=net0 -device virtio-blk-device,drive=hd0 -drive 
id=hd0,if=none
qemu-system-or1k: -device virtio-blk-device,drive=hd0: Device needs 
media, but drive is empty

That's as close as I can get. As far as I can tell, it's complaining 
that I got it into the state I wanted, and it doesn't want to be in that 
state. The "if=none" does not appear to help.

I also don't know what drive=/id= pair "-hda" would be trying to 
populate, so dunno what name to use there.

Also, it requires -drive and its argument to be seperate:

   qemu-system-or1k: -device=virtio-blk-device,drive=hda: invalid option

Refusing to let them to be glued together with = (like most --longopt 
parsers do, including the 
https://github.com/landley/toybox/blob/master/lib/args.c I wrote) means 
I can't use bash's brace expansion to set up multiple at once (to 
preload support for -hda, -hdb, -hdc, and -hdd), ala:

   -drive=id=hd{0,1,2,3},if=none

Not that the current script has a bash dependency... :P

> If you want -hda to work you 
> may need something like commit d36b2f4e78 (hw/ppc/sam460ex: Support 
> short options for adding drives) for the machine you use. In particular 
> the MachineClass block_default_type field says what's the default 
> interface that -drive and other short options should use (at least I 
> think so, I'm no expert on this either but searching for it should at 
> least point to where it's handled).

Thanks for the pointer, I'll take a look.

Rob


  reply	other threads:[~2025-01-08 22:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  5:42 QEMU commit 0a923be2f642 broke my or1k image Rob Landley
2024-09-16  7:21 ` Stafford Horne
2024-11-21 22:32   ` Rob Landley
2024-11-22 16:35     ` Stafford Horne
2024-11-23  0:54       ` Rob Landley
2024-11-23  8:28         ` Stafford Horne
2024-11-24  5:18           ` Rob Landley
2024-11-24  6:50             ` Stafford Horne
2024-12-22 17:29               ` or1k -M virt -hda and net Rob Landley
     [not found]                 ` <Z2lgL31ZeSkO59MZ@antec>
2025-01-01  1:19                   ` Rob Landley
2025-01-07 11:56                     ` Rob Landley
2025-01-07 17:31                       ` Stafford Horne
2025-01-07 18:05                         ` Alex Bennée
2025-01-07 23:20                           ` Rob Landley
2025-01-08 13:01                             ` BALATON Zoltan
2025-01-08 22:57                               ` Rob Landley [this message]
2025-01-09  2:05                                 ` BALATON Zoltan
2025-01-08 14:59                             ` Alex Bennée
2025-01-08 22:34                               ` Rob Landley
2025-01-09  2:48                                 ` BALATON Zoltan
2025-01-07 22:44                         ` Rob Landley
2025-01-08  8:24                           ` Geert Uytterhoeven
2025-01-08 16:23                             ` Rob Landley
2025-01-08 16:26                               ` Geert Uytterhoeven
2025-01-08 22:40                                 ` Rob Landley
2025-01-09  8:49                                   ` Geert Uytterhoeven

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=c5efb6af-5fef-4938-aac9-c9c8b75a9a69@landley.net \
    --to=rob@landley.net \
    --cc=Jason@zx2c4.com \
    --cc=alex.bennee@linaro.org \
    --cc=balaton@eik.bme.hu \
    --cc=linux-openrisc@vger.kernel.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shorne@gmail.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).