Load NVMe Driver in UEFI Shell

Months ago I bought an HP Z620 as a Hyper-V server at home. One day, I fond that my 500GB 860EVO SSD was almost full. Considering the factors of price, performance, and capacity, I decided to purchase a 2TB Intel DC P4500 SSD. However, after installing the SSD, I found that it was not recognized in the BIOS. After some research on Google, I discovered that although this workstation supports UEFI, it does not support NVMe SSDs. Therefore, I had to use some intermediate tools to boot the system from the NVMe SSD.

The simplest method was to use Clover Bootloader. Although this tool is primarily used for booting hackintosh, it can also be used as a general-purpose bootloader. It automatically searches for partitions and is quite user-friendly. However, when I was preparing to switch to ESXi for the server, I found that Clover couldn’t automatically detect the system. I didn’t want to manually write a custom entry (XML coding is really not user-friendly), so I decided to find another solution.

After some Google search, I found that UEFI itself supports loading drivers, so using UEFI Shell should solve the problem. First, I created an ESP partition on the GPT disk recognized by the BIOS. Then, I copied the UEFI Shell and NVMe drivers to the partition and created a startup.nsh file in the root directory, with the following content:

1
2
3
4
load -nc fs0:\NvmExpressDxe-64.efi
connect -r
map -u
fs1:\EFI\BOOT\BOOTX64.EFI

The content of the script is easy to understand, so I won’t explain it :)

Then, use the “efibootmgr” command, or use related tools in Windows PE, to create a boot entry with the executable file being the EFI Shell in that partition, and set it as the default. As for the partition and path aspect mentioned in the script, they may vary on each machine. You can directly enter the UEFI Shell, load the drivers, and then use the “map” command to check the path of the NVMe disk that needs to be bootable.


References

  1. [Guide] NVMe-boot without modding your UEFI/BIOS (Clover-EFI bootloader method)
  2. UEFI Shell Specification
  3. Error-handling in EFI startup shell scripts - Super User
comments powered by Disqus
Except where otherwise noted, content on this blog is licensed under CC-BY 2.0.
Built with Hugo
Theme Stack designed by Jimmy