1 August 2019 · macbook nvme dxe

Upgrading Macbook Pro 2013/2014 NVMe drive

This little  project took me like two months to pull this off and when I finally got the desired result I just felt obliged to post my success story.

First things first - I have MacbookPro Retina 13-inch Late 2013. I bought a Samsung 970 EVO 1TB from amazon and an adapter from eBay. At that time I didn't know about the macrumors forum and a topic almost 200 pages long about the issues I will face.

Suspecting nothing I did install the drive in the mac but on the first launch nothing happened. I remember having a gray screen and an icon in the center of the screen and that's it. I did not have the restore partition because I did a clean Windows 10 install on my old drive (without bootcamp). After some trial and error I found the magic key-press which brings up the internet-recovery menu. However I tried basically everything but the EVO drive would not show up. Then I decided to go with a windows 10 usb flash to try to install that on my new shiny EVO drive. The windows installer showed the drive for a brief period but when I had to do the partitioning, the drive would just disappear. That was when I first found this topic and I started to suspect that something is wrong with my NVMe adapter. I didn't order the sintech adapter right away, I wanted to be sure that it's really the adapter. After a lot of different experiments I finally got the drive showing up both in macos installer and windows 10 installer by just resetting the NVRAM (I think it was Option-Command-P-R key combination). I felt that finally the odds have turned in my favor and proceeded with MacOs Mojave installation. It was a success - got it running, had all my apps installed, the speed was also very good (1.3GB/sec) so I was about to close the case ... but ...

Chapter 2. The random restarting issue after closing the lid. I had to like go through 50+ pages from this topic to find out about the NVMe DXE  driver issue. That's when it hit me that it's going to be a pain in the ass. I did the pmset command to prevent the laptop from going into hibernation but this was not the result I expected. The battery basically died overnight by using this solution so I wanted a proper fix. Did the research and finally ordered CH341a programmer from Aliexpress. I also bought XTW100 programmer since those to basically cost nothing. That was like my backup plan for the 3.3v voltage issue with CH341a. Also bought the converting board/cable so I can plug the programmer in directly on the motherboard without de-soldering anything. It's actually crazy expensive - the cable is 55USD on ebay. You can find it by searching for "EFI-ROM Converting board for Apple MacBook J6100 SPI-ROM EFI ROM".

Meanwhile I was waiting for tools to arrive, I switched back to original macos drive so I don't have the reboot issues.

Chapter 3. The bootrom upgrade. Finally the tools arrived and I started digging for information how exactly to do the upgrade. Unfortunately the information is somehow incomplete - most of the guys who did the upgrade did not write the exact steps how they did it. But that did not stop me from my goal. After days of searching for information I finally felt ready to pull this off.

The procedure:
1) First I downloaded the Mojave installer on the macOs. That was a mistake because it did not contain the needed firmware bits. I ended up downloading the full dmg installer (macOSUpd10.14.5.dmg) manually:
https://updates.cdn-apple.com/2019/...4e-4a0a-8f82-7cc90315dbcc/macOSUpd10.14.5.dmg

2) I needed to do a backup of my old bootrom but it wasn't clear how exactly do to this and what is the proper way of doing it. After poking around I found out that the fastest way to do it on the same laptop is by executing in terminal:
/usr/libexec/firmwarecheckers/eficheck --save -b ~/firmware.bin

3) Then I downloaded the latest UEFItool from the github page (version  A55 as of today). But I later discovered that this version can't replace the DXE driver because it lacks the write functionality so you actually need the old UEFItool version - 0.25.1

4) Next I opened to instances of the UEFItool - one with my current bootrom firmware (MBP111) and other instance with MBP114. I was not sure which one to use because nobody had stated clearly which one to use ..  the only reference I found was that I need to use a firmware for macbooks 2015 or newer. So I went with the same type I had already MBP111->MBP114 ... You will need to find the MBP114.fd file in the macos mojave installer (first mount the dmg file then you need to find FirmwareUpdate.pkg in the installer and extract it with pkgutil --expand command, after that just find MBP114.fd or whatever version you need).

5) Then use UEFItool to search for text "nvme" and uncheck the Unicode flag. Do that for both instances. You will find a tree with GUID starting with 5111xxxx. I did extract that tree item from the MBP114 and then replaced it in my current firmware. From the first look it seemed that due to larger size it will overwrite the next item as the UEFItool showed multiple actions would be done by the replacement, but after saving the firmware and loading it in the UEFItool again everything seemed to be as it should be.

6) After that I opened the laptop and connected my CH341a with the adapter cable to the onboard plug. I used my desktop computer with windows 10 and used the CH341 v1.34 software for the flashing. The "detect" button showed multiple chip versions and I selected MX25L6405D. Did a test "read" on the chip and compared it with my extracted firmware which I did in step 2 with eficheck and it was a match

7) Then I opened the modified firmware and clicked "auto" (which does basically erase, verify, write operations in sequence). This is were things went south. After the erase was done the Verify action instantly complained that the chip is not erased properly. I tried to just force write it anyway, after that "Verify" also failed. And I had a brick ...  the laptop did not boot.

8) Started to look for clues and found that I need to disconnect the battery and also disconnect the magsafe. Did that but still the same results...

9) Eventually I was just trying everything I could possibly imagine -  connect the power, erase, disconnect power, verify, write, connect the power ... was trying different combinations but no luck. Then I tried to connect the CH341a to USB2 port instead of USB3. The erase operation somehow managed to clear half of the chip, but the other half was still not erased. Tried to play with the power adapter again... I'm not sure what was the exact combination but suddenly the erase completed and verify action started to go through successfully ... the percentage bar was slowly climbing and eventually hit 100% and reported a success. Then I did a write operation and the verify operation afterwards also completed successfully ... I had the power cord plugged in but I noticed that the power cord led is off ... no green light, no orange light ...  just completely off.

10) after that I disconnected the cables and booted the device - it was a success. Did a reset for the pmset so the hibernation is active again and closed the lid ... after 30 min I tried to open the lid and it successfully ran and went to the password prompt in about 5 seconds without any reboot...

I hope this helps someone to troubleshoot issues ...