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

Reply via email to