Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

efibootmngr issue when running VMs with many NICs. #199

Open
cesargithedgehog opened this issue Oct 23, 2024 · 10 comments
Open

efibootmngr issue when running VMs with many NICs. #199

cesargithedgehog opened this issue Oct 23, 2024 · 10 comments
Assignees

Comments

@cesargithedgehog
Copy link
Contributor

No description provided.

@cesargithedgehog cesargithedgehog self-assigned this Oct 23, 2024
@cesargithedgehog
Copy link
Contributor Author

efibootmgr failed to create new boot variable on /dev/vda

It's in the sonic installer that we're getting from BCM - one caveat - there are about 50 NICs on it.

ONIE:/ # efibootmgr                     
BootCurrent: 0002                       
Timeout: 0 seconds                      
BootOrder: 0009,0000,0002,0008,0001,0003,0004,0005,0006,0007,000A,000B,000C,000D,000E,000F,0010,0011,0012,0013,0014,0015,0016,0017,0018,0019,001A,001B,001C,001D,001E,001F
,0020,0021,0022,0023,0024,0025,0026,0027,0028,0029,002A,002B,002C,002D,002E,002F,0030,0031,0032,0033,0034,0035,0036,0037,0038,0039,003A,003B,003C,003D,003E,003F,0040,0041
,0042,0043,0044,0045,0046,0047,0048,0049,004A,004B,004C,004D,004E,004F,0050,0051,0052,0053,0054,0055,0056,0057,0058,0059,005A,005B,005C,005D,005E,005F,0060,0061,0062,0063
,0064,0065,0066,0067,0068,0069,006A,006B,006C,006D,006E,006F,0070,0071,0072,0073,0074,0075,0076,0077                                                                      
Boot0000* UiApp                         
Boot0001* UEFI QEMU DVD-ROM QM00005     
Boot0002* UEFI Misc Device              
Boot0003* UEFI HTTPv6 (MAC:0C2012FF3000)
Boot0004* UEFI HTTPv4 (MAC:0C2012FF3000)
Boot0005* UEFI PXEv4 (MAC:0C2012FF3000) 
Boot0006* UEFI PXEv6 (MAC:0C2012FF3000) 
Boot0007* UEFI HTTPv6 (MAC:0C2012FE7901)
Boot0008* EFI Internal Shell            
Boot0009* ONIE: Open Network Install Environment                                     
Boot000A* UEFI HTTPv4 (MAC:0C2012FE7901)
Boot000B* UEFI PXEv4 (MAC:0C2012FE7901) 
Boot000C* UEFI PXEv6 (MAC:0C2012FE7901) 
Boot000D* UEFI HTTPv6 (MAC:0C2012FE7902)
Boot000E* UEFI HTTPv4 (MAC:0C2012FE7902)
Boot000F* UEFI PXEv4 (MAC:0C2012FE7902) 
Boot0010* UEFI PXEv6 (MAC:0C2012FE7902) 
Boot0011* UEFI HTTPv6 (MAC:0C2012FE7903)
Boot0012* UEFI HTTPv4 (MAC:0C2012FE7903)

@cesargithedgehog
Copy link
Contributor Author

Sending data from UEFI to OS through UEFI variables:

https://davysouza.medium.com/sending-data-from-uefi-to-os-through-uefi-variables-b4f9964e1883

@cesargithedgehog
Copy link
Contributor Author

Task:

Check if it is possible to disable the auto-addition of NICs into the EFI boot order.

@cesargithedgehog
Copy link
Contributor Author

Script used for local testing

