All of lore.kernel.org
 help / color / mirror / Atom feed
* qemu broke booting of old RedHat floppies
@ 2021-01-20 15:11 Michael Tokarev
  2021-01-20 15:39 ` Alexander Bulekov
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michael Tokarev @ 2021-01-20 15:11 UTC (permalink / raw)
  To: qemu-devel qemu-devel, John Snow

As someone noticed on IRC, old (2.x) RedHat floppies does not boot
in current qemu.  When qemu is booted from floppy image at
  https://archive.org/details/RedHatLinuxBootDisk521998
(download the "ISO image" link there, it really is an 1.44 floppy),
seabios says Boot failed and that's it.

I run git bisect with it, knowing that qemu 2.1 works fine, and
it pointed out to this commit which is oldish qemu-2.5+:

commit 4812fa27fa75bce89738a82a191755853dd88408
Author: John Snow <jsnow@redhat.com>
Date:   Fri Jan 22 15:51:05 2016 -0500

     fdc: change auto fallback drive for ISA FDC to 288

     The 2.88 drive is more suitable as a default because
     it can still read 1.44 images correctly, but the reverse
     is not true.

     Since there exist virtio-win drivers that are shipped on
     2.88 floppy images, this patch will allow VMs booted without
     a floppy disk inserted to later insert a 2.88MB floppy and
     have that work.

     This patch has been tested with msdos, freedos, fedora,
     windows 8 and windows 10 without issue: if problems do
     arise for certain guests being unable to cope with 2.88MB
     drives as the default, they are in the minority and can use
     type=144 as needed (or insert a proper boot medium and omit
     type=144/288 or use type=auto) to obtain different drive types.

     As icing, the default will remain auto/144 for any pre-2.6
     machine types, hopefully minimizing the impact of this change
     in legacy hw to basically zero.

     Reviewed-by: Eric Blake <eblake@redhat.com>
     Signed-off-by: John Snow <jsnow@redhat.com>
     Message-id: 1453495865-9649-13-git-send-email-jsnow@redhat.com

Now, I don't even know where to put that "type=144/288/auto" thing,
I tried this:

  -drive file=RedHatLinuxBootDisk521998.disk1of1.img,if=floppy,format=raw,type=144

but it says that format=raw does not support "type=144" option.

And it's even more: I don't remember which size should be an 1.44Mb floppy :))
The file size of that image is 1492992 bytes which does not look like it is of
standard size, but I can't find which size it should be.

Thanks!

/mjt


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: qemu broke booting of old RedHat floppies
  2021-01-20 15:11 qemu broke booting of old RedHat floppies Michael Tokarev
@ 2021-01-20 15:39 ` Alexander Bulekov
  2021-01-20 15:41 ` Thomas Huth
  2021-02-03 16:30 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 7+ messages in thread
From: Alexander Bulekov @ 2021-01-20 15:39 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: John Snow, qemu-devel qemu-devel

On 210120 1811, Michael Tokarev wrote:
> As someone noticed on IRC, old (2.x) RedHat floppies does not boot
> in current qemu.  When qemu is booted from floppy image at
>  https://archive.org/details/RedHatLinuxBootDisk521998
> (download the "ISO image" link there, it really is an 1.44 floppy),
> seabios says Boot failed and that's it.
> 
> I run git bisect with it, knowing that qemu 2.1 works fine, and
> it pointed out to this commit which is oldish qemu-2.5+:
> 
> commit 4812fa27fa75bce89738a82a191755853dd88408
> Author: John Snow <jsnow@redhat.com>
> Date:   Fri Jan 22 15:51:05 2016 -0500
> 
>     fdc: change auto fallback drive for ISA FDC to 288
> 
>     The 2.88 drive is more suitable as a default because
>     it can still read 1.44 images correctly, but the reverse
>     is not true.
> 
>     Since there exist virtio-win drivers that are shipped on
>     2.88 floppy images, this patch will allow VMs booted without
>     a floppy disk inserted to later insert a 2.88MB floppy and
>     have that work.
> 
>     This patch has been tested with msdos, freedos, fedora,
>     windows 8 and windows 10 without issue: if problems do
>     arise for certain guests being unable to cope with 2.88MB
>     drives as the default, they are in the minority and can use
>     type=144 as needed (or insert a proper boot medium and omit
>     type=144/288 or use type=auto) to obtain different drive types.
> 
>     As icing, the default will remain auto/144 for any pre-2.6
>     machine types, hopefully minimizing the impact of this change
>     in legacy hw to basically zero.
> 
>     Reviewed-by: Eric Blake <eblake@redhat.com>
>     Signed-off-by: John Snow <jsnow@redhat.com>
>     Message-id: 1453495865-9649-13-git-send-email-jsnow@redhat.com
> 
> Now, I don't even know where to put that "type=144/288/auto" thing,
> I tried this:
> 
>  -drive file=RedHatLinuxBootDisk521998.disk1of1.img,if=floppy,format=raw,type=144
> 
> but it says that format=raw does not support "type=144" option.
> 

There is a drive-type=144 option to -device floppy. Maybe that's where
it goes:
-drive id=fdc1,... -device floppy,drive=fdc1,drive-type=144

> And it's even more: I don't remember which size should be an 1.44Mb floppy :))
> The file size of that image is 1492992 bytes which does not look like it is of
> standard size, but I can't find which size it should be.
> 
> Thanks!
> 
> /mjt
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: qemu broke booting of old RedHat floppies
  2021-01-20 15:11 qemu broke booting of old RedHat floppies Michael Tokarev
  2021-01-20 15:39 ` Alexander Bulekov
@ 2021-01-20 15:41 ` Thomas Huth
  2021-03-12  6:23   ` John Snow
  2021-02-03 16:30 ` Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Thomas Huth @ 2021-01-20 15:41 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel qemu-devel, John Snow

On 20/01/2021 16.11, Michael Tokarev wrote:
> As someone noticed on IRC, old (2.x) RedHat floppies does not boot
> in current qemu.  When qemu is booted from floppy image at
>   https://archive.org/details/RedHatLinuxBootDisk521998
> (download the "ISO image" link there, it really is an 1.44 floppy),
> seabios says Boot failed and that's it.
> 
> I run git bisect with it, knowing that qemu 2.1 works fine, and
> it pointed out to this commit which is oldish qemu-2.5+:
[...]
> Now, I don't even know where to put that "type=144/288/auto" thing,
> I tried this:
> 
>   -drive 
> file=RedHatLinuxBootDisk521998.disk1of1.img,if=floppy,format=raw,type=144
> 
> but it says that format=raw does not support "type=144" option.

Try:

  qemu-system-x86_64 -drive 
if=none,file=RedHatLinuxBootDisk521998.disk1of1.img,format=raw,id=dr1 
-device floppy,drive-type=144,drive=dr1

> And it's even more: I don't remember which size should be an 1.44Mb floppy :))
> The file size of that image is 1492992 bytes which does not look like it is of
> standard size, but I can't find which size it should be.

As mentioned on IRC already, it's likely a disk with 81 tracks instead of 80 
tracks, so it's bigger than the usual 1.44 MB floppy disk images and thus 
QEMU likely misdetects it by default.

  Thomas



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: qemu broke booting of old RedHat floppies
  2021-01-20 15:11 qemu broke booting of old RedHat floppies Michael Tokarev
  2021-01-20 15:39 ` Alexander Bulekov
  2021-01-20 15:41 ` Thomas Huth
@ 2021-02-03 16:30 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-03 16:30 UTC (permalink / raw)
  To: John Snow, avocado-devel; +Cc: Michael Tokarev, qemu-devel qemu-devel

Cc'ing avocado-devel for test idea.

On 1/20/21 4:11 PM, Michael Tokarev wrote:
> As someone noticed on IRC, old (2.x) RedHat floppies does not boot
> in current qemu.  When qemu is booted from floppy image at
>  https://archive.org/details/RedHatLinuxBootDisk521998
> (download the "ISO image" link there, it really is an 1.44 floppy),
> seabios says Boot failed and that's it.
> 
> I run git bisect with it, knowing that qemu 2.1 works fine, and
> it pointed out to this commit which is oldish qemu-2.5+:
> 
> commit 4812fa27fa75bce89738a82a191755853dd88408
> Author: John Snow <jsnow@redhat.com>
> Date:   Fri Jan 22 15:51:05 2016 -0500
> 
>     fdc: change auto fallback drive for ISA FDC to 288
> 
>     The 2.88 drive is more suitable as a default because
>     it can still read 1.44 images correctly, but the reverse
>     is not true.
> 
>     Since there exist virtio-win drivers that are shipped on
>     2.88 floppy images, this patch will allow VMs booted without
>     a floppy disk inserted to later insert a 2.88MB floppy and
>     have that work.
> 
>     This patch has been tested with msdos, freedos, fedora,
>     windows 8 and windows 10 without issue: if problems do
>     arise for certain guests being unable to cope with 2.88MB
>     drives as the default, they are in the minority and can use
>     type=144 as needed (or insert a proper boot medium and omit
>     type=144/288 or use type=auto) to obtain different drive types.
> 
>     As icing, the default will remain auto/144 for any pre-2.6
>     machine types, hopefully minimizing the impact of this change
>     in legacy hw to basically zero.
> 
>     Reviewed-by: Eric Blake <eblake@redhat.com>
>     Signed-off-by: John Snow <jsnow@redhat.com>
>     Message-id: 1453495865-9649-13-git-send-email-jsnow@redhat.com
> 
> Now, I don't even know where to put that "type=144/288/auto" thing,
> I tried this:
> 
>  -drive
> file=RedHatLinuxBootDisk521998.disk1of1.img,if=floppy,format=raw,type=144
> 
> but it says that format=raw does not support "type=144" option.
> 
> And it's even more: I don't remember which size should be an 1.44Mb
> floppy :))
> The file size of that image is 1492992 bytes which does not look like it
> is of
> standard size, but I can't find which size it should be.
> 
> Thanks!
> 
> /mjt
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: qemu broke booting of old RedHat floppies
  2021-01-20 15:41 ` Thomas Huth
@ 2021-03-12  6:23   ` John Snow
  0 siblings, 0 replies; 7+ messages in thread
From: John Snow @ 2021-03-12  6:23 UTC (permalink / raw)
  To: Thomas Huth, Michael Tokarev, qemu-devel qemu-devel

On 1/20/21 10:41 AM, Thomas Huth wrote:
> On 20/01/2021 16.11, Michael Tokarev wrote:
>> As someone noticed on IRC, old (2.x) RedHat floppies does not boot
>> in current qemu.  When qemu is booted from floppy image at
>>   https://archive.org/details/RedHatLinuxBootDisk521998
>> (download the "ISO image" link there, it really is an 1.44 floppy),
>> seabios says Boot failed and that's it.
>>
>> I run git bisect with it, knowing that qemu 2.1 works fine, and
>> it pointed out to this commit which is oldish qemu-2.5+:
> [...]
>> Now, I don't even know where to put that "type=144/288/auto" thing,
>> I tried this:
>>
>>   -drive 
>> file=RedHatLinuxBootDisk521998.disk1of1.img,if=floppy,format=raw,type=144
>>
>> but it says that format=raw does not support "type=144" option.
> 
> Try:
> 
>   qemu-system-x86_64 -drive 
> if=none,file=RedHatLinuxBootDisk521998.disk1of1.img,format=raw,id=dr1 
> -device floppy,drive-type=144,drive=dr1
> 
>> And it's even more: I don't remember which size should be an 1.44Mb 
>> floppy :))
>> The file size of that image is 1492992 bytes which does not look like 
>> it is of
>> standard size, but I can't find which size it should be.
> 
> As mentioned on IRC already, it's likely a disk with 81 tracks instead 
> of 80 tracks, so it's bigger than the usual 1.44 MB floppy disk images 
> and thus QEMU likely misdetects it by default.
> 
>   Thomas
> 
> 

Whoops, yes, the auto-detection doesn't really seem to understand what's 
going on here.

./i386-softmmu/qemu-system-i386 -drive 
if=none,format=raw,file=../../../../Downloads/RedHatLinuxBootDisk521998.disk1of1.img,id=dr1 
-device floppy,drive-type=auto,drive=dr1

this fails, as does drive-type=288.
drive-type=144 works, though.

Digging a tiny bit:

- auto chooses a (36, 80, 1) geometry (It assumes the 288 type.)
- 288 chooses the same geometry.
- 144 chooses (18, 80, 1) => 2880 sectors

None of these choices actually get the geometry right, because the 
fd_formats[] table just ... doesn't have that geometry in the table. It 
only works under the 144 type because when it just gives up and picks a 
geometry, it picks the first geometry under the 1.44MB section.

When it defaults to 2.88 instead, it picks the first geometry under the 
2.88MB section.

Adding an explicit (18, 81, 1) choice improves our mileage:

- auto -> (18, 81, 1)
- 144 -> (18, 81, 1)
- 288 -> (18, 81, 1)

and fixes the boot.


diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 198940e737..4269c0c754 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -122,6 +122,7 @@ static const FDFormat fd_formats[] = {
      /* First entry is default format */
      /* 1.44 MB 3"1/2 floppy disks */
      { FLOPPY_DRIVE_TYPE_144, 18, 80, 1, FDRIVE_RATE_500K, }, /* 3.5" 
2880 */
+    { FLOPPY_DRIVE_TYPE_144, 18, 81, 1, FDRIVE_RATE_500K, },
      { FLOPPY_DRIVE_TYPE_144, 20, 80, 1, FDRIVE_RATE_500K, }, /* 3.5" 
3200 */
      { FLOPPY_DRIVE_TYPE_144, 21, 80, 1, FDRIVE_RATE_500K, },
      { FLOPPY_DRIVE_TYPE_144, 21, 82, 1, FDRIVE_RATE_500K, },



Do you have the name of the person who reported this on IRC so I can add 
a credit?

--js



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: qemu broke booting of old RedHat floppies
       [not found] ` <098ce1c2-e304-bf37-c3f9-f8cd81028020@tls.msk.ru>
