Page 1 of 1

[SOLVED] Trouble patching firmware for WH16NS40

Posted: Fri Dec 17, 2021 10:35 pm
by skyzyx
This is less of a question, and more of a reminder for my future self.

This is my third LibreDrive. They keep dying on me. Most recently, I bought an LG-branded M-DISC drive, WH16NS40.

Code: Select all

Manufacturer: HL-DT-ST
Product: BD-RE WH16NS40
SVC code: NS50
Revision: 1.05
Firmware date: 2120-05-06 14:40
Manuf: April 2021
Bus encryption flags: 17
Highest AACS version: 76
Drive platform: MT1959
I've read viewtopic.php?f=16&t=19634. Since I definitely don't do this stuff all-day, every-day, these are the things that stood out to me from that page:
  • Recommended UHD Drives to get: LG WH16NS40, UHD Friendly Internal 5.25 (I have)
  • USB enclosures/sata adapters that work with optical drives and flashing: Vantec NST-536S3-BK 5.25 case (I have)
  • IMPORTANT Before you flash:
    • Make sure your Drive was built after 2015 on label (mine is 2021)
    • Drive Platform MT1959 (yep)
    • SVC NS50+ LG only on label (yep)
  • Newer OEM Firmwares and encrypted:
    • so far, any firmware with date in 2020 is encrypted
    • HL-DT-ST-BD-RE_WH16NS40-NS50-1.05-N000900-212005061440.bin (this is mine)
    • If your drive has one of these firmwares, and there is no MK version of the same firmware/drive model or higher number, you will have to sidegrade to […] LG WH16NS60 1.02MK for compatible LG 5.25 […]. (Note: MK firmware is available for firmware versions mentioned above.)
  • I already had the MK firmware downloaded, but apparently I needed something else instead.
  • I downloaded the all you need firmware pack, which I did not previously have.
  • The guide doesn't (currently) have a link to the file, but you can download sdf.bin from https://makemkv.com/sdf.bin.
I also read viewtopic.php?f=19&t=25773, which seemed to be very similar to my problem, except for the video drivers and such.

Next, I watched "Ultra HAX0R" GUIDE V2 for encrypted firmware, which I think is by Billycar11. Although it was made with Windows, the CLI part is generally the same across platforms.

I looked-up my drive ID:

Code: Select all

$ /Applications/MakeMKV.app/Contents/MacOS/makemkvcon f --list
Found 2 drives(s)
00: /IOBDServices/2C83DDBF
  Optiarc_BD_RW_BD-5730S_1.02_XXXXXXXXXXX

01: /IOBDServices/566DEB1E
  HL-DT-ST_BD-RE__WH16NS40_1.05_212005061440_XXXXXXXXXXX
I wanted the second one. Next, I looked up which commands were available:

Code: Select all

$ /Applications/MakeMKV.app/Contents/MacOS/makemkvcon f --help
Use: sdftool [switches] Command [Parameters]

Loads SDF.bin and invokes a specified command from drive-specific SDF,
or performs one of the built-in commands.

Built-in commands:
  --help                           prints this help
  --list, -l                       lists all available drives
  --tips[=addr]                    starts TIPS server
  --info                           prints SDF information and embedded text
  --version                        prints this tool version


Switches:
  -d,  --drive=NAME                select which drive to use
  -n,  --no-drive                  use a "dummy" drive
  -i,  --in=PATH                   specify input file, may be used multiple times
  -o,  --out=PATH                  specify folder for output files (if any)
  -v,  --verbose                   increase verbosity level
       --all-yes                   answer yes to all questions
  -f,  --sdf-file=PATH             specify explicit path to SDF.bin
       --sdf-version=VERSION       use specific SDF.bin version
  -t,  --sdf-type=TYPE             use specific entry from SDF.bin
       --config=PATH               specify explicit path to SDF.conf

Typical usage:

sdftool -l                         list all available drives
sdftool -d D: help                 list all commands available for the drive
sdftool -d D: dump -o c:\out       dump drive firmware
sdftool -d D: flash -i file.bin    flash drive firmware
There are a couple of important bits of information that seem to be missing here. One is the definition of `rawflash`, and any mention of what to do for encrypted firmwares. However, based on Billycar11’s video, I took a guess at the syntax I needed. (Linebreaks added for readability.)

Code: Select all

/Applications/MakeMKV.app/Contents/MacOS/makemkvcon f \
    --drive /IOBDServices/566DEB1E \
    --sdf-file ~/Downloads/mk-firmware-pack-20200720/sdf.bin \
    rawflash enc \
    --in ~/Downloads/firmware-pack/LG\ 5.25\ desktop/HL-DT-ST-BD-RE_WH16NS60-1.02-NM00100-211810291936.bin
Previously, I had used this command, which didn't work despite being the more correct model of the drive:

Code: Select all

/Applications/MakeMKV.app/Contents/MacOS/makemkvcon f \
    --drive /IOBDServices/566DEB1E \
    --sdf-file ~/Downloads/mk-firmware-pack-20200720/sdf.bin \
    rawflash main \
    --in ~/Downloads/mk-firmware-pack-20200720/MK/HL-DT-ST/WH16NS40-NS50/HL-DT-ST-BD-RE_WH16NS40-NS50-1.05-NM00900-212005061440.bin
I think it was the `rawflash main` → `rawflash enc` bit that made the difference (which, again, is undocumented in the binary).

In the end, I was able to verify the patch had been applied successfully with:

Code: Select all

/Applications/MakeMKV.app/Contents/MacOS/makemkvcon f --drive /IOBDServices/566DEB1E --info
…as well as by opening the .app and reading the information panel.

Code: Select all

Drive Information
Manufacturer: HL-DT-ST
Product: BD-RE WH16NS60
Revision: 1.02
Serial number: XXXXXXXXXXX
Firmware date: 2118-10-29 19:36
Bus encryption flags: 17
Highest AACS version: 76

LibreDrive Information
Status: Enabled
Drive platform: MT1959
Firmware type: Patched (microcode access re-enabled)
Firmware version: 1.02
DVD all regions: Yes
BD raw data read: Yes
BD raw metadata read: Yes
Unrestricted read speed: Yes
Thank you to those who have taken the time to put together the different guides and firmware packs! I hope this helps someone else who has found the various bits of information something to sift through.