sudo qemu-system-x86_64 -machine q35,accel=kvm,smm=on -cpu host -smp 4 \
-m 5120M \
-cpu host \
-drive if=pflash,format=raw,readonly=on,unit=0,file=/home/uefi-bios/x86/OVMF_CODE.fd \
-drive if=pflash,format=raw,unit=1,file=/home/uefi-bios/x86/OVMF_VARS.fd \
-drive file=/home/emulation-files/onie-kvm_x86_64-demo.qcow2,media=disk,if=virtio,index=0 \
-usb -device usb-host,hostbus=3,hostaddr=8 \
-device i82801b11-bridge,id=dmi-pci-bridge \
-device pci-bridge,id=bridge1,chassis_nr=1,bus=dmi-pci-bridge \
-device pci-bridge,id=bridge2,chassis_nr=2,bus=dmi-pci-bridge \
-device pci-bridge,id=bridge3,chassis_nr=3,bus=dmi-pci-bridge \
-device pci-bridge,id=bridge4,chassis_nr=4,bus=dmi-pci-bridge \
-device pci-bridge,id=bridge5,chassis_nr=5,bus=dmi-pci-bridge \
\
-netdev tap,id=hostnet0,ifname=tap0,script=no,downscript=no \
-netdev tap,id=hostnet1,ifname=tap1,script=no,downscript=no \
-netdev tap,id=hostnet2,ifname=tap2,script=no,downscript=no \
-netdev tap,id=hostnet3,ifname=tap3,script=no,downscript=no \
-netdev tap,id=hostnet4,ifname=tap4,script=no,downscript=no \
-netdev tap,id=hostnet5,ifname=tap5,script=no,downscript=no \
-netdev tap,id=hostnet6,ifname=tap6,script=no,downscript=no \
-netdev tap,id=hostnet7,ifname=tap7,script=no,downscript=no \
-netdev tap,id=hostnet8,ifname=tap8,script=no,downscript=no \
-netdev tap,id=hostnet9,ifname=tap9,script=no,downscript=no \
-netdev tap,id=hostnet10,ifname=tap10,script=no,downscript=no \
-netdev tap,id=hostnet11,ifname=tap11,script=no,downscript=no \
-netdev tap,id=hostnet12,ifname=tap12,script=no,downscript=no \
-netdev tap,id=hostnet13,ifname=tap13,script=no,downscript=no \
-netdev tap,id=hostnet14,ifname=tap14,script=no,downscript=no \
-netdev tap,id=hostnet15,ifname=tap15,script=no,downscript=no \
-netdev tap,id=hostnet16,ifname=tap16,script=no,downscript=no \
-netdev tap,id=hostnet17,ifname=tap17,script=no,downscript=no \
-netdev tap,id=hostnet18,ifname=tap18,script=no,downscript=no \
-netdev tap,id=hostnet19,ifname=tap19,script=no,downscript=no \
-netdev tap,id=hostnet20,ifname=tap20,script=no,downscript=no \
-netdev tap,id=hostnet21,ifname=tap21,script=no,downscript=no \
-netdev tap,id=hostnet22,ifname=tap22,script=no,downscript=no \
-netdev tap,id=hostnet23,ifname=tap23,script=no,downscript=no \
-netdev tap,id=hostnet24,ifname=tap24,script=no,downscript=no \
-netdev tap,id=hostnet25,ifname=tap25,script=no,downscript=no \
-netdev tap,id=hostnet26,ifname=tap26,script=no,downscript=no \
-netdev tap,id=hostnet27,ifname=tap27,script=no,downscript=no \
-netdev tap,id=hostnet28,ifname=tap28,script=no,downscript=no \
-netdev tap,id=hostnet29,ifname=tap29,script=no,downscript=no \
-netdev tap,id=hostnet30,ifname=tap30,script=no,downscript=no \
-netdev tap,id=hostnet31,ifname=tap31,script=no,downscript=no \
-netdev tap,id=hostnet32,ifname=tap32,script=no,downscript=no \
-netdev tap,id=hostnet33,ifname=tap33,script=no,downscript=no \
-netdev tap,id=hostnet34,ifname=tap34,script=no,downscript=no \
-netdev tap,id=hostnet35,ifname=tap35,script=no,downscript=no \
-netdev tap,id=hostnet36,ifname=tap36,script=no,downscript=no \
-netdev tap,id=hostnet37,ifname=tap37,script=no,downscript=no \
-netdev tap,id=hostnet38,ifname=tap38,script=no,downscript=no \
-netdev tap,id=hostnet39,ifname=tap39,script=no,downscript=no \
-netdev tap,id=hostnet40,ifname=tap40,script=no,downscript=no \
-netdev tap,id=hostnet41,ifname=tap41,script=no,downscript=no \
-netdev tap,id=hostnet42,ifname=tap42,script=no,downscript=no \
-netdev tap,id=hostnet43,ifname=tap43,script=no,downscript=no \
-netdev tap,id=hostnet44,ifname=tap44,script=no,downscript=no \
-netdev tap,id=hostnet45,ifname=tap45,script=no,downscript=no \
-netdev tap,id=hostnet46,ifname=tap46,script=no,downscript=no \
-netdev tap,id=hostnet47,ifname=tap47,script=no,downscript=no \
-netdev tap,id=hostnet48,ifname=tap48,script=no,downscript=no \
-netdev tap,id=hostnet49,ifname=tap49,script=no,downscript=no \
-netdev tap,id=hostnet50,ifname=tap50,script=no,downscript=no \
\
-device e1000,netdev=hostnet0,bus=bridge1,addr=0x1 \
-device e1000,netdev=hostnet1,bus=bridge1,addr=0x2.0 \
-device e1000,netdev=hostnet2,bus=bridge1,addr=0x3.0 \
-device e1000,netdev=hostnet3,bus=bridge1,addr=0x4.0 \
-device e1000,netdev=hostnet4,bus=bridge1,addr=0x5.0 \
-device e1000,netdev=hostnet5,bus=bridge1,addr=0x6.0 \
-device e1000,netdev=hostnet6,bus=bridge1,addr=0x7.0 \
-device e1000,netdev=hostnet7,bus=bridge1,addr=0x8.0 \
-device e1000,netdev=hostnet8,bus=bridge1,addr=0x9.0 \
-device e1000,netdev=hostnet9,bus=bridge1,addr=0xa.0 \
-device e1000,netdev=hostnet10,bus=bridge1,addr=0xb.0 \
-device e1000,netdev=hostnet11,bus=bridge1,addr=0xc.0 \
-device e1000,netdev=hostnet12,bus=bridge2,addr=0x1.0 \
-device e1000,netdev=hostnet13,bus=bridge2,addr=0x2.0 \
-device e1000,netdev=hostnet14,bus=bridge2,addr=0x3.0 \
-device e1000,netdev=hostnet15,bus=bridge2,addr=0x4.0 \
-device e1000,netdev=hostnet16,bus=bridge2,addr=0x5.0 \
-device e1000,netdev=hostnet17,bus=bridge2,addr=0x6.0 \
-device e1000,netdev=hostnet18,bus=bridge2,addr=0x7.0 \
-device e1000,netdev=hostnet19,bus=bridge2,addr=0x8.0 \
-device e1000,netdev=hostnet20,bus=bridge2,addr=0x9.0 \
-device e1000,netdev=hostnet21,bus=bridge2,addr=0xa.0 \
-device e1000,netdev=hostnet22,bus=bridge2,addr=0xb.0 \
-device e1000,netdev=hostnet23,bus=bridge2,addr=0xc.0 \
-device e1000,netdev=hostnet24,bus=bridge3,addr=0x1.0 \
-device e1000,netdev=hostnet25,bus=bridge3,addr=0x2.0 \
-device e1000,netdev=hostnet26,bus=bridge3,addr=0x3.0 \
-device e1000,netdev=hostnet27,bus=bridge3,addr=0x4.0 \
-device e1000,netdev=hostnet28,bus=bridge3,addr=0x5.0 \
-device e1000,netdev=hostnet29,bus=bridge3,addr=0x6.0 \
-device e1000,netdev=hostnet30,bus=bridge3,addr=0x7.0 \
-device e1000,netdev=hostnet31,bus=bridge3,addr=0x8.0 \
-device e1000,netdev=hostnet32,bus=bridge3,addr=0x9.0 \
-device e1000,netdev=hostnet33,bus=bridge3,addr=0xa.0 \
-device e1000,netdev=hostnet34,bus=bridge3,addr=0xb.0 \
-device e1000,netdev=hostnet35,bus=bridge3,addr=0xc.0 \
-device e1000,netdev=hostnet36,bus=bridge4,addr=0x1.0 \
-device e1000,netdev=hostnet37,bus=bridge4,addr=0x2.0 \
-device e1000,netdev=hostnet38,bus=bridge4,addr=0x3.0 \
-device e1000,netdev=hostnet39,bus=bridge4,addr=0x4.0 \
-device e1000,netdev=hostnet40,bus=bridge4,addr=0x5.0 \
-device e1000,netdev=hostnet41,bus=bridge4,addr=0x6.0 \
-device e1000,netdev=hostnet42,bus=bridge4,addr=0x7.0 \
-device e1000,netdev=hostnet43,bus=bridge4,addr=0x8.0 \
-device e1000,netdev=hostnet44,bus=bridge4,addr=0x9.0 \
-device e1000,netdev=hostnet45,bus=bridge4,addr=0xa.0 \
-device e1000,netdev=hostnet46,bus=bridge4,addr=0xb.0 \
-device e1000,netdev=hostnet47,bus=bridge4,addr=0xc.0 \
-device e1000,netdev=hostnet48,bus=bridge5,addr=0x1.0 \
-device e1000,netdev=hostnet49,bus=bridge5,addr=0x2.0 \
-device e1000,netdev=hostnet50,bus=bridge5,addr=0x3.0 \
\
-nographic -serial telnet:localhost:9300,server

