NetBSD-Users archive

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

Re: Booting CDs in Qemu



BTW I did another test on that refind.iso fine - under VirtualBox
6.1.12. It works just fine here. The guest was an earlier -current
system, already booting in EFI mode (pivoting to a ZFS root, not
updated very recently). I was able to boot from the CD, then install
rEFInd on the first system disk and make it the default boot.

So perhaps there is something to do with OVFM code.

On Fri, 7 Aug 2020 at 19:08, Chavdar Ivanov <ci4ic4%gmail.com@localhost> wrote:
>
> On Fri, 7 Aug 2020 at 18:34, Robert Nestor <rnestor%mac.com@localhost> wrote:
> >
> > If you’re saying you think the rEFInd CD is expecting to find Apple HW that doesn’t explain why it boots on my Intel PC. I haven’t tried booting it on a Mac.
> >
> > If you’re saying that the CD is incompatible with qemu because qemu is expecting to see or be emulating Mac HW that doesn’t seem to be the case either since I'm running qemu on a PC (not Mac) and haven’t specified anything in my qemu parameters that might be Mac related.  I’m basically using the setup you provided in your first message for my qemu setup that works to boot up NetBSD CDs.
> >
> > I can understand that the bootx64.efi file on the CD and in the zip file may be different, but again that doesn’t explain why the CD can boot on real HW but not under qemu.
> >
> > I agree the problem probably isn’t in the OVMF code - I’ve tried various files from different sources which work fine in booting disks under qemu, but given similar results trying to boot CDs.
> >
> > -bob
>
> So my question really is why would you actually need the iso file? One
> uses rEFInd when one wants booting multiple operating systems on a
> hardware or a vm with EFI firmware. So you get your EFI hardware, you
> install your first operating system supporting boot from efi, e.g. in
> my example NetBSD-current (but my EFI laptop boots Windows 10, Suse,
> RedHat and NetBSD-current from the internal disks and another 10
> systems from external disks, most of them EFI as well); then provided
> you have left enough disk space, you install the other systems of
> interest, at the end eventually you create the structure for rEFInd,
> edit your refind.conf to describe the desired systems and set the
> rEFInd boot_x64.conf to be the default in the Boot manager. I did
> similar on my laptop, for a couple of years the default .efi file to
> boot was the rEFInd one, until an update to the BIOS code from HP took
> away the option of specifying an individual .efi file as default boot,
> so I have to manually choose the desired system, including rEFInd, on
> system startup.
>
> If it is to have on real hardware, you can always create the structure
> on a small usb stick and choose it in the boot manager.
>
> Chavdar
>
> >
> > On Aug 7, 2020, at 12:10 PM, Chavdar Ivanov <ci4ic4%gmail.com@localhost> wrote:
> >
> > > On Fri, 7 Aug 2020 at 14:21, Robert Nestor <rnestor%mac.com@localhost> wrote:
> > >>
> > >> Thanks again!  Your patience and suggestions have helped a lot and (I think) I have a much better understanding of the whole process now.
> > >>
> > >> As Martin wrote, it appears to be an issue or limitation in qemu with UEFI booting CDs.  Probably that the OVMF code is very specific in where it looks for the UEFI boot files whereas the real implementation (on my PC at least) is much more forgiving.
> > >
> > > I don't think it is anything to do with the OVFM code. If you are
> > > using the same ISO file I tried to use - which hangs on boot - the ISO
> > > file is perfectly readable by the EFI shell. I attached that
> > > refind.iso to the VM and got into the internal efi shell; it can see
> > > the cdrom as fs1:, one can see there the usual file structure -
> > > EFI\boot and EFI\tools. The tools folder contains stuff relevant only
> > > to Apple installations - gdisk etc. - which can be started, but are
> > > not functional. The boot folder contains the necessary boot_x64.efi
> > > file, which is different from the one coming from the zip file; if you
> > > run it, you get a stuck system as when you try to boot from the iso
> > > file. So as far as the iso file I am trying, it is only incompatible
> > > with the qemu machine, expecting to see an Apple hardware perhaps.
> > >
> > > Now if someone has any idea how to configure the mouse in -current to
> > > get it properly running with the wsfb graphics... It kinda works, but
> > > a very small rectangle in the top left corner covers the movement on
> > > the screen.  It may be a problem with the VNS client, of course - mine
> > > is RealVNC under Windows 10 at the moment.
> > >
> > >>
> > >> -bob
> > >>
> > >> On Aug 7, 2020, at 7:02 AM, Chavdar Ivanov <ci4ic4%gmail.com@localhost> wrote:
> > >>
> > >>> On Fri, 7 Aug 2020 at 12:54, Robert Nestor <rnestor%mac.com@localhost> wrote:
> > >>>>
> > >>>> OK, I tried doing this with just the rEFInd CD and it still didn’t boot - just get a blank screen.  Since you did this by copying the rEFInd files over to a bootable NetBSD CD (or did you copy them to an installed NetBSD disk?)  the two CD aren’t configured the same way.  Neither CD has an MSDOS partition/wedge for EFI and I can’t find where the files for UEFI booting are on the NetBSD CD.  My understanding of UEFI is that the boot files must live in an MSDOS/FAT partition, though that doesn’t explain how or why the rEFInd CD boots on real HW via UEFI.
> > >>>
> > >>> As I said, I couldn't do anything with refind.iso either.
> > >>>
> > >>> I created a vm with the UEFI selected, installed yesterday's -current
> > >>> - which, as you know, installs both on BIOS and UEFI. I selected GPT
> > >>> scheme for the disk, this obviously creates a MS-DOS formatted EFI
> > >>> slice, where I later placed the requisite files from rEFInd, edited a
> > >>> bit refind.conf to show the NetBSD menu clearly, rebooted into the
> > >>> boot management environment and set the bootx64.efi from the refind
> > >>> directory to be the primary option. So no iso involvement, the files
> > >>> for the rEFInd tree were copied from the .zip file.
> > >>>
> > >>>>
> > >>>> So I’m even more confused now.
> > >>>>
> > >>>> -bob
> > >>>>
> > >>>> On Aug 7, 2020, at 2:58 AM, Chavdar Ivanov <ci4ic4%gmail.com@localhost> wrote:
> > >>>>
> > >>>>> On Fri, 7 Aug 2020 at 02:35, Robert Nestor <rnestor%mac.com@localhost> wrote:
> > >>>>>>
> > >>>>>> OK, thanks!   I’m not sure I fully understand what you mean by “moved the relevant file to the top”.  Do you mean you moved the \EFI\boot\bootx64.efi file to \EFI\bootx64.efi?
> > >>>>>
> > >>>>> I wrote this too late in the night. I mean I got into the EFI menu
> > >>>>> setup, Boot Management and moved the last entry - for rEFInd - to the
> > >>>>> top; the next entry was the one from the disk, which I can still
> > >>>>> select to boot NetBSD directly.
> > >>>>>
> > >>>>>>
> > >>>>>> There was an old reference I found in my search that seemed to imply this was  a solution, but then I don’t see how the NetBSD CD booted.  Doesn’t it’s bootx64.efi file live in \EFI\boot\bootx64.efi just like it does on the rEFInd CD?
> > >>>>>
> > >>>>> Yes.
> > >>>>>
> > >>>>> nbsdu# mount -t msdos /dev/dk0 /mnt/efi/
> > >>>>> nbsdu# find /mnt/efi/ | egrep -v icons/
> > >>>>> /mnt/efi/
> > >>>>> /mnt/efi/EFI
> > >>>>> /mnt/efi/EFI/boot
> > >>>>> /mnt/efi/EFI/boot/bootia32.efi
> > >>>>> /mnt/efi/EFI/boot/bootx64.efi
> > >>>>> /mnt/efi/EFI/refind
> > >>>>> /mnt/efi/EFI/refind/refind_x64.efi
> > >>>>> /mnt/efi/EFI/refind/refind.conf
> > >>>>> /mnt/efi/EFI/refind/icons
> > >>>>> .......
> > >>>>> /mnt/efi/NvVars
> > >>>>>>
> > >>>>>> -bob
> > >>>>>>
> > >>>>>> On Aug 6, 2020, at 7:26 PM, Chavdar Ivanov <ci4ic4%gmail.com@localhost> wrote:
> > >>>>>>
> > >>>>>>> On Fri, 7 Aug 2020 at 01:11, Chavdar Ivanov <ci4ic4%gmail.com@localhost> wrote:
> > >>>>>>>>
> > >>>>>>>> On Fri, 7 Aug 2020 at 01:05, Robert Nestor <rnestor%mac.com@localhost> wrote:
> > >>>>>>>>>
> > >>>>>>>>> Just dawned on me, I’m betting the NetBSD CD is configured to boot either via BIOS or UEFI and Qemu is probably trying BIOS first since that’s its default.
> > >>>>>>>>
> > >>>>>>>> No, it definitely says that it is booting in EFI mode. if you
> > >>>>>>>> interrupt it and drop to the command prompt, you can see the efivars.
> > >>>>>>>> The graphics is also wsfb and the console looks like the NetBSD
> > >>>>>>>> console after a UEFI boot; X -configure makes the relevant xorg.conf
> > >>>>>>>> file (however, modesetting does not work, one has to change it to
> > >>>>>>>> wsfb; also in my case - over VNC - the mouse driver has to be changed
> > >>>>>>>> to 'ws', although even this way it works incorrectly).
> > >>>>>>>>
> > >>>>>>>> I tried to boot the rEFInd.iso file, I presume the same you've tried -
> > >>>>>>>> of v. 0.12 - and got the same result as you - just the logo in the
> > >>>>>>>> middle of the screen.
> > >>>>>>>>
> > >>>>>>>> I'll install manually rEFInd in the vm I just spun up to see if it can
> > >>>>>>>> be recognized.
> > >>>>>>>
> > >>>>>>> I was able to install rEFInd manually in the efi partition of that
> > >>>>>>> NetBSD installation and boot it under OVMF (I rebooted the machine and
> > >>>>>>> just hit 'escape' in the VNC window, which got me to the EFI setup
> > >>>>>>> menu, where I located the relevant efi file and moved it to the top).
> > >>>>>>>
> > >>>>>>> Chavdar
> > >>>>>>>
> > >>>>>>>>
> > >>>>>>>>>
> > >>>>>>>>> -bob
> > >>>>>>>>>
> > >>>>>>>>> On Aug 6, 2020, at 6:20 PM, Chavdar Ivanov <ci4ic4%gmail.com@localhost> wrote:
> > >>>>>>>>>
> > >>>>>>>>>> With:
> > >>>>>>>>>>
> > >>>>>>>>>>
> > >>>>>>>>>> /usr/pkg/bin/qemu-system-x86_64 \
> > >>>>>>>>>>    -device qemu-xhci \
> > >>>>>>>>>>    -device usb-tablet \
> > >>>>>>>>>>    -machine q35 \
> > >>>>>>>>>>    -bios /usr/pkg/share/ovmf/OVMFX64.fd \
> > >>>>>>>>>>    -m 4096 \
> > >>>>>>>>>>    -k en-gb \
> > >>>>>>>>>>    -smp 2 \
> > >>>>>>>>>>    -accel nvmm \
> > >>>>>>>>>>    -vnc :1 \
> > >>>>>>>>>>    -drive format=raw,file=/dev/zvol/rdsk/pail/testu-new \
> > >>>>>>>>>>    -net tap,fd=3 3<>/dev/tap1 \
> > >>>>>>>>>>    -net nic \
> > >>>>>>>>>>    -cdrom /iso/NetBSD-9.99.69-amd64.iso
> > >>>>>>>>>>
> > >>>>>>>>>>
> > >>>>>>>>>> I was able to boot today's -current in efi mode, no problem.
> > >>>>>>>>>> Obviously, I access the console over vnc.
> > >>>>>>>>>>
> > >>>>>>>>>> Chavdar
> > >>>>>>>>>>
> > >>>>>>>>>> On Thu, 6 Aug 2020 at 23:33, Robert Nestor <rnestor%mac.com@localhost> wrote:
> > >>>>>>>>>>>
> > >>>>>>>>>>> Something simple I must be missing here.  I downloaded the CD image of rEFInd from:
> > >>>>>>>>>>>    http://sourceforge.net/projects/refind/files/0.12.0/refind-cd-0.12.0.zip/download
> > >>>>>>>>>>>
> > >>>>>>>>>>> Burned it to a CD and tried booting that CD on my PC.  It doesn’t boot using BIOS, but it does boot using UEFI.  So I know the CD is good.  I saved the ISO file that I used to burn the CD.
> > >>>>>>>>>>>
> > >>>>>>>>>>> Tried booting the ISO file in qemu with:
> > >>>>>>>>>>>    qemu-system-x86_64 -boot d -cdrom refind.iso -m 512
> > >>>>>>>>>>>
> > >>>>>>>>>>> And got an error that it couldn’t boot with error code 0009.  Ok this appears to mean that qemu tried booting it with a default BIOS boot which the CD isn’t configured for. The recommended solution is to either add the BIOS boot code to the CD or specify a OVMF/UEFI boot file to Qemu.
> > >>>>>>>>>>>
> > >>>>>>>>>>> Installed the OVMF package and tried booting again with:
> > >>>>>>>>>>>    qmeu-system-x86_64 -bios /usr/pkg/share/ovmf/OVMFX64.bin —m 512 \
> > >>>>>>>>>>>           -boot d -cdrom refind.iso
> > >>>>>>>>>>>
> > >>>>>>>>>>> Got the Tianocore splash screen then the UEFI shell.  Entered “exit” at the shell prompt and got a message "Graphics Console Started" and then nothing.  Also tried the OVMFIA32.fd file with identical results.  Adding “-vga std” to the command line didn’t change things either.
> > >>>>>>>>>>>
> > >>>>>>>>>>> For grins I added “-accel mvmm” to the command line and got the error:
> > >>>>>>>>>>>    Failed to execute a VCPU
> > >>>>>>>>>>>
> > >>>>>>>>>>> So I have three questions:  First, what am I missing to get this bootable CD to boot up in qemu?  And second, is there a limitation in NVMM that prevents it from running this boot sequence? And finally, if I get the magic sequence that allows the CD to boot with qemu, is there a way of booting without getting the UEFI shell prompt?
> > >>>>>>>>>>>
> > >>>>>>>>>>> Thanks
> > >>>>>>>>>>
> > >>>>>>>>>>
> > >>>>>>>>>>
> > >>>>>>>>>> --
> > >>>>>>>>>> ----
> > >>>>>>>>>
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>> --
> > >>>>>>>> ----
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> --
> > >>>>>>> ----
> > >>>>>>
> > >>>>>
> > >>>>>
> > >>>>> --
> > >>>>> ----
> > >>>>
> > >>>
> > >>>
> > >>> --
> > >>> ----
> > >>
> > >
> > >
> > > --
> > > ----
> >
>
>
> --
> ----



-- 
----


Home | Main Index | Thread Index | Old Index