Step 1 Enabling PCIe】
By default the PCIe connector is not enabled. To enable it you should add the following option into /boot/firmware/config.txt and reboot:
# Enable the PCIe External connector.
dtparam=pciex1
A more memorable alias for pciex1 exists, so you can alternatively add dtparam=nvme to the /boot/firmware/config.txt file.
NOTE
Enumeration of PCIe devices behind a switch is not currently supported.
Step 2 PCIe Gen 3.0】
The connection is certified for Gen 2.0 speeds (5 GT/sec), but you can force it to Gen 3.0 (10 GT/sec) if you add the following lines to your /boot/firmware/config.txt.
# Enable the PCIe external connector
dtparam=pciex1
# Force Gen 3.0 speeds
dtparam=pciex1_gen=3
WARNING
The Raspberry Pi 5 is not certified for Gen 3.0 speeds, and connections to PCIe devices at these speeds may be unstable.
You should then reboot your Raspberry Pi for these settings to take effect.
Step 3 Booting from PCIe】
Once enabled, and after you reboot, an NVMe disk attached via the PCIe should be visible. However, your Raspberry Pi won’t try to boot off the NVMe drive. If you wish to enable boot support you will need to change the BOOT_ORDER in the bootloader configuration. Edit the EEPROM configuration by,
sudo rpi-eeprom-config --edit
and change the BOOT_ORDER line to be as below.
BOOT_ORDER=0xf416
after saving your changes, reboot your Raspberry Pi to update the EEPROM.
NOTE】
Your Raspberry Pi will not boot from an attached NVMe drive unless you have the external PCIe port enabledd, and there’s a NVMe drive with a valid boot partition attached to the PCIe bus.