obs: usb -device usb-host,hostbus=3,hostaddr=8

$lsusb
Bus 003 Device 008: ID 0XXX:XXXX SanDisk Corp. Cruzer Blade

@cesargithedgehog
Copy link
Contributor Author

How to Build OVMF (CODE and VARS) using EDK2

The Open Virtual Machine Firmware (OVMF) project aims to support firmware for Virtual Machines using the edk2 code base.

1 - Getting Started with EDK II

Follow the steps described at https://github.com/tianocore/tianocore.github.io/wiki/Using-EDK-II-with-Native-GCC:

Some dependencies:
$ sudo apt install build-essential uuid-dev iasl git nasm python-is-python3

Cloning edk2:
$ git clone https://github.com/tianocore/edk2

Initialize submodules:

$ cd edk2
$ git submodule update --init

Compile build tools:

$ make -C BaseTools
$ ./edksetup.sh

Setup build shell environment:

$ export EDK_TOOLS_PATH=$HOME/src/edk2/BaseTools
$ ./edksetup.sh BaseTools

Modify Conf Files - edk2/Conf/target.txt:

ACTIVE_PLATFORM = EmulatorPkg/EmulatorPkg.dsc
TOOL_CHAIN_TAG  = GCC114
TARGET_ARCH     = X64

