NVMe boot argument

People with a NVMe SSD may want to try this boot argument:

nvme=0x3

Think debug output and skipping the ‘Apple SSD’ check, but this is it for today. Sorry. Had a long day here so I am going to my bed.

Edit: For people who think that there is no hope… like Carmine 😉

Here is what I did:

1.) Fix Info.plist so that IONVMeFamily.kext will load.

<key>GenericNVMeSSD</key>
<dict>
	<key>CFBundleIdentifier</key>
	<string>com.apple.iokit.IONVMeFamily</string>
	<key>Chipset Name</key>
	<string>SSD Controller</string>
	<key>IOClass</key>
	<string>IONVMeController</string>
	<key>IONameMatch</key>
	<array>
		<string>pci144d,a802</string>
	</array>
	<key>IOPCIPauseCompatible</key>
	<true/>
	<key>IOPCITunnelCompatible</key>
	<true/>
	<key>IOProviderClass</key>
	<string>IOPCIDevice</string>
	<key>IOUnitName</key>
	<string>disk</string>
	<key>Physical Interconnect</key>
	<string>PCI-Express</string>
	<key>Physical Interconnect Location</key>
	<string>Internal</string>
	<key>Vendor Name</key>
	<string>Apple</string>
</dict>

You can use whatever value and method you like. The good news is that now the IONVMeFamily.kext will load, but errors out over a LBA_DATA_SIZE error so we are going to fix this also.

2.) Patch the LBA_DATA_SIZE aka the block size shift value in the binary – change 0xc to 0x9) so that it initialises the IONVMeBlockStorageDevice.
IONVMeFamily LBA patch
Thing is. Apple uses ‘Preferred Block Size’ of 4096 KB (1 << 0xc) but the Samsung firmware only gives it 512KB (1 << 0x9) so we also need to solve this issue. And we can.

3.) Patch the ‘Preferred Block Size’ and ‘Size’ Properties with help of this patch:
IONVMeFamily Preferred Block Size patch
This will fix the ‘Size’ and ‘Preferred Block Size’ errors, so that diskutil list reports the right size, but the minute you do this, then the kext will error out (see verbose log output). The next hurdle is to patch other values like changing 0x1000 to 0x200 and 0xfff to 0x1ff.

4.) Now someone else can have a go at it… or in your dreams. No worries. I did it already so go read IONVMeFamily.kext is a GO.

34 thoughts on “NVMe boot argument

  1. Hi Pike, is this the patch that I asked you in the ‘New Hack for 2016’? to solve M.2 issues??

    Thanks in advanced!

    • No, but it should help people to understand what is going on, where it fails and what to patch (BlockDevice isn’t loading). Just look at the MacBook9,1 dumps and note the name AppleS3XBlockDevice, nowhere to be found in Sierra. At least not in the pre-beta that I was using.

  2. All what I (and all we) need is a _reliable_ kext, or even better, a way to patch the Apple IONVMeFamily.kext, preferably on the fly during boot loading, to make it work with ours SM951s, 950s PRO, and future SM961s (not a typo 😉 )

  3. Hi there, very sorry for the off-topic, but I didn’t know where else to write about it. GTX 1080 is a no go at the moment 😦 no acceleration, but it runs smoother than previos GTX series without it, weird… Have an IOREG just if you want to have a look at it..

  4. Hi there. Installed your kernel debug script. Now which output do you need and where can i find it, so i can send via email to you to have a look on it?, sorry, but i’m noob in those things… 😉

  5. thats my output:

    debugMachKernel.sh v0.2 Copyright (c) 2012 by † RevoGirl
    v1.2 Copyright (c) 2013-2016 by Pike R. Alpha
    —————————————————————-

    _kprintf found @ 0xFFFFFF800091B6A0
    Converted to…: 0x91b6a0 / 9549472
    File offset….: 0x71b6a0 / 7452320

    _printf found @ 0xFFFFFF8000315130
    Converted to…: 0x315130 / 3232048
    File offset….: 0x115130 / 1134896

    Error: _kprintf is already patched!
    Aborting …
    Done.

    So what does it mean: _kfrintf is already patched
    How can i avoid this to get the complete output?

  6. Hi pikeralpha, I just tried the sm961 with the nvmegeneric.kext under 10.11, the good news is that it can be installed as the boot disk. And I also tried with or without the flag nvme=0x3, sofar I haven’t seen any difference.
    The bad news is
    1 it reboots after sleep
    2 sometimes it reboots instead of shutdown
    3 sometimes shows kp on reboot or shutdown
    😢

  7. ok the following patch vor clover will make my NVMe devices regocnized by system, but partitionsheme doesn’t get recognized, so system wants to format the drives:

    KextsToPatch

    Comment
    NVMe SSD IONameMatch
    Disabled

    Name
    IONVMeFamily
    InfoPlistPatch

    Find
    PHN0cmluZz5wY2kxNDRkLGE4MDQ8L3N0cmluZz4=
    Replace
    PHN0cmluZz5wY2kxNDRkLGE4MDI8L3N0cmluZz4=

    Comment
    NVMe Size
    Disabled

    Find
    D7aMiIIAAACD+QwP
    Name
    IONVMeFamily
    Replace
    D7aMiIIAAACD+QkP

    Comment
    NVMe prefered BlockSize
    Disabled

    Find
    AADHg6QAAAAAEAAA
    Name
    IONVMeFamily
    Replace
    AADHg6QAAAAAAgAA

    What should be done to recognize the correct partitionsheme already on the devices?
    Maybe i could format the drive now, but one contains my WINDOWS system, the other my valid EL CAPITAN – which, of cause i don’t want to format right now 🙂

    Any hint is appreciated. Maybe someone can take a look at the screens here:
    http://www.insanelymac.com/forum/topic/312518-apple-unveils-macos-sierra/page-15#entry2244492

  8. Pingback: Stock Apple NVMeFamily.kext is a GO… – Pike's Universum

  9. Hey,
    would it be enough if I change the byte sequence 0xc to 0x9, 0x1000 to 0x200 and 0xfff to 0x1ff. in the right positions to get it working in Sierra release?

    (Darwin xx 16.0.0 Darwin Kernel Version 16.0.0: Mon Aug 29 17:56:20 PDT 2016; root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64)

    • No idea. I have yet to install the official release of macOS Sierra. Probably not going to happen before Saterday (back home Friday night).

      Edit: It was a bit of a struggle to get it done remotely, but the box is now running the official macOS Sierra release.

      • Wow, cool, i tried some things yesterday, the clover – like plist patches dont work because the base64 encoded string is way to long, so they don’t seem to match at all.

        then i tried this one https://github.com/Micky1979/NVMeP which seems to look for way shorter sequence of bits n bytes in the kext, the patch applyed successfully but the nvme ssd wasn’t found at all, so i guess there will be changes somewhere else. (as for the most people, patching hex style is quite new to me)

  10. Pingback: NVMe boot args and Dummy kext… – Pike's Universum

Leave a comment