Date: Mon, 26 May 2025 08:01:11 +0200 From: Corvin =?ISO-8859-1?Q?K=F6hne?= <corvink@FreeBSD.org> To: Roman Bogorodskiy <novel@freebsd.org>, virtualization@freebsd.org Subject: Re: bhyve: bootindex= not working? Message-ID: <7378d313b05a5504e1554b5d43b4433f2fce2ff7.camel@FreeBSD.org> In-Reply-To: <aDL7fQR2nhjH_RmL@tulp> References: <aDL7fQR2nhjH_RmL@tulp>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] 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 [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgvRSla3m2t/H2U9G2FTaVjFeAmoFAmg0A6cACgkQ2FTaVjFe Ampp0BAAw0S4mnIxmRCNAyMHNkEHyN6YLQ/xrF/BOFeLpZxVVPRrVWm2dFL4odIL qErkBXRqwMcPU31hGh9Yy7yVvMWD+HmvgrzMQYV1WuiZUPP5HJ1cZ8pqXP2d/tOJ 2/0KfyfwSuXmPyilwargNX7rqpmcpllFpJLs602z9Bcj+XGk9ZUOUK79+oDxCHR/ oUQ7ExaQ+Eab1M681fgTXAxlt6cat5GtnRFIgKwaeBpb+vX5UNk3BRw6cfIlNaBQ OnStMLzSwt3vRlWh6YnyQ4OfgusBS5d9Sa91ohyvDSArB2W0J/u3ZxsIsUxKTsnz XQt+40hgVHOI7GSQfl0u4PqrC/hhRnU9d/iZFO/JcGuN8/+m9hAH328inKz1lMu3 ikEsnz7U6eS3nTM8bcw/x1otrNCBa55iOMqw09lq4hsGUs9c8JwWu/Tvl3WQ3DPa dkDXdgCs5rne4apqKJ5IOQXlBuM0nZg1z9sHNj0ANdzFlaBDfDLzG4WS4pXv04iq 4OsXNsqYVeLWq6LzbkZ9YkCZ4gag+Ycb8UpFGJJwoYj9WVbAU7AwjfhMfPpK3vpW 38YUU9/ERCm8Fbmgbn94pJ9MivO5/hdQU+vChBEJB1xvjKj79zWtYIQscbs1hMN9 vcuGDI770ZZ+ma02w3fbeuZKWF6BF8eyRjhuqG83StNsre9Px+Q= =Lq4u -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7378d313b05a5504e1554b5d43b4433f2fce2ff7.camel>