Modify EmulatorPkg Files - edk2/EmulatorPkg/EmulatorPkg.dsc:

#
# Network definition
#
DEFINE NETWORK_SNP_ENABLE       = FALSE
DEFINE NETWORK_IP6_ENABLE       = FALSE
DEFINE NETWORK_TLS_ENABLE       = FALSE
DEFINE NETWORK_HTTP_BOOT_ENABLE = FALSE
DEFINE NETWORK_HTTP_ENABLE      = FALSE
DEFINE NETWORK_ISCSI_ENABLE     = FALSE
DEFINE SECURE_BOOT_ENABLE       = FALSE

Note:

$gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

Once you have modified Conf/target.txt and EmulatorPkg/EmulatorPkg.dsc, you can run the build command:

$ cd edk2/OvmfPkg
$ ./build.sh

If successful, you should now have an OVMF.Fd file under the Build sub-directory. The exact directory under the Build directory will depend upon the toolchain, dsc, and processor architecture:

$cd edk2/Build/OvmfX64/DEBUG_GCC5/FV/
$ ls
OVMF.fd
OVMF_VARS.fd

Files used in hhfab/vlab:

OVMF.fd = onie_efi_code.fd
OVMF_VARS.fd = onie_efi_vars.fd
onie-kvm_x86_64.qcow2 - To generate this file, follow the procedure described at https://github.com/githedgehog/onie_kvm.

References:
https://github.com/tianocore/tianocore.github.io/wiki/Getting-Started-with-EDK-II
https://github.com/tianocore/tianocore.github.io/wiki/How-to-build-OVMF
https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
http://www.tianocore.org/ovmf/
https://github.com/tianocore/
https://github.com/tianocore/tianocore.github.io/wiki/Training
https://github.com/tianocore/tianocore.github.io/wiki/UEFI-EDKII-Learning-Dev

@cesargithedgehog
Copy link
Contributor Author

Task completed:

7e50527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant