qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes


From: Peter Maydell
Subject: Re: [PATCH 2/2] hw/sd/sdcard: Do not allow invalid SD card sizes
Date: Fri, 10 Jul 2020 10:54:51 +0100

On Thu, 9 Jul 2020 at 17:27, Alistair Francis <alistair23@gmail.com> wrote:
>
> On Thu, Jul 9, 2020 at 7:35 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> >
> > On 7/9/20 4:15 PM, Peter Maydell wrote:
> > > The only chance you have of something that's actually
> > > generic would probably involve "qemu-img resize". But I'm a bit
> > > wary of having an error message that recommends that, because
> > > what if we got it wrong?
> >
> > I am not sure what to recommend then.
> >
> > Would that work as hint?
> >
> >   qemu-system-arm -M raspi2 -sd ./buster-lite-armhf.img
> >   qemu-system-arm: Invalid SD card size: 1.73 GiB
> >   SD card size has to be a power of 2, e.g. 2GiB.
>
> That sounds good to me. That's enough for a user to figure out the next step.
>
> If you want you could also add: "qemu-img might be able to help." or
> something like that.

Thinking about it a bit and talking to Philippe on IRC, I think
we can usefully have the message recommend "qemu-img resize" to the
user; I think we should avoid printing out an exact-cut-n-paste
command line just in case it's wrong, but something like:
 qemu-system-arm: Invalid SD card size: 1.73 GiB
 SD card size has to be a power of 2, e.g. 2GiB.
 You can resize disk images with 'qemu-img resize <imagefile> <new-size>'
 (note that this will lose data if you make the image smaller than it
currently is)

I think is a reasonable balance between pointing the user in
the right direction and cautioning them to check what they're
doing before they blithely perform the resize...

thanks
-- PMM



reply via email to

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