qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: or1k -M virt -hda and net.


From: Rob Landley
Subject: Re: or1k -M virt -hda and net.
Date: Wed, 8 Jan 2025 16:57:47 -0600
User-agent: Mozilla Thunderbird

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 via email to

[Prev in Thread] Current Thread [Next in Thread]