Boot legacy PCs from NVMe storage
github.com
github.com
My preferred method to boot NVMe on a legacy system though is to boot tianocore UEFI with an NVME module in it[1]. This is a UEFI firmware that you can chainload from a legacy bios. Extremely good compatibility this way, and a great option for any system with an unused usb header.
1: https://winraid.level1techs.com/t/guide-nvme-boot-for-system...
Make backups of that USB drive or yeah it would be super cool if you could leverage the bios chip on a motherboard.
This means that the only M.2 drives it’ll boot from are non-NVMe PCIe drives, which were actually made as an HP OEM part (Z Turbo Drive) for this specific model of laptop, but are otherwise nonexistent.
It would be really nice if I could somehow add NVMe support to the laptop’s UEFI, but AFAIK there are no existing solutions for this, other than chainloading from a second drive.
The subsequent model (ZBook G3) actually does support NVMe, but HP never backported that support to the G2/G1 (of course, according to them, if you simply use the specified OEM parts there’s no problem…). Oh well, 2.5” SATA drives work just fine for such an old beast.
If you're interested in going down the rabbit hole, some light googling suggests that HP uses an AMI BIOS. You might be able to mod it: https://winraid.level1techs.com/t/howto-get-full-nvme-suppor...
This is not as rare, there were some drives which are logically seen as a PCI AHCI device (aka SATA controller). It is also possible to directly use actual SATA signaling in M.2 socket. This was way more common, and has a slightly different key position in the connector so it is easy to see visually. However I find it more likely it is a NVMe driver but with the proper option BIOS that makes it bootable.
Contrast this to NVMe drives, which are ubiquitous and cheap.
The laptop unfortunately doesn’t support M.2 SATA, but it does have a regular 2.5” SATA bay, so that’s what I’m using (it still has the OEM drive from the factory :))
If you already have UEFI, but no NVMe support all you need to do is boot into a UEFI shell-script (it’s a thing) which 1. loads a NVMe module (which you’ll need to provide, get it from tianocore), 2. does a device probe and 3. chain boots from the NVMe drive.
It’s not too much work to get going, barely a few megabytes and any old USB stick you have should make do without causing the USB stick to wear out because it won’t have to endure bootloader updates in the booted OS (which may happen if you put your whole /boot on the USB drive).
Indeed you can [0]. I have a Supermicro X9DRi-LN4F+ booting from an NVMe drive in a PCIe adapter, works great.
[0]: https://winraid.level1techs.com/t/howto-get-full-nvme-suppor...
Hold up - that works? I’ve got a SBC device that has to boot off sd card but has ssd attached.
Any pointers as to where I could read up more on how to split a fs system like that? I can copy files easily enough but presumably needs so additional magic to link/integrate it
The first step in the boot process is loading the boot firmware. On a BIOS/UEFI PC, this gives you Preboot Execution Environment (PXE) [0]. Raspberry Pi boards have something similar since the Pi 3, though it's not exactly PXE. Network booting allows you to setup a DHCP server in a way that automatically serves the machine a kernel, initramfs, and cmdline over the network. You can run a full Linux that way, though you probably want to switch_root [1] to another filesystem that has a block device backing it with more storage, for practical purposes. This is what most initramfs images do.
Once the machine can automatically retrieve those three, you're set. The initramfs can be built with whatever binaries, firmware, and kernel modules you need to initialize the network and set up an NBD or NFS share. Add `root=/dev/nbd0` or whatever, and you're running over the network.
Same concept applies to booting with a split boot partition. The boot partition contains the kernel, initramfs, and bootloader, along with the boot configuration. The kernel cmdline specifies which disk contains the root filesystem. It need not be on the same disk as the kernel, or even on the same machine.
[0] https://en.wikipedia.org/wiki/Preboot_Execution_Environment
>The kernel cmdline specifies which disk contains the root filesystem.
Here's a related bit from the kernel docs that describes the initramfs and switch_root in more detail.
https://www.kernel.org/doc/Documentation/filesystems/ramfs-r...
Interestingly, there's even a mechanism for leaving programs running even after exiting the initramfs.
It ultimately should not matter how Kernel + initramfs finds itself on RAM, or whether it was loaded from what it thinks it was loaded from. Kernel is just a baremetal program, and BIOS/firmware is just the least elaborate tool to make Kernel appear on RAM.
It's a heavily modified version of iPXE (which usually allows for booting from the network), but instead of the network, this code uses a port of the SeaBIOS NVMe implementation to talk to a local NVMe drive.
I can't help but feel like that's a very roundabout way of doing it (especially the fact that it seems to be manual?); after all, the BIOS Boot Specification exists and it's what lets PCs boot from things like SCSI and other block devices.
https://www.thinkwiki.org/wiki/Problem_with_non-ThinkPad_har...
It couldn't even take a proper hard drive when new, 18 years ago, but now it can boot from NVMe.
I don't think there's any smartness hiding inside of these, the connector and number of conductors will limit you to a ×2 or ×4 connection anyways.