Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 May 2025 16:22:50 +0200
From:      Roman Bogorodskiy <novel@freebsd.org>
To:        Dave Cottlehuber <dch@skunkwerks.at>
Cc:        Corvin =?iso-8859-1?Q?K=F6hne?= <corvink@freebsd.org>, virtualization@freebsd.org
Subject:   Re: bhyve: bootindex= not working?
Message-ID:  <aDR5Oju38MMDrrPn@tulp>
In-Reply-To: <8d1dfffb-7c81-48fc-aba3-fda3e0228b41@app.fastmail.com>
References:  <aDL7fQR2nhjH_RmL@tulp> <7378d313b05a5504e1554b5d43b4433f2fce2ff7.camel@FreeBSD.org> <8d1dfffb-7c81-48fc-aba3-fda3e0228b41@app.fastmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

  Dave Cottlehuber wrote:

> On Mon, 26 May 2025, at 06:01, Corvin Köhne wrote:
> 
> > Hi Roman,
> >
> > EDKII honors bootindex since 202408 [1]. So, our latest EDKII port, based on
> > 202308, is too old.
> 
> Thanks Corvin
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285554 has a patch for this, bringing it up to 202502.
> 
> Roman can you let us know if this works for you?
> 
> A+
> Dave

I've updated the port to 202505 using patch from that PR. At the first
glance, nothing's changed.

Command I run:

bhyve -c 2 -m 4096 -A -I -u -H -P \
-s 0:0,hostbridge \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd,/var/lib/libvirt/bhyve/nvram/freebsd_VARS.fd,fwcfg=qemu \
-s 2:0,xhci,tablet -s 1:0,lpc \
-s 3:0,ahci,hd:/data/img/freebsd.img,bootindex=1,cd:/data/isos/FreeBSD-14.2-RELEASE-amd64-disc1.iso,bootindex=2 \
-s 4:0,virtio-net,tap4,mac=52:54:00:47:f4:dc -s 5:0,fbuf,tcp=127.0.0.1:5920 \
-l com1,/dev/nmdm5A \
freebsd

It still boots from the "cd" device, not from "hd" as expected. Before
running the VM, I've re-created
/var/lib/libvirt/bhyve/nvram/freebsd_VARS.fd from the fresh copy.

Just to make sure:

$ pkg which /usr/local/share/uefi-firmware/BHYVE_UEFI.fd
/usr/local/share/uefi-firmware/BHYVE_UEFI.fd was installed by package edk2-bhyve-g202505
$

That's what I see in the VM's console log:

BdsDxe: loading Boot0001 "UEFI BHYVE SATA DVD ROM BHYVE-6057-BC56-DB6C" from PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x1,0xFFFF,0x0)                                                                                                                                             
BdsDxe: starting Boot0001 "UEFI BHYVE SATA DVD ROM BHYVE-6057-BC56-DB6C" from PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x1,0xFFFF,0x0)                                                                                                                                            
Consoles: EFI console                                                                                                                                                                                                                                                   
    Reading loader env vars from /efi/freebsd/loader.env                                                                                                                                                                                                                
Setting currdev to cd1:                                                                                                                                                                                                                                                 
FreeBSD/amd64 EFI loader, Revision 3.0                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                        
   Command line arguments: loader.efi                                                                                                                                                                                                                                   
   Image base: 0xbe252000                                                                                                                                                                                                                                               
   EFI version: 2.70                                                                                                                                                                                                                                                    
   EFI Firmware: BHYVE (rev 1.00)                                                                                                                                                                                                                                       
   Console: efi (0x20001000)                                                                                                                                                                                                                                            
   Load Path: \EFI\BOOT\BOOTX64.EFI                                                                                                                                                                                                                                     
   Load Device: PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x1,0xFFFF,0x0)/CDROM(0x1)                                                                                                                                                                                               
   BootCurrent: 0001                                                                                                                                                                                                                                                    
   BootOrder: 0000 0001[*] 0002                                                                                                                                                                                                                                         
   BootInfo Path: PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x1,0xFFFF,0x0)                                                                                                                                                                                                        
Ignoring Boot0001: Only one DP found                                                                                                                                                                                                                                    
Trying ESP: PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x1,0xFFFF,0x0)/CDROM(0x1)                                                                                                                                                                                                   
Setting currdev to cd1:                                                                                                                                                                                                                                                 
Trying: PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x1,0xFFFF,0x0)/CDROM(0x0)                                                                                                                                                                                                       
Setting currdev to cd0:                                                                                                                                                                                                                                                 
Loading /boot/defaults/loader.conf        

Again, when I run "efibootmgr -o 0002", then I see:

BdsDxe: loading Boot0002 "UEFI BHYVE SATA DISK BHYVE-412B-5D46-BC34" from PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)
BdsDxe: starting Boot0002 "UEFI BHYVE SATA DISK BHYVE-412B-5D46-BC34" from PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)
Consoles: EFI console  
    Reading loader env vars from /efi/freebsd/loader.env
Setting currdev to disk0p1:
FreeBSD/amd64 EFI loader, Revision 3.0

   Command line arguments: loader.efi
   Image base: 0xbe252000
   EFI version: 2.70
   EFI Firmware: BHYVE (rev 1.00)
   Console: efi (0x20001000)
   Load Path: \EFI\BOOT\BOOTX64.EFI
   Load Device: PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)/HD(1,GPT,88BF7344-316E-11F0-986D-87D32D3EC81F)
   BootCurrent: 0002
   BootOrder: 0002[*] 0000 0001
   BootInfo Path: PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)
Ignoring Boot0002: Only one DP found
Trying ESP: PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)/HD(1,GPT,88BF7344-316E-11F0-986D-87D32D3EC81F)
Setting currdev to disk0p1:
Trying: PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)/HD(2,GPT,88BFF6FB-316E-11F0-986D-87D32D3EC81F)
Setting currdev to disk0p2:
Loading /boot/defaults/loader.conf

Thanks,
Roman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aDR5Oju38MMDrrPn>