Re: bhyve: bootindex= not working?
- Reply: Dave Cottlehuber: "Re: bhyve: bootindex= not working?"
- In reply to: Roman Bogorodskiy : "bhyve: bootindex= not working?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 May 2025 06:01:11 UTC
On Sun, 2025-05-25 at 13:14 +0200, Roman Bogorodskiy wrote: > Hi, > > I'm trying to understand how to use bootindex= configuration for disk > devices. > > I start with a fresh copy of the VARs file: > > sudo cp /usr/local/share/uefi-firmware/BHYVE_UEFI_VARS.fd > /data/vars/freebsd_VARS.fd > > Then start a VM: > > sudo bhyve -c 2 -m 4096 -A -I -u -H -P > \                                           > -s 0:0,hostbridge \ > -l bootrom,/usr/local/share/uefi- > firmware/BHYVE_UEFI.fd,/data/vars/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 5:0,fbuf,tcp=127.0.0.1:5920 -l com1,/dev/nmdm5A \ > freebsd > > With this configuration I expect it to boot from the "hd" device. Instead, it > boots into the installer. > > In the installer I see: > > # efibootmgr -v > Boot to FW : false > BootCurrent: 0001 > Timeout   : 0 seconds > BootOrder : 0000, 0001, 0002, 0003 >  Boot0000* UiApp Fv(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21- > 7614-4503-836e-8ab6f4662331) > +Boot0001* UEFI BHYVE SATA DVD ROM BHYVE-6057-BC56-DB6C > PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x1,0xffff,0x0) >  Boot0002* UEFI BHYVE SATA DISK BHYVE-412B-5D46-BC34 > PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xffff,0x0) >  Boot0003* EFI Internal Shell Fv(7cb8bdc9-f8eb-4f34-aaea- > 3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1) > > > Unreferenced Variables: > # > > I thought maybe it doesn't pay attention to bootindex= when the VARs > file is specified, so I tried like this: > > sudo bhyve -c 2 -m 4096 -A -I -u -H -P \ > -s 0:0,hostbridge \ > -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.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 5:0,fbuf,tcp=127.0.0.1:5920 -l com1,/dev/nmdm5A \ > freebsd > > Result is the same. > > Also, instead of this: > > -s 3:0,ahci,hd:/data/img/freebsd.img,bootindex=1,cd:/data/isos/FreeBSD-14.2- > RELEASE-amd64-disc1.iso,bootindex=2 \ > > I've tried: > > -s 3:0,ahci-hd,/data/img/freebsd.img,bootindex=1 -s 4:0,ahci- > cd,/data/isos/FreeBSD-14.2-RELEASE-amd64-disc1.iso,bootindex=2 \ > > No difference. > > No, going back to the very first command I used. In the installer's > shell, I execute: > > # efibootmgr -o 0002 > Boot to FW : false > BootCurrent: 0001 > Timeout   : 0 seconds > BootOrder : 0002 >  Boot0002* UEFI BHYVE SATA DISK BHYVE-412B-5D46-BC34 > # > > And reboot. It boots from the disk now, according to the configuration: > > root@freebsd:~ # efibootmgr -v > Boot to FW : false > BootCurrent: 0002 > Timeout   : 0 seconds > BootOrder : 0002, 0000, 0001, 0003 > +Boot0002* UEFI BHYVE SATA DISK BHYVE-412B-5D46-BC34 > PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xffff,0x0) >  Boot0000* UiApp Fv(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21- > 7614-4503-836e-8ab6f4662331) >  Boot0001* UEFI BHYVE SATA DVD ROM BHYVE-6057-BC56-DB6C > PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x1,0xffff,0x0) >  Boot0003* EFI Internal Shell Fv(7cb8bdc9-f8eb-4f34-aaea- > 3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1) > > > Unreferenced Variables: > root@freebsd:~ # > > Now, if I swap the bootindex= values to force to boot from the CD, it > also has no effect, from now on it'll be booting from the disk. > > All in all, it looks like it stores boot options in the VARS file > properly, but completely ignores the bootindex command line > configuration. > > Is it a bug somewhere or am I doing something wrong? > > I'm running 15.0-CURRENT ~1 month old and edk2-bhyve-g202308_5. > Guest is FreeBSD 14.2-RELEASE. > > Thanks, > Roman > Hi Roman, EDKII honors bootindex since 202408 [1]. So, our latest EDKII port, based on 202308, is too old. [1] https://github.com/tianocore/edk2/commit/ffce430d2b65d508a1604dc986ba16db3583943d -- Kind regards, Corvin