A simple UEFI-based tool that enumerates PCI devices in the system.
This project is intended for enumerating PCI devices in the system without any interferences from OS.
You will need to setup the following pre-requisites:
- Mount EWDK11-26100 with VS Build Tools 17.8.6 to V: drive. You may use WinCDEmu to mount ISO images.
- Install Python 3. The minimum version of Python must be 3.9.
- Install Git for Windows.
- Install mtools. You need to extract these files and put them in
PATHvariable. - Install QEMU for Windows. This is intended for converting disk images.
- Clone EDK-II-Library and build
MdePkglibraries. You need to add the git repository path toEDK2_PATHenvironment variable.
Hopefully the following commands can help you setup and build EDK2.
git clone https://github.com/Zero-Tang/EDK-II-Library.git
cd EDK-II-Library
git config --global core.longpaths true
git submodule update --init --recursive
python make_script.py prep MdePkg MdePkg
python make_script.py build MdePkg MdePkg Checked
You may execute build.bat in order to build the EFI executable and disk images. You need Internet access in order to fetch latest PCI-ID list.
bootx64.efiis the EFI executable.UefiEnumPciDevices.imgis a raw disk image. You may use it on QEMU.UefiEnumPciDevices.img.vmdkis a VMDK disk image. You may use it on VMware.
This tool is remastered with Rust. However, there still are pre-requisites to be done:
- Install Rust. You must also ensure you have installed UEFI-related target toolchain.
rustup target add x86_64-unknown-uefi - Install Python 3. The minimum version of Python must be 3.9.
- Install mtools. You need to extract these files and put them in
PATHvariable. - Install QEMU for Windows. This is intended for converting disk images.
You may execute build-rs.bat in order to build the EFI executable and disk images. You need Internet access in order to fetch latest PCI-ID list.
enum-pci-devices.efiis the EFI executable.UefiEnumPciDevices.imgis a raw disk image. You may use it on QEMU.UefiEnumPciDevices.img.vmdkis a VMDK disk image. You may use it on VMware.
There are several ways to run this project.
To run this project on a real machine, you need to prepare a USB flash stick, setup GUID Partition Table (GPT) and format with FAT32 file system.
Then create EFI\BOOT folders and put bootx64.efi into it.
Output will be written to output.txt in the root folder of your USB flash stick.
To run this project on QEMU for Windows, you may execute run_qemu.bat. This script will build this project and run QEMU.
Output will be written to output.txt in this repository.
You will need to use OVMF as the UEFI Firmware for QEMU VM.
This is an rpm package. You may use 7-zip to extract its contents. You need to place OVMF-pure-efi.fd into this repository.
To run this project on QEMU+KVM from a Linux machine (or WSL2), you need to setup additional packages than QEMU itself. For example, in Ubuntu/Debian-based systems:
sudo apt install mtools ovmf
Then run QEMU:
qemu-system-x86_64 -accel kvm -machine q35 -bios /usr/share/ovmf/OVMF.fd -cpu host -drive format=raw,media=disk,file=UefiEnumPciDevices.img
Append additional arguments according to your needs.
Extract the output:
mcopy -i UefiEnumPciDevices.img ::/output.txt output.txt
To run this project on VMware Workstation, you need to add UefiEnumPciDevices.img.vmdk file to your VM as a hard drive. Do not upgrade the file version when VMware prompts you.
Then execute extract.bat to extract the output.
This project is licensed under the MIT License.