@ 2021-01-20 16:02   ` Michael Tokarev
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Tokarev @ 2021-01-20 16:02 UTC (permalink / raw)
  To: qemu-devel qemu-devel, John Snow

And one more followup to my own email.
As I didn't remember what's the std size of 144M floppy image
I weren't able to check, but the file size looked suspectably
for me at the very beginning. And indeed, std 144M floppy is
smaller than that. After truncating the file to 1440*1024 bytes
it works fine. The extra content seem not to belong to the image
itself and were added by something on the way to the archive
page.  So this issue ended up as being a non-issue.

One thing still bothers me:

>   $ qemu-system-x86_64 \
>    -drive file=RedHatLinuxBootDisk521998.disk1of1.img,if=none,id=d,format=raw \
>    -device floppy,drive=d,type=144
> 
> But it fails:
> 
>   qemu-system-x86_64: -device floppy,drive=d,type=144: Insufficient permission to perform this operation

This same error message is returned after truncating the image
to 1440*1024 bytes. By current qemu 5.2. Why?

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: qemu broke booting of old RedHat floppies
       [not found] <0bca1cd0-69c3-c07a-b4cf-015dcdbc6d61@tls.msk.ru>
@ 2021-01-20 15:20 ` Michael Tokarev
       [not found] ` <098ce1c2-e304-bf37-c3f9-f8cd81028020@tls.msk.ru>
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Tokarev @ 2021-01-20 15:20 UTC (permalink / raw)
  To: qemu-devel qemu-devel, John Snow

20.01.2021 18:11, Michael Tokarev wrote:
..
> Now, I don't even know where to put that "type=144/288/auto" thing,
> I tried this:
> 
>   -drive file=RedHatLinuxBootDisk521998.disk1of1.img,if=floppy,format=raw,type=144
> 
> but it says that format=raw does not support "type=144" option.

So I found this:

  $ qemu-system-x86_64 \
   -drive file=RedHatLinuxBootDisk521998.disk1of1.img,if=none,id=d,format=raw \
   -device floppy,drive=d,type=144

But it fails:

  qemu-system-x86_64: -device floppy,drive=d,type=144: Insufficient permission to perform this operation

Umm?

/mjt



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-12  6:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 15:11 qemu broke booting of old RedHat floppies Michael Tokarev
2021-01-20 15:39 ` Alexander Bulekov
2021-01-20 15:41 ` Thomas Huth
2021-03-12  6:23   ` John Snow
2021-02-03 16:30 ` Philippe Mathieu-Daudé
     [not found] <0bca1cd0-69c3-c07a-b4cf-015dcdbc6d61@tls.msk.ru>
2021-01-20 15:20 ` Michael Tokarev
     [not found] ` <098ce1c2-e304-bf37-c3f9-f8cd81028020@tls.msk.ru>
2021-01-20 16:02   ` Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.