NetBSD Problem Report #55582

From www@netbsd.org  Mon Aug 17 20:28:00 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 9D2B41A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 17 Aug 2020 20:28:00 +0000 (UTC)
Message-Id: <20200817202758.B0AA31A9246@mollari.NetBSD.org>
Date: Mon, 17 Aug 2020 20:27:58 +0000 (UTC)
From: rnestor@tx.rr.com
Reply-To: rnestor@tx.rr.com
To: gnats-bugs@NetBSD.org
Subject: OVMF files limit qemu boot capabilities
X-Send-Pr-Version: www-1.0

>Number:         55582
>Category:       pkg
>Synopsis:       OVMF files limit qemu boot capabilities
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 17 20:30:00 +0000 2020
>Originator:     Bob Nestor
>Release:        pkgsrc-current
>Organization:
>Environment:
NetBSD 9.99.70 NetBSD 9.99.70 (GENERIC) #0: Fri Aug 14 03:54:46 UTC 2020  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
Some CDs and hard disks that are bootable on bare metal are not bootable under qemu and hang during boot about 2/3 of the way thru the process. This can be seen in the progress bar of the boot sequence.  The problem appears to be the version of OVMF in pkgsrc, which is built off of a stable2018 release.  Using the OVMF files built from the stable202005 release allows qemu to (mostly) boot from the problem CDs and hard disks. Even with the newer OVMF files there appear to be some issues with CDs, but booting from disks works. 
>How-To-Repeat:
Download a copy of the rEFInd CD from
http://sourceforge.net/projects/refind/files/0.12.0/refind-cd-0.12.0.zip

Create a small bootable disk using files on the CD
#!/bin/sh
cwd=`pwd`
vndconfig -c vnd0 refind-cd-0.12.0.iso
mount -t cd9660 /dev/vnd0a /media
rm -fr refind.dsk /tmp/refind
mkdir -p -m 0755 /tmp/refind/EFI/boot /tmp/refind/EFI/refind
cp /media/refind/refind_x64.efi /tmp/refind/EFI/boot/bootx64.efi
cp -r /media/refind/* /tmp/refind/EFI/refind/
echo 'fs0:\EFI\refind\refind_x64.efi' >/tmp/refind/startup.nsh
cd /tmp/refind/EFI/refind
cp refind.conf-sample refind.conf
rm -fr bootaa64.efi drivers_aa64 bootia32.efi drivers_ia32 refind_aa64.efi
rm -fr refind_ia32.efi tools_aa64 tools_ia32
cd ${cwd}
umount /media
vndconfig -u vnd0
makefs -M 1m -m 4m -B 1234   -t msdos -o F=16,c=1 refind.dsk /tmp/refind

Try booting the newly created disk using
#!/bin/sh
vars="/tmp/OVMF_${1}.fd"
accel="-vga cirrus"
if [ ! -f ${vars} ]; then
    dd if=/dev/zero of=${vars} count=4 bs=1024
fi
#ovmf=edk2/usr/share/edk2-ovmf/x64/OVMF_CODE.fd
ovmf=/usr/pkg/share/ovmf/OVMFX64.fd
qemu-system-x86_64 -m 4096 -machine q35 ${accel} -boot menu=on \
    -device qemu-xhci -device usb-tablet -device usb-mouse -smbios type=2 \
    -drive if=pflash,format=raw,readonly,file=${ovmf} \
    -drive if=pflash,format=raw,file=${vars} \
    -device ich9-ahci,id=sata \
    -device ide-hd,bus=sata.0,drive=disk \
    -drive id=disk,if=none,media=disk,format=raw,file=${disk} 

The boot stalls with the boot progress bar about 2/3 of the way complete. Replacing the OVMF file with one built from the stable202005 release allows the boot to complete.
>Fix:
Updating the build of ovmf in pkgsrc to use the latest stable202005 release is the obvious solution, although it doesn't fully address the
problem of booting CDs like the rEFInd one which may be a problem in ovmf or in qemu.

I've looked at updating the build of ovmf in pkgsrc, but it's way over my head.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.